Windows: Fix USB descriptor creation code for HID devices
authorToby Gray <toby.gray@realvnc.com>
Fri, 22 Mar 2013 13:50:01 +0000 (13:50 +0000)
committerPete Batard <pete@akeo.ie>
Mon, 1 Apr 2013 15:48:49 +0000 (16:48 +0100)
* Prior to this fix the location for the next endpoint structure was
  obtained by using ed++. This doesn't work as
  sizeof(libusb_endpoint_descriptor) is greater than
  LIBUSB_DT_ENDPOINT_SIZE due to extra members.
* Closes #110

libusb/os/windows_usb.c
libusb/version_nano.h

index d8156b8..1eb81b4 100644 (file)
@@ -3226,8 +3226,7 @@ static int _hid_get_config_descriptor(struct hid_device_priv* dev, void *data, s
                ed->bmAttributes = 3;
                ed->wMaxPacketSize = dev->input_report_size - 1;
                ed->bInterval = 10;
-
-               ed++;
+               ed = (struct libusb_endpoint_descriptor *)((char*)ed + LIBUSB_DT_ENDPOINT_SIZE);
        }
 
        if (dev->output_report_size) {
index 909ed7a..5a977a3 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10632
+#define LIBUSB_NANO 10633