hidapi returns the same path IOService:/IOResources/IOBluetoothHCIController/AppleBroadcomBluetoothHostController/IOBluetoothDevice/IOBluetoothL2CAPChannel/IOBluetoothHIDDriver
For every Bluetooth HID device connected. Tested with:
Nintendo Switch JoyCon (L)
Nintendo Switch JoyCon (R)
Nintendo Switch ProController
Microsoft Bluetooth Mouse 5000
(all devices have unique product IDs and serial numbers)
As a result, hid_open(vendor_id, product_id, serial_number) does not open the correct device if there is more than one bluetooth device paired since it eventually calls hid_open_path, and all the paths are identical. It looks like it will always try to open the device that was paired first.
I can open the correct device if I store a copy of the IOHIDDeviceRef in hid_device_info and create an IOHIDDevice with the reference rather than looking up the IORegistry entry from the path.
This is on a MacBookPro11,1 running macOS 10.14.6.
hidapi returns the same path IOService:/IOResources/IOBluetoothHCIController/AppleBroadcomBluetoothHostController/IOBluetoothDevice/IOBluetoothL2CAPChannel/IOBluetoothHIDDriver
For every Bluetooth HID device connected. Tested with:
Nintendo Switch JoyCon (L)
Nintendo Switch JoyCon (R)
Nintendo Switch ProController
Microsoft Bluetooth Mouse 5000
(all devices have unique product IDs and serial numbers)
As a result, hid_open(vendor_id, product_id, serial_number) does not open the correct device if there is more than one bluetooth device paired since it eventually calls hid_open_path, and all the paths are identical. It looks like it will always try to open the device that was paired first.
I can open the correct device if I store a copy of the IOHIDDeviceRef in hid_device_info and create an IOHIDDevice with the reference rather than looking up the IORegistry entry from the path.
This is on a MacBookPro11,1 running macOS 10.14.6.