If we call libusb_get_bos_descriptor() in the hotplug device-add handler then we eventually call libusb_handle_events_completed() which can run handle_events -- which might emit devices.
Using a mutex that's safe for recursing prevents the deadlock.
This fixes half the problem when getting descriptors on deeply nested USB hubs.
If we call libusb_get_bos_descriptor() in the hotplug device-add handler then we eventually call libusb_handle_events_completed() which can run handle_events -- which might emit devices. Using a mutex that's safe for recursing prevents the deadlock.
This fixes half the problem when getting descriptors on deeply nested USB hubs.