diff options
author | Pete Batard <pbatard@gmail.com> | 2010-10-26 18:58:19 +0100 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-10-26 18:58:19 +0100 |
commit | cb3d779b7c7c46ddfe9eb15f3f446c5d255a3d5a (patch) | |
tree | 1f6a537606820b7f9ce05cb4c5d14c9985b68b69 | |
parent | 5a2aa170f3a5ba651c76542ea6e65d4d78bcf3b6 (diff) | |
download | libusb-cb3d779b7c7c46ddfe9eb15f3f446c5d255a3d5a.tar.gz |
enum: allow out of hierarchical order processing of hubs
* Windows makes no guarantee that hubs are enumerated in root to leaf order
* Should address the issue reported by gorlik as part of trac #68
-rw-r--r-- | libusb/os/windows_usb.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 38a149b..49220c9 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -1418,6 +1418,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered switch (pass) { case HCD_PASS: case DEV_PASS: + case HUB_PASS: break; default: session_id = get_parent_session_id(dev_info_data.DevInst); @@ -1464,15 +1465,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered session_id = htab_hash(dev_id_path); dev = usbi_get_device_by_session_id(ctx, session_id); if (dev != NULL) { - // No need to re-process hubs - if (__device_priv(dev)->apib == &usb_api_backend[USB_API_HUB]) { - continue; - } usbi_dbg("found existing device for session [%lX]", session_id); - // TODO (post hotplug): reuse priv data that can be reused - for now, just recreate - if (pass == GEN_PASS) { - windows_device_priv_release(dev); - } } else { if (pass == DEV_PASS) { usbi_err(ctx, "program assertion failed: device '%s' was not listed in generic pass", dev_id_path); @@ -1550,6 +1543,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered case HUB_PASS: priv->apib = &usb_api_backend[USB_API_HUB]; priv->path = dev_interface_path; dev_interface_path = NULL; + break; // fall through, as we must initialize hubs before generic devices case GEN_PASS: init_device(dev, parent_dev, (uint8_t)port_nr, dev_id_path); |