Closed nevrax closed 7 years ago
according to HID.devices() we could use the serialNumber
var myController = new XboxController('70623960');
var player1 = new XboxController('A4DE0760');
var player2 = new XboxController('70623960');
all devices
[ { vendorId: 1118,
productId: 654,
path: 'Wireless_045e_028e_4100002',
serialNumber: 'A4DE0760',
manufacturer: 'Microsoft',
product: 'Wireless 360 Controller',
release: 0,
interface: -1,
usagePage: 1,
usage: 5 },
{ vendorId: 1118,
productId: 654,
path: 'Wireless_045e_028e_4100001',
serialNumber: '70623960',
manufacturer: 'Microsoft',
product: 'Wireless 360 Controller',
release: 0,
interface: -1,
usagePage: 1,
usage: 5 } ]
that's also valid for DualShock controllers (note: the Unknown manufacturer is actually Sony (DS4)
[ { vendorId: 1356,
productId: 616,
path: 'Bluetooth_054c_0268_75517eb7',
serialNumber: '00-06-f5-51-7e-b7',
manufacturer: 'Sony',
product: 'PLAYSTATION(R)3 Controller',
release: 256,
interface: -1,
usagePage: 1,
usage: 4 } ]
[ { vendorId: 1356,
productId: 1476,
path: 'Bluetooth_054c_05c4_5aad1995',
serialNumber: '1c-96-5a-ad-19-95',
manufacturer: 'Unknown',
product: 'Wireless Controller',
release: 256,
interface: -1,
usagePage: 1,
usage: 5 } ]
something similar was already coded by @barisbalic on multiple-controllers branch.
it would be great to have this commit https://github.com/andrew/node-xbox-controller/commit/d910af8a7e91d5f4c4e5c3be3a16583ea661849e tested and merged into master branch.
thank you!
update
it might be possible that a HID controller connected via USB cable not to have a serialNumber in HID.devices().
since DualShock controllers can work via Bluetooth or USB cable I was able to make a test with a DS3 connected via Bluetooth and a DS4 connected via USB cable.
[ { vendorId: 1356,
productId: 616,
path: 'Bluetooth_054c_0268_75517eb7',
serialNumber: '00-06-f5-51-7e-b7',
manufacturer: 'Sony',
product: 'PLAYSTATION(R)3 Controller',
release: 256,
interface: -1,
usagePage: 1,
usage: 4 } ]
[ { vendorId: 1356,
productId: 1476,
path: 'USB_054c_05c4_4100000',
serialNumber: '',
manufacturer: 'Sony Computer Entertainment',
product: 'Wireless Controller',
release: 256,
interface: -1,
usagePage: 1,
usage: 5 } ]
the same is also valid for a non-xbox or a non-ds USB controller.
{ vendorId: 3727,
productId: 18,
path: 'USB_0e8f_0012_26220000',
serialNumber: '',
manufacturer: 'GreenAsia Inc.',
product: 'USB Joystick',
release: 263,
interface: -1,
usagePage: 1,
usage: 4 },
having this said maybe a better idea is to use a filter by vendorId and path or only by path.
[ { vendorId: 1118,
productId: 654,
path: 'Wireless_045e_028e_26210002',
serialNumber: '70623960',
manufacturer: 'Microsoft',
product: 'Wireless 360 Controller',
release: 0,
interface: -1,
usagePage: 1,
usage: 5 }
{ vendorId: 1118,
productId: 654,
path: 'Wireless_045e_028e_26210001',
serialNumber: 'A4DE0760',
manufacturer: 'Microsoft',
product: 'Wireless 360 Controller',
release: 0,
interface: -1,
usagePage: 1,
usage: 5 } ]
I'm no longer supporting this library as I don't use it any longer so I'm going to close this issue.
some non-xbox contollers (ex: dualshock3 or dualshock4) are detected as native xbox controllers.
if would be nice to have a filtering option.
also it would be great if i could use multiple xbox controllers for a multi player setup.