Skip to content

Commit

Permalink
Merge pull request #26 from badcel/support-hidapi-0130
Browse files Browse the repository at this point in the history
Support hidapi 0.13.0
  • Loading branch information
badcel authored Feb 17, 2023
2 parents 460a9a9 + 5b25897 commit 9315acc
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/HidApi.Net/BusType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace HidApi;

#if HIDAPI_0130
/// <summary>
/// An enum describing the different bus types.
/// </summary>
Expand All @@ -13,4 +12,3 @@ public enum BusType
I2C = 0x03,
Spi = 0x04
}
#endif
2 changes: 0 additions & 2 deletions src/HidApi.Net/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ public string GetSerialNumber(int maxLength = 128)
return WCharT.GetString(buffer);
}

#if HIDAPI_0130
/// <summary>
/// Returns the device info for a device.
/// </summary>
Expand All @@ -250,7 +249,6 @@ public DeviceInfo GetDeviceInfo()
return DeviceInfo.From(ptr);
}
}
#endif

/// <summary>
/// Returns a string from its index.
Expand Down
6 changes: 0 additions & 6 deletions src/HidApi.Net/DeviceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ namespace HidApi;
/// <param name="UsagePage">Usage page</param>
/// <param name="Usage">Usage</param>
/// <param name="InterfaceNumber">interface number</param>
#if HIDAPI_0130
/// <param name="BusType"><see cref="BusType"/> (Available since hidapi 0.13.0)</param>
#endif
public record DeviceInfo(
string Path
, ushort VendorId
Expand All @@ -29,9 +27,7 @@ string Path
, ushort UsagePage
, ushort Usage
, int InterfaceNumber
#if HIDAPI_0130
, BusType BusType
#endif
)
{
/// <summary>
Expand All @@ -56,9 +52,7 @@ internal static unsafe DeviceInfo From(NativeDeviceInfo* nativeDeviceInfo)
, UsagePage: nativeDeviceInfo->UsagePage
, Usage: nativeDeviceInfo->Usage
, InterfaceNumber: nativeDeviceInfo->InterfaceNumber
#if HIDAPI_0130
, BusType: nativeDeviceInfo->BusType
#endif
);
}
}
2 changes: 1 addition & 1 deletion src/HidApi.Net/HidApi.Net.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>0.2.1</VersionPrefix>
<VersionPrefix>0.3.0</VersionPrefix>

<RootNamespace>HidApi</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
3 changes: 1 addition & 2 deletions src/HidApi.Net/Internal/NativeDeviceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal readonly unsafe struct NativeDeviceInfo
public readonly ushort Usage;
public readonly int InterfaceNumber;
public readonly NativeDeviceInfo* Next;
#if HIDAPI_0130
/// <remarks>Available since hidapi 0.13.0</remarks>
public readonly BusType BusType;
#endif
};

0 comments on commit 9315acc

Please sign in to comment.