-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
59 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
|
||
namespace Nefarius.Utilities.DeviceManagement.PnP; | ||
|
||
/// <summary> | ||
/// Provides common device class <see cref="Guid" />s. | ||
/// </summary> | ||
public static class DeviceClassIds | ||
{ | ||
/// <summary> | ||
/// USB devices. | ||
/// </summary> | ||
public static Guid Usb => Guid.Parse("{36FC9E60-C465-11CF-8056-444553540000}"); | ||
|
||
/// <summary> | ||
/// Xbox 360 Peripherals. | ||
/// </summary> | ||
public static Guid XnaComposite => Guid.Parse("{d61ca365-5af4-4486-998b-9db4734c6ca3}"); | ||
|
||
/// <summary> | ||
/// Xbox Peripherals. | ||
/// </summary> | ||
public static Guid XboxComposite => Guid.Parse("{05f5cfe2-4733-4950-a6bb-07aad01a3a84}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,47 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Nefarius.Utilities.DeviceManagement.PnP | ||
namespace Nefarius.Utilities.DeviceManagement.PnP; | ||
|
||
/// <summary> | ||
/// Provides common device interface <see cref="Guid" />s. | ||
/// </summary> | ||
public static class DeviceInterfaceIds | ||
{ | ||
/// <summary> | ||
/// Provides common device interface <see cref="Guid" />s. | ||
/// An interface exposed on USB host controllers. | ||
/// </summary> | ||
public static Guid UsbHostController => Guid.Parse("{3abf6f2d-71c4-462a-8a92-1e6861e6af27}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on USB hubs. | ||
/// </summary> | ||
public static class DeviceInterfaceIds | ||
public static Guid UsbHub => Guid.Parse("{f18a0e88-c30c-11d0-8815-00a0c906bed8}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on USB devices. | ||
/// </summary> | ||
public static Guid UsbDevice => Guid.Parse("{a5dcbf10-6530-11d2-901f-00c04fb951ed}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on XUSB (Xbox 360) or XGIP (Xbox One) compatible (XInput) devices. | ||
/// </summary> | ||
public static Guid XUsbDevice => Guid.Parse("{EC87F1E3-C13B-4100-B5F7-8B84D54260CB}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on HID devices. | ||
/// </summary> | ||
public static Guid HidDevice | ||
{ | ||
/// <summary> | ||
/// An interface exposed on USB host controllers. | ||
/// </summary> | ||
public static Guid UsbHostController => Guid.Parse("{3abf6f2d-71c4-462a-8a92-1e6861e6af27}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on USB hubs. | ||
/// </summary> | ||
public static Guid UsbHub => Guid.Parse("{f18a0e88-c30c-11d0-8815-00a0c906bed8}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on USB devices. | ||
/// </summary> | ||
public static Guid UsbDevice => Guid.Parse("{a5dcbf10-6530-11d2-901f-00c04fb951ed}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on XUSB (Xbox 360) or XGIP (Xbox One) compatible (XInput) devices. | ||
/// </summary> | ||
public static Guid XUsbDevice => Guid.Parse("{EC87F1E3-C13B-4100-B5F7-8B84D54260CB}"); | ||
|
||
/// <summary> | ||
/// An interface exposed on HID devices. | ||
/// </summary> | ||
public static Guid HidDevice | ||
get | ||
{ | ||
get | ||
{ | ||
// GUID_DEVINTERFACE_HID exists but this is considered best practice | ||
HidD_GetHidGuid(out var guid); | ||
// GUID_DEVINTERFACE_HID exists but this is considered best practice | ||
HidD_GetHidGuid(out Guid guid); | ||
|
||
return guid; | ||
} | ||
return guid; | ||
} | ||
|
||
[DllImport("hid.dll", EntryPoint = "HidD_GetHidGuid", SetLastError = true)] | ||
private static extern void HidD_GetHidGuid(out Guid guid); | ||
} | ||
|
||
[DllImport("hid.dll", EntryPoint = "HidD_GetHidGuid", SetLastError = true)] | ||
private static extern void HidD_GetHidGuid(out Guid guid); | ||
} |