Windows: Remove port member from device's private structure
authorChris Dickens <christopher.a.dickens@gmail.com>
Thu, 4 Jan 2018 23:52:56 +0000 (15:52 -0800)
committerChris Dickens <christopher.a.dickens@gmail.com>
Thu, 4 Jan 2018 23:52:56 +0000 (15:52 -0800)
The libusb_device structure already has a port_number member that stores
the same information, so don't duplicate this elsewhere.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/os/windows_winusb.c
libusb/os/windows_winusb.h
libusb/version_nano.h

index 897d931..7ab0cc7 100644 (file)
@@ -903,7 +903,7 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
                size = sizeof(cd_buf_short);
                memset(&cd_buf_short, 0, size);
 
-               cd_buf_short.req.ConnectionIndex = (ULONG)priv->port;
+               cd_buf_short.req.ConnectionIndex = (ULONG)dev->port_number;
                cd_buf_short.req.SetupPacket.bmRequest = LIBUSB_ENDPOINT_IN;
                cd_buf_short.req.SetupPacket.bRequest = LIBUSB_REQUEST_GET_DESCRIPTOR;
                cd_buf_short.req.SetupPacket.wValue = (LIBUSB_DT_CONFIG << 8) | i;
@@ -932,7 +932,7 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle
                }
 
                // Actual call
-               cd_buf_actual->ConnectionIndex = (ULONG)priv->port;
+               cd_buf_actual->ConnectionIndex = (ULONG)dev->port_number;
                cd_buf_actual->SetupPacket.bmRequest = LIBUSB_ENDPOINT_IN;
                cd_buf_actual->SetupPacket.bRequest = LIBUSB_REQUEST_GET_DESCRIPTOR;
                cd_buf_actual->SetupPacket.wValue = (LIBUSB_DT_CONFIG << 8) | i;
@@ -1035,7 +1035,6 @@ static int init_device(struct libusb_device *dev, struct libusb_device *parent_d
        }
 
        dev->bus_number = parent_dev->bus_number;
-       priv->port = port_number;
        dev->port_number = port_number;
        priv->depth = parent_priv->depth + 1;
        dev->parent_dev = parent_dev;
@@ -1123,7 +1122,7 @@ static int init_device(struct libusb_device *dev, struct libusb_device *parent_d
        usbi_sanitize_device(dev);
 
        usbi_dbg("(bus: %u, addr: %u, depth: %u, port: %u): '%s'",
-               dev->bus_number, dev->device_address, priv->depth, priv->port, device_id);
+               dev->bus_number, dev->device_address, priv->depth, dev->port_number, device_id);
 
        return LIBUSB_SUCCESS;
 }
index 6d9c3cd..c58847a 100644 (file)
@@ -197,7 +197,6 @@ struct hid_device_priv {
 
 struct windows_device_priv {
        uint8_t depth; // distance to HCD
-       uint8_t port;  // port number on the hub
        uint8_t active_config;
        struct windows_usb_api_backend const *apib;
        char *path;  // device interface path
index 6ecb77b..3ff898e 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11253
+#define LIBUSB_NANO 11254