如何将DirectInput(sharpDX)设备映射到it';s对应的HID(C#)

如何将DirectInput(sharpDX)设备映射到it';s对应的HID(C#),c#,usb,hid,sharpdx,gamepad-api,C#,Usb,Hid,Sharpdx,Gamepad Api,我需要的是找到SharpDX.DirectInput DeviceInstance当前对应HID的方法 我在DirectInput端拥有的是: ProductId -> 00060079-0000-0000-0000-504944564944 (always the same) InstanceId -> 8e3d89c0-6436-11e9-8004-444553540000 (dynamic / changes every time PC starts) 在HID侧: Vend

我需要的是找到SharpDX.DirectInput DeviceInstance当前对应HID的方法

我在DirectInput端拥有的是:

ProductId -> 00060079-0000-0000-0000-504944564944 (always the same)
InstanceId -> 8e3d89c0-6436-11e9-8004-444553540000 (dynamic / changes every time PC starts)
在HID侧:

VendorID=0x0079
ProductID=0x0006,
Version=263,
DevicePath=\\?\hid#vid_0079&pid_0006#8&1ec29a1c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
我可以看到HID vendorId和ProductId用于构建DirectInput ProductId。问题是我有多个控制器与同一个VendorId和ProductId连接(它们是同一品牌)

有办法做到这一点吗?要知道DirectInput InstanceId的HID设备路径

用于上下文:

我正在编写一个软件来自动配置我的定制街机的许多模拟器上的许多控制器。模拟器使用DirectInput/XInput/DSUClient()的组合。因此,对于每个连接的控制器,我需要知道所有控制器的信息,以便能够在每个模拟器上正确配置每个控制器

现在作为一个(非常糟糕的)解决方法,我正在收听从HID分离出来的DirectInput输入,当读取发生时,我知道HID设备是DirectInput设备,因为它们(几乎)同时发生


我已经用“ManagementObjectSearcher”尝试了“Win32_pPentity”,但没有成功

我最终找到了解决方案

DirectInput directInput = new DirectInput();
foreach (var deviceInstance in directInput.GetDevices())
{
    var joystick = new Joystick(directInput, deviceInstance.InstanceGuid);
    Console.WriteLine(joystick.Properties.InterfacePath)
}