From c698d892ca4daea9128a11d079a34d69401fe807 Mon Sep 17 00:00:00 2001 From: Meng Xi Zhu Date: Tue, 26 Jun 2018 14:26:41 -0400 Subject: [PATCH] Vendor and product ID equals to 0 means match on any; Reduced buffer to 2 from 64 --- windows/hid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/hid.c b/windows/hid.c index 86810d7e..06aae33e 100755 --- a/windows/hid.c +++ b/windows/hid.c @@ -525,8 +525,8 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi devs = hid_enumerate(vendor_id, product_id); cur_dev = devs; while (cur_dev) { - if (cur_dev->vendor_id == vendor_id && - cur_dev->product_id == product_id) { + if ((cur_dev->vendor_id == vendor_id || vendor_id == 0) && + (cur_dev->product_id == product_id || product_id == 0)) { if (serial_number) { if (wcscmp(serial_number, cur_dev->serial_number) == 0) { path_to_open = cur_dev->path; @@ -576,7 +576,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path) } /* Set the Input Report buffer size to 64 reports. */ - res = HidD_SetNumInputBuffers(dev->device_handle, 64); + res = HidD_SetNumInputBuffers(dev->device_handle, 2); if (!res) { register_error(dev, "HidD_SetNumInputBuffers"); goto err;