Commit 868551b1218511892b5f619aefbec728081c8a43

Sam Lantinga 2019-12-20T21:00:16

Fixed duplicate controller entries on Mac OS X when using libusb, due to the HID interface number not being available in the Mac OS X HID code.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index a06c2cf..c35c44f 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -559,7 +559,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
             for (raw_dev = raw_devs; raw_dev; raw_dev = raw_dev->next) {
                 if (usb_dev->vendor_id == raw_dev->vendor_id &&
                     usb_dev->product_id == raw_dev->product_id &&
-                    usb_dev->interface_number == raw_dev->interface_number) {
+                    (raw_dev->interface_number < 0 || usb_dev->interface_number == raw_dev->interface_number)) {
                     bFound = SDL_TRUE;
                     break;
                 }