From cb3d779b7c7c46ddfe9eb15f3f446c5d255a3d5a Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 26 Oct 2010 18:58:19 +0100 Subject: 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 --- libusb/os/windows_usb.c | 10 ++-------- 1 file 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); -- cgit v1.2.1