summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-02-18 21:07:19 +0000
committerPete Batard <pbatard@gmail.com>2010-02-18 21:07:19 +0000
commit87b577fda721cda97165cfd82b40531c8248d496 (patch)
treec5da5dbac11e80aa522cfaaf71daa028cae411b3
parent5276f2ab665ab86d26029d8687e3b1c8988bf034 (diff)
downloadlibusb-87b577fda721cda97165cfd82b40531c8248d496.tar.gz
fixed improper parent when reusing device + cosmetics fixesr164
-rw-r--r--libusb/os/windows_usb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index b089ba0..084257e 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -744,7 +744,7 @@ static int usb_enumerate_hub(struct libusb_context *ctx, struct discovered_devs
char *tmp_str = NULL, *path_str = NULL;
unsigned long session_id;
libusb_devaddr_t devaddr = 0;
- struct windows_device_priv *priv, *parent_priv;
+ struct windows_device_priv *priv, *parent_priv;
// obviously, root (HCD) hubs have no parent
is_hcd = (parent_dev == NULL);
@@ -876,6 +876,10 @@ static int usb_enumerate_hub(struct libusb_context *ctx, struct discovered_devs
if (dev) {
usbi_dbg("using existing device for session %ld", session_id);
priv = __device_priv(dev);
+ // Because we are rebuilding the list, there's no guarantee
+ // the parent device pointer is still the same.
+ // Other device data should still be reusable
+ priv->parent_dev = parent_dev;
} else {
usbi_dbg("allocating new device for session %ld", session_id);
if ((dev = usbi_alloc_device(ctx, session_id)) == NULL) {
@@ -3372,7 +3376,7 @@ static int hid_open(struct libusb_device_handle *dev_handle)
break;
}
}
- usbi_dbg("will use report ID 0x%02X for interrupt transfers", priv->hid->output_report_id);
+ usbi_dbg(" will use report ID 0x%02X for interrupt transfers", priv->hid->output_report_id);
} else {
usbi_warn(ctx, "could process output report IDs");
}