xan105/node-xinput-ffi

[Feature Request] Enhanced identification method for multiple Xbox controllers on Windows

chef-wally opened this issue · 2 comments

Hello, I was wondering if anyone knows of a way to uniquely identify multiple XInput Xbox controllers on Windows when connected wireless.

I'm using the Xbox Wireless Adapter for Windows 10 and it can connect up to 8 controllers. I only had 2 to test with and it seems that the Instance Guid of the controller is linked to the JoystickId, it is not a unique identifier for the controller. For example, if I turn controller 2 on first it will be JoystickId 0 and Instance Guid: {170c5400-59e9-11ee-8001-444553540000}.

For example, if I connect controller 2 first then controller 1. controller 1 becomes controller 2 and controller 2 becomes controller 1. The solution is to turn off both devices and always turn controller 1 on first then controller 2, but I'd like to be able to turn them on in any order as they might loose battery, turn off because of inactivity etc.

Xbox Wireless Adapter for Windows 10:
Model No: 1790 (6HN-00006)
Display Name: Xbox Wireless Adapter for Windows Device
Instance Path: USB\VID_045E&PID_02FE\200142
Driver Version: 1.0.46.1
JoystickId: 0, Instance Guid: {170c5400-59e9-11ee-8001-444553540000}
JoystickId: 1, Instance Guid: {55ae4380-59e9-11ee-8001-444553540000} 

The Device Instance Path is also not a unique identifier as the values in <> change.

Controller 1:
Model No: 1914 (QAS-00003) - Xbox Wireless Controller - Robot White
Display Name: XINPUT compatible HID device Device
Instance Path: HID\VID_045E&PID_0B12&IG_00\<7&1E02870D&10&0000>
Driver Version: 10.0.19041.3031
Product Name: Controller (Xbox One For Windows)
Vendor Id: 1118
Product Id: 2834 

Controller 2:
Model No: 1914 (QAS-00003) - Xbox Wireless Controller - Robot White
Display Name: XINPUT compatible HID device Device
Instance Path: HID\VID_045E&PID_0B12&IG_00\<7&3A2C557E&E&0000>
Driver Version: 10.0.19041.3031
Product Name: Controller (Xbox One For Windows)
Vendor Id: 1118
Product Id: 2834
xan105 commented

I do not have the hardware to test with WMI _Win32_PNPEntity.
But anyway it's just a gimmick to try to help the situation. As stated in the README: It's kinda by design to be a pain / impossible to id a controller with XInput. Even with hidden getCapabilitiesEx vid/pid are almost always generic xbox controller.

You would perhaps have more luck with newest gamepad API such as GameInput ?

thanks, it seems with MS GDK the following may work. just attempted to configure GDK for C#, failed horribly. I'll attempt it again some other time too confusing ha.

APP_LOCAL_DEVICE_ID deviceId;
APP_LOCAL_DEVICE_ID deviceRootId;