From f6b1e028ab46bae7667db240d2238cd59f3a9d76 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 29 Oct 2022 10:42:48 -0700 Subject: [PATCH] Allow vendor matching for hid_enumerate() on all backends --- src/hidapi/android/hid.cpp | 4 ++-- src/hidapi/mac/hid.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index de365d005..2b2af72db 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -1089,8 +1089,8 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor for ( hid_device_ref pDevice = g_Devices; pDevice; pDevice = pDevice->next ) { const hid_device_info *info = pDevice->GetDeviceInfo(); - if ( ( vendor_id == 0 && product_id == 0 ) || - ( vendor_id == info->vendor_id && product_id == info->product_id ) ) + if ( ( vendor_id == 0x0 || info->vendor_id == vendor_id ) && + ( product_id == 0x0 || info->product_id == product_id ) ) { hid_device_info *dev = CopyHIDDeviceInfo( info ); dev->next = root; diff --git a/src/hidapi/mac/hid.c b/src/hidapi/mac/hid.c index 35ca38037..d52b94f0a 100644 --- a/src/hidapi/mac/hid.c +++ b/src/hidapi/mac/hid.c @@ -568,8 +568,8 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, dev_pid = get_product_id(dev); /* Check the VID/PID against the arguments */ - if ((vendor_id == 0x0 && product_id == 0x0) || - (vendor_id == dev_vid && product_id == dev_pid)) { + if ((vendor_id == 0x0 || dev_vid == vendor_id) && + (product_id == 0x0 || dev_pid == product_id)) { struct hid_device_info *tmp; /* VID/PID match. Create the record. */