Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotplugtest crash when unplug an external USB hub under macOS #1445

Closed
mcuee opened this issue Jan 24, 2024 · 25 comments
Closed

hotplugtest crash when unplug an external USB hub under macOS #1445

mcuee opened this issue Jan 24, 2024 · 25 comments

Comments

@mcuee
Copy link
Member

mcuee commented Jan 24, 2024

From here:

Initially no USB devices were attached. Then I pluged in the USB hub (with one USB device attached), then I unpluged the USB hub, which would casue the crash.

mcuee@mcuees-Mac-mini libusb % ./examples/listdevs
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000024] [000087e8] libusb: debug [libusb_init_context] created default context
[ 0.000030] [000087e8] libusb: debug [libusb_init_context] libusb v1.0.27.11874-rc1
[ 0.000043] [000087e8] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000114] [000087e9] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000285] [000087e9] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000320] [000087e8] libusb: debug [libusb_get_device_list]  
[ 0.000353] [000087e8] libusb: debug [libusb_exit] destroying default context
[ 0.000366] [000087e9] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 0.000473] [000087e8] libusb: debug [usbi_remove_event_source] remove fd 3
mcuee@mcuees-Mac-mini libusb % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000024] [0000881c] libusb: debug [libusb_init_context] created default context
[ 0.000030] [0000881c] libusb: debug [libusb_init_context] libusb v1.0.27.11874-rc1
[ 0.000040] [0000881c] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000115] [0000881d] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000327] [0000881d] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000362] [0000881c] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600001264210 with handle 1
[ 0.000367] [0000881c] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x6000012641e0 with handle 2
[ 0.000375] [0000881c] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.000377] [0000881c] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.000380] [0000881c] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.000384] [0000881c] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 5.267009] [0000881d] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8fa2b5471
[ 5.267258] [0000881d] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8fa2b5471
[ 5.278855] [0000881d] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 5.278917] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 5.278971] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 5.278977] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 5.278981] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 5.279018] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 5.279027] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 5.279032] [0000881d] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 5.279035] [0000881d] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 5.279039] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 5.279042] [0000881d] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 5.279071] [0000881d] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 5.279076] [0000881d] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 5.279080] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 5.279132] [0000881d] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 5.279140] [0000881d] libusb: debug [process_new_device] allocating new device in context 0x135f04c00 for with session 0x8fa2b5471
[ 5.279146] [0000881d] libusb: debug [process_new_device] found device with address 31 port = 1 parent = 0x0 at 0x60000327c0ba
[ 5.279240] [0000881c] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 5.279249] [0000881c] libusb: debug [handle_event_trigger] event triggered
[ 5.279253] [0000881c] libusb: debug [handle_event_trigger] hotplug message received
[ 5.279260] [0000881c] libusb: debug [libusb_get_device_descriptor]  
Device attached: 1a40:0201
[ 5.279285] [0000881c] libusb: debug [libusb_open] open 2.31
[ 5.279570] [0000881c] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 5.279648] [0000881c] libusb: debug [darwin_open] device open for access
[ 5.279658] [0000881c] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 5.279662] [0000881c] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 5.279667] [0000881c] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 5.526906] [0000881d] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8fa8b402c
[ 5.527172] [0000881d] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8fa2b5471
[ 5.527183] [0000881d] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8fa8b402c/0x2150000 against cached device with sessionID/locationID 0x8fa2b5471/0x2100000
[ 5.527188] [0000881d] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8fa8b402c
[ 5.537741] [0000881d] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 5.537769] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 5.537774] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 5.537778] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 5.537782] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 5.537785] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 5.537788] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 5.537792] [0000881d] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 5.537795] [0000881d] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 5.537798] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 5.537801] [0000881d] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 5.537804] [0000881d] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 5.537807] [0000881d] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 5.537811] [0000881d] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 5.537931] [0000881d] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 5.537938] [0000881d] libusb: debug [process_new_device] allocating new device in context 0x135f04c00 for with session 0x8fa8b402c
[ 5.537984] [0000881d] libusb: debug [process_new_device] found device with address 32 port = 5 parent = 0x6000038600c0 at 0x6000032780ba
[ 5.538082] [0000881c] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 5.538090] [0000881c] libusb: debug [handle_event_trigger] event triggered
[ 5.538121] [0000881c] libusb: debug [handle_event_trigger] hotplug message received
[ 5.538150] [0000881c] libusb: debug [libusb_get_device_descriptor]  
Device attached: 1a40:0201
[ 5.538174] [0000881c] libusb: debug [libusb_close]  
[ 5.538194] [0000881c] libusb: debug [libusb_open] open 2.32
[ 5.538526] [0000881c] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 5.538640] [0000881c] libusb: debug [darwin_open] device open for access
[ 5.538650] [0000881c] libusb: debug [libusb_close]  
[ 5.538664] [0000881c] libusb: debug [libusb_exit] destroying default context
[ 5.538669] [0000881c] libusb: debug [libusb_unref_device] destroy device 2.32
[ 5.538675] [0000881c] libusb: debug [libusb_unref_device] destroy device 2.31
[ 5.538707] [0000881d] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 5.540439] [0000881c] libusb: debug [usbi_remove_event_source] remove fd 3
mcuee@mcuees-Mac-mini libusb % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000019] [00008915] libusb: debug [libusb_init_context] created default context
[ 0.000024] [00008915] libusb: debug [libusb_init_context] libusb v1.0.27.11874-rc1
[ 0.000036] [00008915] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000110] [00008916] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000289] [00008916] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000424] [00008915] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8fa2b5471
[ 0.000461] [00008915] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8fa2b5471
[ 0.002202] [00008915] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002207] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002209] [00008915] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.002211] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002213] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002214] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002215] [00008915] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002217] [00008915] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.002219] [00008915] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.002221] [00008915] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.002222] [00008915] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.002224] [00008915] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.002225] [00008915] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002227] [00008915] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002242] [00008915] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002245] [00008915] libusb: debug [process_new_device] allocating new device in context 0x146605230 for with session 0x8fa2b5471
[ 0.002248] [00008915] libusb: debug [process_new_device] found device with address 31 port = 1 parent = 0x0 at 0x600001754e3a
[ 0.002302] [00008915] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8fa8b402c
[ 0.002322] [00008915] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8fa2b5471
[ 0.002325] [00008915] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8fa8b402c/0x2150000 against cached device with sessionID/locationID 0x8fa2b5471/0x2100000
[ 0.002327] [00008915] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8fa8b402c
[ 0.002485] [00008915] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002489] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002491] [00008915] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.002492] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002494] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002495] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002497] [00008915] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002498] [00008915] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.002500] [00008915] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.002502] [00008915] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.002503] [00008915] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.002505] [00008915] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.002506] [00008915] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002507] [00008915] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002523] [00008915] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002526] [00008915] libusb: debug [process_new_device] allocating new device in context 0x146605230 for with session 0x8fa8b402c
[ 0.002528] [00008915] libusb: debug [process_new_device] found device with address 32 port = 5 parent = 0x600001d54240 at 0x60000175503a
[ 0.002569] [00008915] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8faecdad4
[ 0.002583] [00008915] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8fa8b402c
[ 0.002585] [00008915] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8faecdad4/0x2156000 against cached device with sessionID/locationID 0x8fa8b402c/0x2150000
[ 0.002587] [00008915] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8faecdad4/0x2156000 against cached device with sessionID/locationID 0x8fa2b5471/0x2100000
[ 0.002589] [00008915] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8faecdad4
[ 0.002734] [00008915] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002738] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002739] [00008915] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.002741] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.002742] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002744] [00008915] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.002745] [00008915] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.002747] [00008915] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.002749] [00008915] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.002750] [00008915] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.002752] [00008915] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002753] [00008915] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002755] [00008915] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002756] [00008915] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002767] [00008915] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002769] [00008915] libusb: debug [process_new_device] allocating new device in context 0x146605230 for with session 0x8faecdad4
[ 0.002771] [00008915] libusb: debug [process_new_device] found device with address 3 port = 6 parent = 0x600001d542a0 at 0x60000175513a
[ 0.002778] [00008915] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600003754b10 with handle 1
[ 0.002781] [00008915] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600003754b70 with handle 2
[ 0.002786] [00008915] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.002789] [00008915] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.002791] [00008915] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.002794] [00008915] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 2.794948] [00008916] libusb: debug [darwin_devices_detached] notifying context 0x146605230 of device disconnect
[ 2.795760] [00008915] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 2.795781] [00008915] libusb: debug [handle_event_trigger] event triggered
[ 2.795786] [00008915] libusb: debug [handle_event_trigger] hotplug message received
[ 2.795799] [00008915] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1a40:0201
[ 2.795870] [00008915] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 2.795876] [00008915] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 2.795882] [00008915] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 2.797542] [00008916] libusb: debug [darwin_devices_detached] notifying context 0x146605230 of device disconnect
[ 2.797901] [00008915] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 2.797915] [00008915] libusb: debug [handle_event_trigger] event triggered
[ 2.797921] [00008915] libusb: debug [handle_event_trigger] hotplug message received
[ 2.797929] [00008915] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1a40:0201
[ 2.797941] [00008915] libusb: debug [libusb_exit] destroying default context
zsh: segmentation fault  ./examples/hotplugtest
mcuee@mcuees-Mac-mini libusb % ./examples/listdevs  
1915:1025 (bus 2, device 4) path: 1.5.6
1a40:0201 (bus 2, device 1) path: 1.5
1a40:0201 (bus 2, device 2) path: 1
mcuee@mcuees-Mac-mini libusb % ./examples/testlibusb
Dev (bus 2, device 4): 1915 - 1025 speed: 12M
  Manufacturer:              ZY.Ltd
  Product:                   ZY Control Mic
Dev (bus 2, device 1): 1A40 - 0201 speed: 480M
  Product:                   USB 2.0 Hub [MTT]
Dev (bus 2, device 2): 1A40 - 0201 speed: 480M
  Product:                   USB 2.0 Hub [MTT]
@mcuee
Copy link
Member Author

mcuee commented Jan 24, 2024

From @seanm

As I've said elsewhere, there are numerous threading bugs that still exist. Thread Sanitizer exposes some of them, so does -Wthread-safety. Once 1.0.27 is out, and more of my PRs are merged, I'll continue #1419, which will hopefully help.

@mcuee
Copy link
Member Author

mcuee commented Jan 24, 2024

From here

If I just unplug the attached USB device on the external HUB, then no issues. The following is with git main without any extra patches.

mcuee@mcuees-Mac-mini hotplug_debug % sudo ./examples/hotplugtest
Device detached: 1915:1025 (note: detach)
Device attached: 1915:1025 (note: attach)

The issue only appears if I unplug the external hub.

mcuee@mcuees-Mac-mini hotplug_debug % sudo ./examples/hotplugtest                                                             
Device detached: 1a40:0201
Device detached: 1a40:0201
AddressSanitizer:DEADLYSIGNAL
=================================================================
==30976==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0001032c9c60 bp 0x00016d0471d0 sp 0x00016d047130 T0)
==30976==The signal is caused by a WRITE memory access.
==30976==Hint: address points to the zero page.
    #0 0x1032c9c60 in list_del libusbi.h:222
    #1 0x1032c9afc in usbi_hotplug_exit hotplug.c:209
    #2 0x1032bddd4 in libusb_exit core.c:2612
    #3 0x102dbaf24 in main hotplugtest.c:144
    #4 0x18c1f90dc  (<unknown module>)

==30976==Register values:
 x[0] = 0x0000000105f00a40   x[1] = 0x00000001036e00e0   x[2] = 0x000000016d0469a0   x[3] = 0x00000000000001f4  
 x[4] = 0x0000000000000030   x[5] = 0x0000000000000001   x[6] = 0x000000016c84c000   x[7] = 0x0000000000000001  
 x[8] = 0x0000007000020000   x[9] = 0x0000000000000000  x[10] = 0x0000000000000000  x[11] = 0x000000700001ffff  
x[12] = 0x000000016d0469d8  x[13] = 0x5cf5f6c7f63726fc  x[14] = 0x000000016d047240  x[15] = 0x0000000000000000  
x[16] = 0x000000018c574eac  x[17] = 0x00000001037f8728  x[18] = 0x0000000000000000  x[19] = 0x000000016d0474a0  
x[20] = 0x0000000102dba9c0  x[21] = 0x000000016d0475f0  x[22] = 0x00000001031cd910  x[23] = 0x000000016d047670  
x[24] = 0x000000016d0476b0  x[25] = 0x000000018c2785eb  x[26] = 0x0000000000000000  x[27] = 0x0000000000000000  
x[28] = 0x0000000000000000     fp = 0x000000016d0471d0     lr = 0x00000001032c9b00     sp = 0x000000016d047130  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV libusbi.h:222 in list_del
==30976==ABORTING
zsh: abort      sudo ./examples/hotplugtest

@mcuee
Copy link
Member Author

mcuee commented Jan 28, 2024

On the other hand, this is not a regression as it is also present in libusb-1.0.26 release.

So this is not a release blocker for 1.0.27 release.

@sonatique
Copy link
Contributor

@mcuee : you may want to try if #1452 helps here.

@mcuee
Copy link
Member Author

mcuee commented Jan 31, 2024

@mcuee : you may want to try if #1452 helps here.

Unfortunately it does not help.

mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/hotplugtest 
Device detached: 1a40:0201
Device detached: 1a40:0201
zsh: segmentation fault  ./examples/hotplugtest
Debug log for segfault when unplug an external HUB under macOS
mcuee@mcuees-Mac-mini libusb_pr1452 % export LIBUSB_DEBUG=4
mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000024] [0000b2e1] libusb: debug [libusb_init_context] created default context
[ 0.000030] [0000b2e1] libusb: debug [libusb_init_context] libusb v1.0.27.11878-rc2
[ 0.000040] [0000b2e1] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000127] [0000b2e2] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000404] [0000b2e2] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000540] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x597b25d7c
[ 0.000579] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x597b25d7c
[ 0.002652] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002658] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002660] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.002662] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002663] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002665] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.002666] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.002668] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002669] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.002672] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002674] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002675] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002677] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002678] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002696] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002698] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x597b25d7c
[ 0.002701] [0000b2e1] libusb: debug [process_new_device] found device with address 19 port = 6 parent = 0x0 at 0x6000027681ba
[ 0.002758] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x597b3dc17
[ 0.002782] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x597b3dc17/0x2200000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.002785] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x597b3dc17
[ 0.002965] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002969] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002970] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.002972] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002974] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002975] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002976] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002978] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002980] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.002981] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002983] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002985] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002986] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002988] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002998] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003000] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x597b3dc17
[ 0.003003] [0000b2e1] libusb: debug [process_new_device] found device with address 18 port = 2 parent = 0x0 at 0x6000027683ba
[ 0.003051] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x597d19100
[ 0.003072] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x597b25d7c
[ 0.003075] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x597d19100/0x2610000 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.003077] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x597d19100/0x2610000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.003079] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x597d19100
[ 0.003231] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003236] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003238] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003239] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003241] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003242] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003244] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003245] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003247] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003249] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003251] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003252] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003254] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003255] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003266] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003268] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x597d19100
[ 0.003270] [0000b2e1] libusb: debug [process_new_device] found device with address 20 port = 1 parent = 0x600002d68120 at 0x6000027684ba
[ 0.003311] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x597f6e651
[ 0.003330] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x597b3dc17
[ 0.003332] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x597f6e651/0x2240000 against cached device with sessionID/locationID 0x597d19100/0x2610000
[ 0.003334] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x597f6e651/0x2240000 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.003336] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x597f6e651/0x2240000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.003338] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x597f6e651
[ 0.003482] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003485] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003487] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.003488] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003490] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003491] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003493] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003494] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.003496] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.003498] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.003499] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.003501] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.003502] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003504] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003514] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003516] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x597f6e651
[ 0.003518] [0000b2e1] libusb: debug [process_new_device] found device with address 22 port = 4 parent = 0x600002d68180 at 0x6000027685ba
[ 0.003558] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5980f546d
[ 0.003574] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x597b3dc17
[ 0.003576] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5980f546d/0x2210000 against cached device with sessionID/locationID 0x597f6e651/0x2240000
[ 0.003578] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5980f546d/0x2210000 against cached device with sessionID/locationID 0x597d19100/0x2610000
[ 0.003580] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5980f546d/0x2210000 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.003582] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5980f546d/0x2210000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.003584] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5980f546d
[ 0.003710] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003714] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003715] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.003717] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003719] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003720] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003722] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003723] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003725] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.003726] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003728] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003730] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003731] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003733] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003742] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003744] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x5980f546d
[ 0.003746] [0000b2e1] libusb: debug [process_new_device] found device with address 23 port = 1 parent = 0x600002d68180 at 0x6000027686ba
[ 0.003786] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x59856e086
[ 0.003803] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x597f6e651
[ 0.003805] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59856e086/0x2246000 against cached device with sessionID/locationID 0x5980f546d/0x2210000
[ 0.003807] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59856e086/0x2246000 against cached device with sessionID/locationID 0x597f6e651/0x2240000
[ 0.003809] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59856e086/0x2246000 against cached device with sessionID/locationID 0x597d19100/0x2610000
[ 0.003811] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59856e086/0x2246000 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.003812] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59856e086/0x2246000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.003858] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x59856e086
[ 0.004097] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004104] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004106] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004108] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004110] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004112] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004113] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004115] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x046d
[ 0.004116] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0xc52b
[ 0.004118] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x2410
[ 0.004119] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004121] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004123] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004124] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004139] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004142] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x59856e086
[ 0.004144] [0000b2e1] libusb: debug [process_new_device] found device with address 24 port = 6 parent = 0x600002d68240 at 0x60000276c93a
[ 0.004198] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x59863d615
[ 0.004216] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x597f6e651
[ 0.004219] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59863d615/0x2245000 against cached device with sessionID/locationID 0x59856e086/0x2246000
[ 0.004221] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59863d615/0x2245000 against cached device with sessionID/locationID 0x5980f546d/0x2210000
[ 0.004224] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59863d615/0x2245000 against cached device with sessionID/locationID 0x597f6e651/0x2240000
[ 0.004226] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59863d615/0x2245000 against cached device with sessionID/locationID 0x597d19100/0x2610000
[ 0.004228] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59863d615/0x2245000 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.004229] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x59863d615/0x2245000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.004231] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x59863d615
[ 0.004391] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004396] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004397] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004399] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004401] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004402] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.004404] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004405] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.004407] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.004409] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.004410] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.004412] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.004413] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004415] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004426] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004428] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x59863d615
[ 0.004430] [0000b2e1] libusb: debug [process_new_device] found device with address 25 port = 5 parent = 0x600002d68240 at 0x60000276ca3a
[ 0.004473] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x598c36d56
[ 0.004493] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x59863d615
[ 0.004496] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x59863d615/0x2245000
[ 0.004498] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x59856e086/0x2246000
[ 0.004500] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x5980f546d/0x2210000
[ 0.004501] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x597f6e651/0x2240000
[ 0.004504] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x597d19100/0x2610000
[ 0.004506] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.004507] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x598c36d56/0x2245600 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.004509] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x598c36d56
[ 0.004656] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004660] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004662] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.004663] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004665] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004667] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004668] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004670] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.004671] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.004673] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.004675] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004676] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004678] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004679] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004691] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004694] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x598c36d56
[ 0.004696] [0000b2e1] libusb: debug [process_new_device] found device with address 26 port = 6 parent = 0x600002d6c1e0 at 0x60000276cb3a
[ 0.004748] [0000b2e1] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5a6907b7e
[ 0.004764] [0000b2e1] libusb: debug [darwin_get_cached_device] parent sessionID: 0x597d19100
[ 0.004766] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x598c36d56/0x2245600
[ 0.004768] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x59863d615/0x2245000
[ 0.004770] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x59856e086/0x2246000
[ 0.004772] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x5980f546d/0x2210000
[ 0.004774] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x597f6e651/0x2240000
[ 0.004784] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x597d19100/0x2610000
[ 0.004786] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x597b3dc17/0x2200000
[ 0.004788] [0000b2e1] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5a6907b7e/0x2612000 against cached device with sessionID/locationID 0x597b25d7c/0x2600000
[ 0.004790] [0000b2e1] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5a6907b7e
[ 0.004934] [0000b2e1] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004938] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004939] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.004941] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004943] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004944] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004946] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.004947] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.004949] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.004950] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.004952] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.004953] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.004955] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.004956] [0000b2e1] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004967] [0000b2e1] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004969] [0000b2e1] libusb: debug [process_new_device] allocating new device in context 0x124704d50 for with session 0x5a6907b7e
[ 0.004971] [0000b2e1] libusb: debug [process_new_device] found device with address 27 port = 2 parent = 0x600002d681e0 at 0x60000276cc3a
[ 0.004978] [0000b2e1] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x60000076c480 with handle 1
[ 0.004980] [0000b2e1] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x60000076c4e0 with handle 2
[ 0.004987] [0000b2e1] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.004989] [0000b2e1] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.004992] [0000b2e1] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.004995] [0000b2e1] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.970910] [0000b2e2] libusb: debug [darwin_devices_detached] notifying context 0x124704d50 of device disconnect
[ 3.971154] [0000b2e1] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.971196] [0000b2e1] libusb: debug [handle_event_trigger] event triggered
[ 3.971203] [0000b2e1] libusb: debug [handle_event_trigger] hotplug message received
[ 3.971212] [0000b2e1] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1a40:0201
[ 3.971276] [0000b2e1] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.971282] [0000b2e1] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.971289] [0000b2e1] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.975756] [0000b2e2] libusb: debug [darwin_devices_detached] notifying context 0x124704d50 of device disconnect
[ 3.975838] [0000b2e1] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.975846] [0000b2e1] libusb: debug [handle_event_trigger] event triggered
[ 3.975852] [0000b2e1] libusb: debug [handle_event_trigger] hotplug message received
[ 3.975859] [0000b2e1] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1a40:0201
[ 3.975871] [0000b2e1] libusb: debug [libusb_exit] destroying default context
[ 3.975878] [0000b2e1] libusb: debug [libusb_unref_device] destroy device 2.27
zsh: segmentation fault  ./examples/hotplugtest

make check is okay so no regression.

mcuee@mcuees-Mac-mini libusb_pr1452 % make check
Making check in libusb
make[1]: Nothing to be done for `check'.
Making check in examples
make[1]: Nothing to be done for `check'.
Making check in tests
/Library/Developer/CommandLineTools/usr/bin/make  check-TESTS
PASS: stress
PASS: stress_mt
PASS: set_option
PASS: init_context
PASS: macos
============================================================================
Testsuite summary for libusb-1.0 1.0.27-rc2
============================================================================
# TOTAL: 5
# PASS:  5
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[1]: Nothing to be done for `check-am'.

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

The following test is using @sonatique's Windows hotplug branch.
sonatique@b280d6e

Build option -- with Apple Clang Address Scan.

CFLAGS="-g -fsanitize=address" ../configure --enable-tests-build --enable-examples-build

Mac Mini M1 --> 7-ports powered USB 3.0 Hub --> 13 ports powered USB 2.0 Hub

  1. Unplug the 7-ports USB 3.0 Hub --> segfaults
mcuee@mcuees-Mac-mini debug_apple_clang % ./examples/hotplugtest                                                                  
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000132] [00025766] libusb: debug [libusb_init_context] created default context
[ 0.000139] [00025766] libusb: debug [libusb_init_context] libusb v1.0.27.11878-rc2
[ 0.000150] [00025766] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000320] [00025768] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000495] [00025768] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000622] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de703d801
[ 0.000643] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de703d801
[ 0.002540] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002545] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002548] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.002550] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002551] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002553] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002555] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002557] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002559] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.002561] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002563] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002564] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002566] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002568] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002581] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002584] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de703d801
[ 0.002588] [00025766] libusb: debug [process_new_device] found device with address 30 port = 2 parent = 0x0 at 0x103800eba
[ 0.002627] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de7079fff
[ 0.002643] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7079fff/0x2600000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.002647] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de7079fff
[ 0.002773] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002777] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002779] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.002780] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002782] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002784] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.002786] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.002788] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002789] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.002791] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002793] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002795] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002796] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002798] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002807] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002810] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de7079fff
[ 0.002813] [00025766] libusb: debug [process_new_device] found device with address 31 port = 6 parent = 0x0 at 0x103800d3a
[ 0.002846] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de7257664
[ 0.002859] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de7079fff
[ 0.002862] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7257664/0x2610000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.002864] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7257664/0x2610000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.002867] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de7257664
[ 0.002976] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002979] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002981] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.002983] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002984] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002986] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.002988] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.002990] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002991] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.002993] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002995] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002997] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002999] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003000] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003009] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003011] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de7257664
[ 0.003014] [00025766] libusb: debug [process_new_device] found device with address 32 port = 1 parent = 0x103600920 at 0x103800bba
[ 0.003048] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de74c9091
[ 0.003064] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de703d801
[ 0.003066] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de74c9091/0x2210000 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.003069] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de74c9091/0x2210000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.003071] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de74c9091/0x2210000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.003073] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de74c9091
[ 0.003184] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003187] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003189] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.003191] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003193] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003194] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003196] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003198] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003200] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.003201] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003203] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003205] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003207] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003208] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003217] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003219] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de74c9091
[ 0.003222] [00025766] libusb: debug [process_new_device] found device with address 8 port = 1 parent = 0x103600aa0 at 0x103800a3a
[ 0.003253] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de758251b
[ 0.003265] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de703d801
[ 0.003268] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de758251b/0x2240000 against cached device with sessionID/locationID 0x5de74c9091/0x2210000
[ 0.003270] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de758251b/0x2240000 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.003272] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de758251b/0x2240000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.003275] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de758251b/0x2240000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.003277] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de758251b
[ 0.003377] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003380] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003382] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.003384] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003385] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003387] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003389] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003391] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.003393] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.003394] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.003396] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.003398] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.003400] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003401] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003409] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003411] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de758251b
[ 0.003414] [00025766] libusb: debug [process_new_device] found device with address 11 port = 4 parent = 0x103600aa0 at 0x1038008ba
[ 0.003444] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de75a4dc4
[ 0.003458] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de7257664
[ 0.003460] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de75a4dc4/0x2612000 against cached device with sessionID/locationID 0x5de758251b/0x2240000
[ 0.003463] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de75a4dc4/0x2612000 against cached device with sessionID/locationID 0x5de74c9091/0x2210000
[ 0.003465] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de75a4dc4/0x2612000 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.003467] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de75a4dc4/0x2612000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.003470] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de75a4dc4/0x2612000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.003502] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de75a4dc4
[ 0.003696] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003701] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003704] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.003706] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.003707] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003709] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.003711] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003713] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.003715] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.003716] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.003718] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.003720] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.003722] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.003724] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003735] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003738] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de75a4dc4
[ 0.003742] [00025766] libusb: debug [process_new_device] found device with address 12 port = 2 parent = 0x1036007a0 at 0x10380073a
[ 0.003785] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de7b9f507
[ 0.003803] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de758251b
[ 0.003806] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7b9f507/0x2244000 against cached device with sessionID/locationID 0x5de75a4dc4/0x2612000
[ 0.003809] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7b9f507/0x2244000 against cached device with sessionID/locationID 0x5de758251b/0x2240000
[ 0.003811] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7b9f507/0x2244000 against cached device with sessionID/locationID 0x5de74c9091/0x2210000
[ 0.003814] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7b9f507/0x2244000 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.003816] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7b9f507/0x2244000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.003819] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7b9f507/0x2244000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.003821] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de7b9f507
[ 0.003948] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003952] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003954] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.003956] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x02
[ 0.003958] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003959] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.003961] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003963] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x2341
[ 0.003965] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0058
[ 0.003967] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.003969] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003970] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003972] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x03
[ 0.003974] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003983] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003986] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de7b9f507
[ 0.003989] [00025766] libusb: debug [process_new_device] found device with address 13 port = 4 parent = 0x1036004a0 at 0x1038005ba
[ 0.004021] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de7c7bce6
[ 0.004034] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de758251b
[ 0.004037] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de7b9f507/0x2244000
[ 0.004039] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de75a4dc4/0x2612000
[ 0.004042] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de758251b/0x2240000
[ 0.004044] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de74c9091/0x2210000
[ 0.004047] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.004049] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.004052] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7c7bce6/0x2245000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.004054] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de7c7bce6
[ 0.004168] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004171] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004173] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004175] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004177] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004179] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.004180] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004182] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.004184] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.004186] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.004187] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.004189] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.004191] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004193] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004201] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004203] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de7c7bce6
[ 0.004207] [00025766] libusb: debug [process_new_device] found device with address 14 port = 5 parent = 0x1036004a0 at 0x10380043a
[ 0.004237] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de7dabe02
[ 0.004250] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de758251b
[ 0.004252] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de7c7bce6/0x2245000
[ 0.004255] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de7b9f507/0x2244000
[ 0.004257] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de75a4dc4/0x2612000
[ 0.004260] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de758251b/0x2240000
[ 0.004262] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de74c9091/0x2210000
[ 0.004280] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.004284] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.004286] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de7dabe02/0x2246000 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.004288] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de7dabe02
[ 0.004417] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004421] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004423] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004425] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004427] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004428] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004430] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004432] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x046d
[ 0.004434] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0xc52b
[ 0.004435] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x2410
[ 0.004437] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004439] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004441] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004443] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004452] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004454] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de7dabe02
[ 0.004457] [00025766] libusb: debug [process_new_device] found device with address 15 port = 6 parent = 0x1036004a0 at 0x1038002ba
[ 0.004497] [00025766] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x5de8263f9d
[ 0.004512] [00025766] libusb: debug [darwin_get_cached_device] parent sessionID: 0x5de7c7bce6
[ 0.004515] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de7dabe02/0x2246000
[ 0.004517] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de7c7bce6/0x2245000
[ 0.004520] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de7b9f507/0x2244000
[ 0.004522] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de75a4dc4/0x2612000
[ 0.004525] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de758251b/0x2240000
[ 0.004527] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de74c9091/0x2210000
[ 0.004529] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de7257664/0x2610000
[ 0.004532] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de7079fff/0x2600000
[ 0.004534] [00025766] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x5de8263f9d/0x2245600 against cached device with sessionID/locationID 0x5de703d801/0x2200000
[ 0.004537] [00025766] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x5de8263f9d
[ 0.004645] [00025766] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004649] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004651] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.004653] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004654] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004656] [00025766] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004658] [00025766] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004660] [00025766] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.004661] [00025766] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.004663] [00025766] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.004665] [00025766] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004667] [00025766] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004669] [00025766] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004670] [00025766] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004679] [00025766] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004682] [00025766] libusb: debug [process_new_device] allocating new device in context 0x100503c00 for with session 0x5de8263f9d
[ 0.004684] [00025766] libusb: debug [process_new_device] found device with address 16 port = 6 parent = 0x103603da0 at 0x10380013a
[ 0.004692] [00025766] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103307110 with handle 1
[ 0.004695] [00025766] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x1033070d0 with handle 2
[ 0.004697] [00025766] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.004699] [00025766] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.004702] [00025766] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.004705] [00025766] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.625572] [00025768] libusb: debug [darwin_devices_detached] notifying context 0x100503c00 of device disconnect
[ 3.626035] [00025768] libusb: debug [darwin_devices_detached] notifying context 0x100503c00 of device disconnect
[ 3.626540] [00025766] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.626562] [00025766] libusb: debug [handle_event_trigger] event triggered
[ 3.626576] [00025766] libusb: debug [handle_event_trigger] hotplug message received
[ 3.626593] [00025766] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 3.626687] [00025766] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:5411
[ 3.626707] [00025766] libusb: debug [libusb_exit] destroying default context
[ 3.626720] [00025766] libusb: debug [libusb_unref_device] destroy device 2.16
[ 3.626738] [00025766] libusb: debug [libusb_unref_device] destroy device 2.15
[ 3.626748] [00025766] libusb: debug [libusb_unref_device] destroy device 2.14
[ 3.626757] [00025766] libusb: debug [libusb_unref_device] destroy device 2.13
AddressSanitizer:DEADLYSIGNAL
=================================================================
==26080==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00010098d95c bp 0x00016f982ec0 sp 0x00016f982e20 T0)
==26080==The signal is caused by a WRITE memory access.
==26080==Hint: address points to the zero page.
    #0 0x10098d95c in list_del libusbi.h:222
    #1 0x10098dc88 in usbi_recursively_remove_parents hotplug.c:176
    #2 0x10098dcd4 in usbi_recursively_remove_parents hotplug.c:179
    #3 0x10098d7fc in usbi_hotplug_exit hotplug.c:224
    #4 0x100981c78 in libusb_exit core.c:2619
    #5 0x10047ef0c in main hotplugtest.c:152
    #6 0x1820210dc  (<unknown module>)

==26080==Register values:
 x[0] = 0x0000000103600940   x[1] = 0x00000001036004a0   x[2] = 0x000000016f9826d0   x[3] = 0x00000000000003fa  
 x[4] = 0x0000000000000060   x[5] = 0x0000000000000001   x[6] = 0x000000016f188000   x[7] = 0x0000000000000001  
 x[8] = 0x0000007000020000   x[9] = 0x0000000000000000  x[10] = 0x0000000000000000  x[11] = 0x000000700001ffff  
x[12] = 0x000000016f982710  x[13] = 0x27c12c66bdba5072  x[14] = 0x0000000000000000  x[15] = 0x0000000000000000  
x[16] = 0x000000018239ceac  x[17] = 0x0000000100ebc728  x[18] = 0x0000000000000000  x[19] = 0x000000016f983260  
x[20] = 0x000000010047e9a8  x[21] = 0x000000016f9833c0  x[22] = 0x0000000100891910  x[23] = 0x000000016f983440  
x[24] = 0x000000016f983480  x[25] = 0x00000001820a062b  x[26] = 0x0000000000000000  x[27] = 0x0000000000000000  
x[28] = 0x0000000000000000     fp = 0x000000016f982ec0     lr = 0x000000010098dc8c     sp = 0x000000016f982e20  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV libusbi.h:222 in list_del
==26080==ABORTING
zsh: abort      ./examples/hotplugtest
  1. No issues when attaching the 7-ports USB 3.0 hub.
mcuee@mcuees-Mac-mini debug_apple_clang % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000102] [00025dc5] libusb: debug [libusb_init_context] created default context
[ 0.000113] [00025dc5] libusb: debug [libusb_init_context] libusb v1.0.27.11878-rc2
[ 0.000126] [00025dc5] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000228] [00025dc6] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000379] [00025dc6] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000407] [00025dc5] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103a01c90 with handle 1
[ 0.000412] [00025dc5] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103a01c50 with handle 2
[ 0.000415] [00025dc5] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.000417] [00025dc5] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.000420] [00025dc5] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.000424] [00025dc5] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 9.760169] [00025dc6] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609aeabed0
[ 9.760302] [00025dc6] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609aeabed0
[ 9.769460] [00025dc6] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 9.769491] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 9.769500] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 9.769505] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 9.769511] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 9.769515] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 9.769519] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 9.769524] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 9.769528] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 9.769533] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 9.769537] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 9.769566] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 9.769573] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 9.769577] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 9.769618] [00025dc6] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 9.769625] [00025dc6] libusb: debug [process_new_device] allocating new device in context 0x100c03c00 for with session 0x609aeabed0
[ 9.769639] [00025dc6] libusb: debug [process_new_device] found device with address 6 port = 2 parent = 0x0 at 0x103f0463a
[ 9.769749] [00025dc5] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 9.769764] [00025dc5] libusb: debug [handle_event_trigger] event triggered
[ 9.769771] [00025dc5] libusb: debug [handle_event_trigger] hotplug message received
[ 9.769785] [00025dc5] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:5411
[ 9.769827] [00025dc5] libusb: debug [libusb_open] open 2.6
[ 9.770369] [00025dc5] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 9.770485] [00025dc5] libusb: debug [darwin_open] device open for access
[ 9.770506] [00025dc5] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 9.770539] [00025dc5] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 9.770549] [00025dc5] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 9.864037] [00025dc6] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b0f574f
[ 9.864178] [00025dc6] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b0f574f/0x2600000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 9.864267] [00025dc6] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b0f574f
[ 9.871959] [00025dc6] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 9.872008] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 9.872019] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 9.872028] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 9.872037] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 9.872045] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 9.872053] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 9.872060] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 9.872068] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 9.872076] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 9.872084] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 9.872091] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 9.872099] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 9.872107] [00025dc6] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 9.872160] [00025dc6] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 9.872174] [00025dc6] libusb: debug [process_new_device] allocating new device in context 0x100c03c00 for with session 0x609b0f574f
[ 9.872228] [00025dc6] libusb: debug [process_new_device] found device with address 1 port = 6 parent = 0x0 at 0x103f044ba
[ 9.872525] [00025dc5] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 9.872547] [00025dc5] libusb: debug [handle_event_trigger] event triggered
[ 9.872560] [00025dc5] libusb: debug [handle_event_trigger] hotplug message received
[ 9.872580] [00025dc5] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:0411
[ 9.872600] [00025dc5] libusb: debug [libusb_close]  
[ 9.872633] [00025dc5] libusb: debug [libusb_open] open 2.1
[ 9.873004] [00025dc5] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 9.873109] [00025dc5] libusb: debug [darwin_open] device open for access
[ 9.873131] [00025dc5] libusb: debug [libusb_close]  
[ 9.873158] [00025dc5] libusb: debug [libusb_exit] destroying default context
[ 9.873172] [00025dc5] libusb: debug [libusb_unref_device] destroy device 2.1
[ 9.873184] [00025dc5] libusb: debug [libusb_unref_device] destroy device 2.6
[ 9.873240] [00025dc6] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 9.875031] [00025dc5] libusb: debug [usbi_remove_event_source] remove fd 3

BTW, the branch has no issues with make check under macOS.

mcuee@mcuees-Mac-mini debug_apple_clang % make check
Making check in libusb
make[1]: Nothing to be done for `check'.
Making check in examples
make[1]: Nothing to be done for `check'.
Making check in tests
/Library/Developer/CommandLineTools/usr/bin/make  check-TESTS
PASS: stress
PASS: stress_mt
PASS: set_option
PASS: init_context
PASS: macos
============================================================================
Testsuite summary for libusb-1.0 1.0.27-rc2
============================================================================
# TOTAL: 5
# PASS:  5
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[1]: Nothing to be done for `check-am'.

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

git main (same as 1.0.27 release) results are the same.

Unplug --> Segfault; Plug --> no issues
mcuee@mcuees-Mac-mini arm64_debug % export LIBUSB_DEBUG=4
mcuee@mcuees-Mac-mini arm64_debug % ./examples/hotplugtest                                                                  
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000134] [0002c794] libusb: debug [libusb_init_context] created default context
[ 0.000141] [0002c794] libusb: debug [libusb_init_context] libusb v1.0.27.11882
[ 0.000162] [0002c794] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000320] [0002c796] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000497] [0002c796] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000611] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609aeabed0
[ 0.000632] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609aeabed0
[ 0.002327] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002332] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002334] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.002336] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002338] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002340] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002342] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002344] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002345] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.002347] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002349] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002351] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002353] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002354] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002367] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002370] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609aeabed0
[ 0.002374] [0002c794] libusb: debug [process_new_device] found device with address 6 port = 2 parent = 0x0 at 0x103400f7a
[ 0.002413] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b0f574f
[ 0.002430] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b0f574f/0x2600000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.002433] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b0f574f
[ 0.002557] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002561] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002563] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.002564] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002566] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002568] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.002570] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.002571] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002573] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.002575] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002577] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002579] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002580] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002582] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002592] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002594] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609b0f574f
[ 0.002597] [0002c794] libusb: debug [process_new_device] found device with address 1 port = 6 parent = 0x0 at 0x103400dfa
[ 0.002629] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b2ee296
[ 0.002642] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609aeabed0
[ 0.002645] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b2ee296/0x2210000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.002647] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b2ee296/0x2210000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.002650] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b2ee296
[ 0.002763] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002767] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002769] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.002770] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002772] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002774] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002776] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002778] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002779] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.002781] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002783] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002785] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002787] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002788] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002797] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002799] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609b2ee296
[ 0.002802] [0002c794] libusb: debug [process_new_device] found device with address 23 port = 1 parent = 0x103200c20 at 0x103400c7a
[ 0.002832] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b39feb3
[ 0.002847] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609aeabed0
[ 0.002850] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b39feb3/0x2240000 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.002852] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b39feb3/0x2240000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.002855] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b39feb3/0x2240000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.002857] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b39feb3
[ 0.002965] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002969] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002971] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.002973] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002974] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002976] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002978] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002980] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.002982] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.002983] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.002985] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.002987] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.002989] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002990] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002999] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003001] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609b39feb3
[ 0.003004] [0002c794] libusb: debug [process_new_device] found device with address 22 port = 4 parent = 0x103200c20 at 0x103400afa
[ 0.003035] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b40c09f
[ 0.003048] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609b0f574f
[ 0.003050] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b40c09f/0x2610000 against cached device with sessionID/locationID 0x609b39feb3/0x2240000
[ 0.003052] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b40c09f/0x2610000 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.003055] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b40c09f/0x2610000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.003057] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b40c09f/0x2610000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.003059] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b40c09f
[ 0.003169] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003172] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003174] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003175] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003177] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003179] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003181] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003183] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003184] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003186] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003188] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003190] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003191] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003193] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003201] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003203] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609b40c09f
[ 0.003206] [0002c794] libusb: debug [process_new_device] found device with address 21 port = 1 parent = 0x103200aa0 at 0x10340097a
[ 0.003236] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b565c38
[ 0.003248] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609b40c09f
[ 0.003250] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b565c38/0x2612000 against cached device with sessionID/locationID 0x609b40c09f/0x2610000
[ 0.003253] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b565c38/0x2612000 against cached device with sessionID/locationID 0x609b39feb3/0x2240000
[ 0.003255] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b565c38/0x2612000 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.003257] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b565c38/0x2612000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.003260] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b565c38/0x2612000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.003294] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b565c38
[ 0.003476] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003481] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003484] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.003486] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.003487] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003489] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.003491] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003493] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.003495] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.003496] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.003498] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.003500] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.003502] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.003504] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003516] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003519] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609b565c38
[ 0.003523] [0002c794] libusb: debug [process_new_device] found device with address 29 port = 2 parent = 0x103200620 at 0x1034007fa
[ 0.003565] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609b9989be
[ 0.003579] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609b39feb3
[ 0.003582] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b9989be/0x2245000 against cached device with sessionID/locationID 0x609b565c38/0x2612000
[ 0.003585] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b9989be/0x2245000 against cached device with sessionID/locationID 0x609b40c09f/0x2610000
[ 0.003588] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b9989be/0x2245000 against cached device with sessionID/locationID 0x609b39feb3/0x2240000
[ 0.003590] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b9989be/0x2245000 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.003592] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b9989be/0x2245000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.003595] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609b9989be/0x2245000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.003597] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609b9989be
[ 0.003734] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003738] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003740] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.003742] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003744] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003745] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003747] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003749] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.003751] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.003752] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.003754] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.003756] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.003758] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003760] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003769] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003772] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609b9989be
[ 0.003775] [0002c794] libusb: debug [process_new_device] found device with address 26 port = 5 parent = 0x1032007a0 at 0x10340067a
[ 0.003811] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609baca833
[ 0.003825] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609b39feb3
[ 0.003827] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609b9989be/0x2245000
[ 0.003830] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609b565c38/0x2612000
[ 0.003832] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609b40c09f/0x2610000
[ 0.003835] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609b39feb3/0x2240000
[ 0.003837] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.003874] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.003877] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609baca833/0x2246000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.003880] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609baca833
[ 0.004002] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004005] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004007] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004009] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004011] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004013] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004015] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004016] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x046d
[ 0.004018] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0xc52b
[ 0.004020] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x2410
[ 0.004022] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004024] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004025] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004027] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004036] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004038] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609baca833
[ 0.004041] [0002c794] libusb: debug [process_new_device] found device with address 28 port = 6 parent = 0x1032007a0 at 0x1034004fa
[ 0.004084] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609bbbde98
[ 0.004098] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609b39feb3
[ 0.004100] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609baca833/0x2246000
[ 0.004102] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609b9989be/0x2245000
[ 0.004105] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609b565c38/0x2612000
[ 0.004107] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609b40c09f/0x2610000
[ 0.004109] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609b39feb3/0x2240000
[ 0.004112] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.004114] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.004126] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bbbde98/0x2244000 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.004130] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609bbbde98
[ 0.004254] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004258] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004260] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.004262] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x02
[ 0.004264] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004265] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004267] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004269] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x2341
[ 0.004271] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0058
[ 0.004273] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.004275] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004276] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004278] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x03
[ 0.004280] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004289] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004292] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609bbbde98
[ 0.004295] [0002c794] libusb: debug [process_new_device] found device with address 27 port = 4 parent = 0x1032007a0 at 0x10340037a
[ 0.004334] [0002c794] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x609bfcef88
[ 0.004349] [0002c794] libusb: debug [darwin_get_cached_device] parent sessionID: 0x609b9989be
[ 0.004351] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609bbbde98/0x2244000
[ 0.004354] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609baca833/0x2246000
[ 0.004357] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609b9989be/0x2245000
[ 0.004359] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609b565c38/0x2612000
[ 0.004362] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609b40c09f/0x2610000
[ 0.004364] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609b39feb3/0x2240000
[ 0.004366] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609b2ee296/0x2210000
[ 0.004369] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609b0f574f/0x2600000
[ 0.004371] [0002c794] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x609bfcef88/0x2245600 against cached device with sessionID/locationID 0x609aeabed0/0x2200000
[ 0.004373] [0002c794] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x609bfcef88
[ 0.004482] [0002c794] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004486] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004488] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.004490] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004492] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004494] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004495] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004497] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.004499] [0002c794] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.004501] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.004503] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004504] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004506] [0002c794] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004508] [0002c794] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004518] [0002c794] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004520] [0002c794] libusb: debug [process_new_device] allocating new device in context 0x100103c00 for with session 0x609bfcef88
[ 0.004523] [0002c794] libusb: debug [process_new_device] found device with address 24 port = 6 parent = 0x1032002a0 at 0x1034001fa
[ 0.004531] [0002c794] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x102f07110 with handle 1
[ 0.004534] [0002c794] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x102f070d0 with handle 2
[ 0.004536] [0002c794] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.004539] [0002c794] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.004541] [0002c794] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.004545] [0002c794] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.481334] [0002c796] libusb: debug [darwin_devices_detached] notifying context 0x100103c00 of device disconnect
[ 4.481438] [0002c794] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.481463] [0002c794] libusb: debug [handle_event_trigger] event triggered
[ 4.481479] [0002c794] libusb: debug [handle_event_trigger] hotplug message received
[ 4.481495] [0002c794] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 4.481558] [0002c794] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 4.481571] [0002c794] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 4.481585] [0002c794] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.483256] [0002c796] libusb: debug [darwin_devices_detached] notifying context 0x100103c00 of device disconnect
[ 4.483327] [0002c794] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.483348] [0002c794] libusb: debug [handle_event_trigger] event triggered
[ 4.483359] [0002c794] libusb: debug [handle_event_trigger] hotplug message received
[ 4.483373] [0002c794] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 4.483396] [0002c794] libusb: debug [libusb_exit] destroying default context
[ 4.483418] [0002c794] libusb: debug [libusb_unref_device] destroy device 2.24
[ 4.483434] [0002c794] libusb: debug [libusb_unref_device] destroy device 2.27
[ 4.483444] [0002c794] libusb: debug [libusb_unref_device] destroy device 2.28
[ 4.483456] [0002c794] libusb: debug [libusb_unref_device] destroy device 2.26
AddressSanitizer:DEADLYSIGNAL
=================================================================
==33917==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0001005bdc60 bp 0x00016fd52ff0 sp 0x00016fd52f50 T0)
==33917==The signal is caused by a WRITE memory access.
==33917==Hint: address points to the zero page.
    #0 0x1005bdc60 in list_del libusbi.h:222
    #1 0x1005bdafc in usbi_hotplug_exit hotplug.c:209
    #2 0x1005b1dd4 in libusb_exit core.c:2611
    #3 0x1000aef24 in main hotplugtest.c:144
    #4 0x1820210dc  (<unknown module>)

==33917==Register values:
 x[0] = 0x0000000103200640   x[1] = 0x00000001009d40e0   x[2] = 0x000000016fd526e0   x[3] = 0x00000000000003fa  
 x[4] = 0x0000000000000060   x[5] = 0x0000000000000001   x[6] = 0x000000016f558000   x[7] = 0x0000000000000001  
 x[8] = 0x0000007000020000   x[9] = 0x0000000000000000  x[10] = 0x0000000000000000  x[11] = 0x000000700001ffff  
x[12] = 0x000000016fd52720  x[13] = 0x27c12c66bdba5072  x[14] = 0x0000000000000000  x[15] = 0x0000000000000000  
x[16] = 0x000000018239ceac  x[17] = 0x0000000100aec728  x[18] = 0x0000000000000000  x[19] = 0x000000016fd532c0  
x[20] = 0x00000001000ae9c0  x[21] = 0x000000016fd53410  x[22] = 0x00000001004c1910  x[23] = 0x000000016fd53490  
x[24] = 0x000000016fd534d0  x[25] = 0x00000001820a062b  x[26] = 0x0000000000000000  x[27] = 0x0000000000000000  
x[28] = 0x0000000000000000     fp = 0x000000016fd52ff0     lr = 0x00000001005bdb00     sp = 0x000000016fd52f50  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV libusbi.h:222 in list_del
==33917==ABORTING
zsh: abort      ./examples/hotplugtest
mcuee@mcuees-Mac-mini arm64_debug % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000109] [0002c88c] libusb: debug [libusb_init_context] created default context
[ 0.000118] [0002c88c] libusb: debug [libusb_init_context] libusb v1.0.27.11882
[ 0.000129] [0002c88c] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000235] [0002c88d] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000392] [0002c88d] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000431] [0002c88c] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103701c90 with handle 1
[ 0.000437] [0002c88c] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103701c50 with handle 2
[ 0.000440] [0002c88c] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.000442] [0002c88c] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.000444] [0002c88c] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.000448] [0002c88c] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.696588] [0002c88d] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x64ed34abcd
[ 4.696720] [0002c88d] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x64ed34abcd
[ 4.714016] [0002c88d] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 4.714066] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 4.714075] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 4.714082] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 4.714088] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 4.714094] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 4.714102] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 4.714107] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 4.714113] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 4.714119] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 4.714124] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 4.714240] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 4.714248] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 4.714255] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 4.716703] [0002c88d] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 4.716740] [0002c88d] libusb: debug [process_new_device] allocating new device in context 0x100903c00 for with session 0x64ed34abcd
[ 4.716766] [0002c88d] libusb: debug [process_new_device] found device with address 20 port = 6 parent = 0x0 at 0x103c046fa
[ 4.716936] [0002c88d] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x64ed36216b
[ 4.716993] [0002c88c] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.717007] [0002c88d] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x64ed36216b/0x2200000 against cached device with sessionID/locationID 0x64ed34abcd/0x2600000
[ 4.717011] [0002c88c] libusb: debug [handle_event_trigger] event triggered
[ 4.717025] [0002c88d] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x64ed36216b
[ 4.717031] [0002c88c] libusb: debug [handle_event_trigger] hotplug message received
[ 4.717052] [0002c88c] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:0411
[ 4.717099] [0002c88c] libusb: debug [libusb_open] open 2.20
[ 4.717386] [0002c88c] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 4.717480] [0002c88c] libusb: debug [darwin_open] device open for access
[ 4.717501] [0002c88c] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 4.717513] [0002c88c] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 4.717523] [0002c88c] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.719181] [0002c88d] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 4.719208] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 4.719214] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 4.719219] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 4.719224] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 4.719228] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 4.719232] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 4.719237] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 4.719241] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 4.719245] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 4.719250] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 4.719254] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 4.719258] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 4.719263] [0002c88d] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 4.719524] [0002c88d] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 4.719538] [0002c88d] libusb: debug [process_new_device] allocating new device in context 0x100903c00 for with session 0x64ed36216b
[ 4.719552] [0002c88d] libusb: debug [process_new_device] found device with address 25 port = 2 parent = 0x0 at 0x103c0457a
[ 4.719604] [0002c88c] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.719643] [0002c88c] libusb: debug [handle_event_trigger] event triggered
[ 4.719652] [0002c88c] libusb: debug [handle_event_trigger] hotplug message received
[ 4.719662] [0002c88c] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:5411
[ 4.719671] [0002c88c] libusb: debug [libusb_close]  
[ 4.719691] [0002c88c] libusb: debug [libusb_open] open 2.25
[ 4.719779] [0002c88c] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 4.719826] [0002c88c] libusb: debug [darwin_open] device open for access
[ 4.719836] [0002c88c] libusb: debug [libusb_close]  
[ 4.719849] [0002c88c] libusb: debug [libusb_exit] destroying default context
[ 4.719857] [0002c88c] libusb: debug [libusb_unref_device] destroy device 2.25
[ 4.719864] [0002c88c] libusb: debug [libusb_unref_device] destroy device 2.20
[ 4.719897] [0002c88d] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 4.721248] [0002c88c] libusb: debug [usbi_remove_event_source] remove fd 3

@sonatique
Copy link
Contributor

@mcuee could you repeat the experiment with the last instrumented code of e393d8e that I mentioned here: #1406 (comment)

printf are in the common hotplug code that is used by Darwin as well, so it might help understanding.

Thanks.

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

@mcuee could you repeat the experiment with the last instrumented code of e393d8e that I mentioned here: #1406 (comment)

printf are in the common hotplug code that is used by Darwin as well, so it might help understanding.

Thanks.

It does not seem to crash with your debug branch.

There are a few warnings when building under Apple macOS (note: with AScan, CFLAGS="-g -fsanitize=address").

mcuee@mcuees-Mac-mini debug_apple_clang64 % CFLAGS="-g -fsanitize=address" ../configure --enable-tests-build --enable-examples-build 
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... rm: conftest.dSYM: is a directory
yes
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... -std=gnu++11
checking for inline... inline
checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /opt/homebrew/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking dependency style of g++ -std=gnu++11... gcc3
checking build system type... aarch64-apple-darwin23.3.0
checking host system type... aarch64-apple-darwin23.3.0
checking how to print strings... printf
checking for a sed that does not truncate output... /opt/homebrew/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... rm: conftest.dSYM: is a directory
BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin23.3.0 file names to aarch64-apple-darwin23.3.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin23.3.0 file names to toolchain format... func_convert_file_noop
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... rm: conftest.dSYM: is a directory
no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... rm: conftest.dSYM: is a directory
ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... ld: warning: -single_module is obsolete
no
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin23.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for ld used by g++ -std=gnu++11... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking whether the g++ -std=gnu++11 linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking for g++ -std=gnu++11 option to produce PIC... -fno-common -DPIC
checking if g++ -std=gnu++11 PIC flag -fno-common -DPIC works... yes
checking if g++ -std=gnu++11 static flag -static works... no
checking if g++ -std=gnu++11 supports -c -o file.o... yes
checking if g++ -std=gnu++11 supports -c -o file.o... (cached) yes
checking whether the g++ -std=gnu++11 linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin23.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking for windres... no
checking whether make supports nested variables... (cached) yes
checking if gcc supports -std=gnu11... yes
checking operating system... Darwin/Mac OS X
checking for nfds_t... yes
checking for pipe2... no
checking if gcc recognizes -pthread... yes
checking for library containing pthread_create... none required
checking whether __atomic_load_n is supported... yes
checking for pthread_threadid_np... yes
checking for IOKit/usb/IOUSBHostFamilyDefinitions.h... yes
checking for sys/time.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libusb-1.0.pc
config.status: creating Makefile
config.status: creating libusb/Makefile
config.status: creating examples/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating doc/doxygen.cfg
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
mcuee@mcuees-Mac-mini debug_apple_clang64 % make
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in libusb
  CC       core.lo
  CC       descriptor.lo
  CC       hotplug.lo
../../libusb/hotplug.c:181:84: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                                dev->parent_dev, dev->parent_dev->bus_number, dev->parent_dev->device_address, dev->parent_dev->refcnt, dev->parent_dev->parent_dev);
                                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~
../../libusb/hotplug.c:230:47: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                        dev, dev->bus_number, dev->device_address, dev->refcnt, dev->parent_dev);
                                                                   ^~~~~~~~~~~
../../libusb/hotplug.c:241:48: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                                dev, dev->bus_number, dev->device_address, dev->refcnt, dev->parent_dev);
                                                                           ^~~~~~~~~~~
../../libusb/hotplug.c:247:48: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
                                dev, dev->bus_number, dev->device_address, dev->refcnt, dev->parent_dev);
                                                                           ^~~~~~~~~~~
4 warnings generated.
  CC       io.lo
  CC       strerror.lo
  CC       sync.lo
  CC       os/events_posix.lo
  CC       os/threads_posix.lo
  CC       os/darwin_usb.lo
  CCLD     libusb-1.0.la
Making all in examples
  CC       dpfp.o
  CCLD     dpfp
  CC       dpfp_threaded-dpfp.o
  CCLD     dpfp_threaded
  CC       ezusb.o
  CC       fxload.o
  CCLD     fxload
  CC       hotplugtest.o
  CCLD     hotplugtest
  CC       listdevs.o
  CCLD     listdevs
  CC       sam3u_benchmark.o
  CCLD     sam3u_benchmark
  CC       testlibusb.o
  CCLD     testlibusb
  CC       xusb.o
  CCLD     xusb
Making all in tests
  CC       stress.o
  CC       testlib.o
  CCLD     stress
  CC       stress_mt-stress_mt.o
  CCLD     stress_mt
  CC       set_option.o
  CCLD     set_option
  CC       init_context.o
  CCLD     init_context
  CC       macos.o
  CCLD     macos
make[2]: Nothing to be done for `all-am'.

Run log.

  1. Removing the external USB 3.0 hub
mcuee@mcuees-Mac-mini debug_apple_clang64 % ./examples/hotplugtest 
Device detached: 0bda:0411
Device detached: 0bda:0411
device list begin
(0x103d03c20) 2.9 = 1 ; parent=(0x103d002a0)
(0x103d00020) 2.8 = 1 ; parent=(0x103d00420)
(0x103d002a0) 2.7 = 2 ; parent=(0x103d00420)
(0x103d00420) 2.6 = 3 ; parent=(0x103d00c20)
(0x103d005a0) 2.5 = 1 ; parent=(0x103d00c20)
(0x103d00720) 2.4 = 1 ; parent=(0x103d00920)
(0x103d00c20) 2.1 = 3 ; parent=(0x0)
device list end
removed (0x103d03c20) 2.9 = 1 ; parent=(0x103d002a0)
will unref (0x103d03c20) 2.9 = 1 ; parent=(0x103d002a0)
freed: (0x103d03c20)

removed (0x103d00020) 2.8 = 1 ; parent=(0x103d00420)
will unref (0x103d00020) 2.8 = 1 ; parent=(0x103d00420)
freed: (0x103d00020)

removed (0x103d002a0) 2.7 = 1 ; parent=(0x103d00420)
will unref (0x103d002a0) 2.7 = 1 ; parent=(0x103d00420)
freed: (0x103d002a0)

removed (0x103d00420) 2.6 = 1 ; parent=(0x103d00c20)
will unref (0x103d00420) 2.6 = 1 ; parent=(0x103d00c20)
freed: (0x103d00420)

removed (0x103d005a0) 2.5 = 1 ; parent=(0x103d00c20)
will unref (0x103d005a0) 2.5 = 1 ; parent=(0x103d00c20)
freed: (0x103d005a0)

removed (0x103d00720) 2.4 = 1 ; parent=(0x103d00920)
Unexpected dangling list head for parent 2.3
Unexpected dangling list head for parent 2.2
will unref (0x103d00720) 2.4 = 1 ; parent=(0x103d00920)
freed: (0x103d00aa0)
freed: (0x103d00920)
freed: (0x103d00720)

removed (0x103d00c20) 2.1 = 1 ; parent=(0x0)
will unref (0x103d00c20) 2.1 = 1 ; parent=(0x0)
freed: (0x103d00c20)
  1. Inserting the hub
mcuee@mcuees-Mac-mini debug_apple_clang64 % ./examples/hotplugtest
Device attached: 0bda:5411
Device attached: 0bda:0411
device list begin
(0x105a03320) 2.11 = 1 ; parent=(0x0)
(0x105a034a0) 2.10 = 1 ; parent=(0x0)
device list end
removed (0x105a03320) 2.11 = 1 ; parent=(0x0)
will unref (0x105a03320) 2.11 = 1 ; parent=(0x0)
freed: (0x105a03320)

removed (0x105a034a0) 2.10 = 1 ; parent=(0x0)
will unref (0x105a034a0) 2.10 = 1 ; parent=(0x0)
freed: (0x105a034a0)

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

@sonatique

Maybe you find a fix for this issue. Nice.

Your branch does not have the issue mentioned here.
sonatique@e393d8e

Full debug log under macOS 14.3 (Mac Mini M1 2020)

no more crashes under macOS 14.3 when removing the external hub
mcuee@mcuees-Mac-mini debug_apple_clang64 % export LIBUSB_DEBUG=4
mcuee@mcuees-Mac-mini debug_apple_clang64 % ./examples/hotplugtest 
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000164] [00009a22] libusb: debug [libusb_init_context] created default context
[ 0.000170] [00009a22] libusb: debug [libusb_init_context] libusb v1.0.27.11878-rc2
[ 0.000180] [00009a22] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000609] [00009a24] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000802] [00009a24] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.001129] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28cd46b0f
[ 0.001150] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28cd46b0f
[ 0.002692] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002697] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002700] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.002702] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002703] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002705] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002706] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002708] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002709] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.002711] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002713] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002724] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002728] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002729] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002746] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002750] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28cd46b0f
[ 0.002755] [00009a22] libusb: debug [process_new_device] found device with address 10 port = 2 parent = 0x0 at 0x103600eba
[ 0.002830] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28cda3d34
[ 0.002847] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28cda3d34/0x2600000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.002850] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28cda3d34
[ 0.003072] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003077] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003078] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003080] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003082] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003083] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003085] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003086] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003088] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003090] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003091] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003093] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003094] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003096] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003104] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003107] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28cda3d34
[ 0.003110] [00009a22] libusb: debug [process_new_device] found device with address 11 port = 6 parent = 0x0 at 0x103600d3a
[ 0.003175] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28cf9026d
[ 0.003207] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28cda3d34
[ 0.003210] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28cf9026d/0x2610000 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.003213] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28cf9026d/0x2610000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.003215] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28cf9026d
[ 0.003369] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003373] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003374] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003376] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003378] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003379] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003381] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003382] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003384] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003385] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003387] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003388] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003390] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003391] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003399] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003401] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28cf9026d
[ 0.003404] [00009a22] libusb: debug [process_new_device] found device with address 12 port = 1 parent = 0x103400aa0 at 0x103600bba
[ 0.003447] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28d1c725e
[ 0.003462] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28cd46b0f
[ 0.003465] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d1c725e/0x2210000 against cached device with sessionID/locationID 0x28cf9026d/0x2610000
[ 0.003467] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d1c725e/0x2210000 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.003469] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d1c725e/0x2210000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.003471] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28d1c725e
[ 0.003615] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003618] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003620] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.003621] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003623] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003624] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003626] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003628] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003629] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.003631] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003633] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003634] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003636] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003637] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003646] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003648] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28d1c725e
[ 0.003651] [00009a22] libusb: debug [process_new_device] found device with address 13 port = 1 parent = 0x103400c20 at 0x103600a3a
[ 0.003695] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28d285248
[ 0.003705] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28cd46b0f
[ 0.003707] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d285248/0x2240000 against cached device with sessionID/locationID 0x28d1c725e/0x2210000
[ 0.003710] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d285248/0x2240000 against cached device with sessionID/locationID 0x28cf9026d/0x2610000
[ 0.003712] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d285248/0x2240000 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.003714] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d285248/0x2240000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.003717] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28d285248
[ 0.003854] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003857] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003859] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.003861] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003862] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003864] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003866] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003867] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.003869] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.003871] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.003872] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.003874] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.003875] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003877] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003884] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003886] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28d285248
[ 0.003889] [00009a22] libusb: debug [process_new_device] found device with address 14 port = 4 parent = 0x103400c20 at 0x1036008ba
[ 0.004018] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28d2b844a
[ 0.004030] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28cf9026d
[ 0.004032] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d2b844a/0x2612000 against cached device with sessionID/locationID 0x28d285248/0x2240000
[ 0.004034] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d2b844a/0x2612000 against cached device with sessionID/locationID 0x28d1c725e/0x2210000
[ 0.004036] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d2b844a/0x2612000 against cached device with sessionID/locationID 0x28cf9026d/0x2610000
[ 0.004038] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d2b844a/0x2612000 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.004040] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d2b844a/0x2612000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.004043] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28d2b844a
[ 0.004230] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004234] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004235] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.004237] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004238] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004240] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004241] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.004243] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.004245] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.004246] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.004248] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.004249] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.004251] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.004252] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004260] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004262] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28d2b844a
[ 0.004264] [00009a22] libusb: debug [process_new_device] found device with address 15 port = 2 parent = 0x103400920 at 0x10360073a
[ 0.004314] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28d86a877
[ 0.004326] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28d285248
[ 0.004328] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d86a877/0x2245000 against cached device with sessionID/locationID 0x28d2b844a/0x2612000
[ 0.004331] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d86a877/0x2245000 against cached device with sessionID/locationID 0x28d285248/0x2240000
[ 0.004333] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d86a877/0x2245000 against cached device with sessionID/locationID 0x28d1c725e/0x2210000
[ 0.004335] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d86a877/0x2245000 against cached device with sessionID/locationID 0x28cf9026d/0x2610000
[ 0.004337] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d86a877/0x2245000 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.004339] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d86a877/0x2245000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.004341] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28d86a877
[ 0.004478] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004482] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004484] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004486] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004487] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004489] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.004491] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004492] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.004494] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.004495] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.004497] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.004499] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.004500] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004502] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004511] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004513] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28d86a877
[ 0.004516] [00009a22] libusb: debug [process_new_device] found device with address 16 port = 5 parent = 0x103400620 at 0x1036005ba
[ 0.004586] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28d99b45e
[ 0.004611] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28d285248
[ 0.004615] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28d86a877/0x2245000
[ 0.004617] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28d2b844a/0x2612000
[ 0.004619] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28d285248/0x2240000
[ 0.004621] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28d1c725e/0x2210000
[ 0.004623] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28cf9026d/0x2610000
[ 0.004625] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.004627] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28d99b45e/0x2246000 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.004629] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28d99b45e
[ 0.004752] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004756] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004758] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004759] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004761] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004763] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004764] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004766] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x046d
[ 0.004768] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0xc52b
[ 0.004769] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x2410
[ 0.004771] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004772] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004774] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004775] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004782] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004784] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28d99b45e
[ 0.004787] [00009a22] libusb: debug [process_new_device] found device with address 17 port = 6 parent = 0x103400620 at 0x10360043a
[ 0.004838] [00009a22] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x28de96bf2
[ 0.004871] [00009a22] libusb: debug [darwin_get_cached_device] parent sessionID: 0x28d86a877
[ 0.004874] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28d99b45e/0x2246000
[ 0.004876] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28d86a877/0x2245000
[ 0.004878] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28d2b844a/0x2612000
[ 0.004881] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28d285248/0x2240000
[ 0.004883] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28d1c725e/0x2210000
[ 0.004885] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28cf9026d/0x2610000
[ 0.004887] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28cda3d34/0x2600000
[ 0.004889] [00009a22] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x28de96bf2/0x2245600 against cached device with sessionID/locationID 0x28cd46b0f/0x2200000
[ 0.004891] [00009a22] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x28de96bf2
[ 0.005004] [00009a22] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.005007] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.005009] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.005010] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.005012] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.005014] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.005015] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.005017] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.005019] [00009a22] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.005020] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.005022] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.005024] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.005025] [00009a22] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.005027] [00009a22] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.005034] [00009a22] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.005036] [00009a22] libusb: debug [process_new_device] allocating new device in context 0x100403c00 for with session 0x28de96bf2
[ 0.005038] [00009a22] libusb: debug [process_new_device] found device with address 18 port = 6 parent = 0x1034002a0 at 0x1036002ba
[ 0.005045] [00009a22] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103107850 with handle 1
[ 0.005048] [00009a22] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x103107810 with handle 2
[ 0.005050] [00009a22] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.005052] [00009a22] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.005054] [00009a22] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.005058] [00009a22] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.130226] [00009a24] libusb: debug [darwin_devices_detached] notifying context 0x100403c00 of device disconnect
[ 4.130327] [00009a22] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.130345] [00009a22] libusb: debug [handle_event_trigger] event triggered
[ 4.130356] [00009a22] libusb: debug [handle_event_trigger] hotplug message received
[ 4.130372] [00009a22] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 4.130458] [00009a22] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 4.130475] [00009a22] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 4.130488] [00009a22] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.131815] [00009a24] libusb: debug [darwin_devices_detached] notifying context 0x100403c00 of device disconnect
[ 4.131897] [00009a22] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.131914] [00009a22] libusb: debug [handle_event_trigger] event triggered
[ 4.131924] [00009a22] libusb: debug [handle_event_trigger] hotplug message received
[ 4.131937] [00009a22] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 4.132031] [00009a22] libusb: debug [libusb_exit] destroying default context
device list begin
(0x103403c20) 2.18 = 1 ; parent=(0x1034002a0)
(0x103400020) 2.17 = 1 ; parent=(0x103400620)
(0x1034002a0) 2.16 = 2 ; parent=(0x103400620)
(0x103400420) 2.15 = 1 ; parent=(0x103400920)
(0x103400620) 2.14 = 3 ; parent=(0x103400c20)
(0x1034007a0) 2.13 = 1 ; parent=(0x103400c20)
(0x103400c20) 2.10 = 3 ; parent=(0x0)
device list end
removed (0x103403c20) 2.18 = 1 ; parent=(0x1034002a0)
will unref (0x103403c20) 2.18 = 1 ; parent=(0x1034002a0)
[ 4.132162] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.18
freed: (0x103403c20)

removed (0x103400020) 2.17 = 1 ; parent=(0x103400620)
will unref (0x103400020) 2.17 = 1 ; parent=(0x103400620)
[ 4.132196] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.17
freed: (0x103400020)

removed (0x1034002a0) 2.16 = 1 ; parent=(0x103400620)
will unref (0x1034002a0) 2.16 = 1 ; parent=(0x103400620)
[ 4.132224] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.16
freed: (0x1034002a0)

removed (0x103400420) 2.15 = 1 ; parent=(0x103400920)
Unexpected dangling list head for parent 2.12
Unexpected dangling list head for parent 2.11
will unref (0x103400420) 2.15 = 1 ; parent=(0x103400920)
[ 4.132352] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.15
[ 4.132362] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.12
[ 4.132370] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.11
freed: (0x103400aa0)
freed: (0x103400920)
freed: (0x103400420)

removed (0x103400620) 2.14 = 1 ; parent=(0x103400c20)
will unref (0x103400620) 2.14 = 1 ; parent=(0x103400c20)
[ 4.134782] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.14
freed: (0x103400620)

removed (0x1034007a0) 2.13 = 1 ; parent=(0x103400c20)
will unref (0x1034007a0) 2.13 = 1 ; parent=(0x103400c20)
[ 4.134815] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.13
freed: (0x1034007a0)

removed (0x103400c20) 2.10 = 1 ; parent=(0x0)
will unref (0x103400c20) 2.10 = 1 ; parent=(0x0)
[ 4.134843] [00009a22] libusb: debug [libusb_unref_device] destroy device 2.10
freed: (0x103400c20)

[ 4.134922] [00009a24] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 4.142608] [00009a22] libusb: debug [usbi_remove_event_source] remove fd 3

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

More tests with four layer of USB hubs (total 15 USB devices).

Mac Mini M1 --> Ugreen USB Type-C hub --> 7 ports powered USB 3.0 hub --> 13 ports powered USB 2.0 hub --> Ugreen 2.0 USB hub with 100Mbps Ethernet port.

mcuee@mcuees-Mac-mini debug_apple_clang64 % git diff
diff --git a/examples/hotplugtest.c b/examples/hotplugtest.c
index c3426650..fdbedad0 100644
--- a/examples/hotplugtest.c
+++ b/examples/hotplugtest.c
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       while (done < 2) {
+       while (done < 15) {
                rc = libusb_handle_events (NULL);
                if (LIBUSB_SUCCESS != rc)
                        printf ("libusb_handle_events() failed: %s\n",

mcuee@mcuees-Mac-mini debug_apple_clang64 % sudo ./examples/hotplugtest
Device attached: 05e3:0612
Device attached: 05e3:0610
Device attached: 0bda:0411
Device attached: 0bda:0411
Device attached: 05e3:0749
Device attached: 03eb:2104
Device attached: 0bda:5411
Device attached: 0bda:5411
Device attached: 1a40:0201
Device attached: 05e3:0608
Device attached: 046d:c52b
Device attached: 1a40:0201
Device attached: 0b95:772b
Device attached: 16c0:05dc
Device attached: 1915:1025
device list begin
(0x103f056a0) 0.15 = 1 ; parent=(0x103f05ca0)
(0x103f058a0) 0.14 = 1 ; parent=(0x103f022a0)
(0x103f05aa0) 0.13 = 1 ; parent=(0x103f022a0)
(0x103f05ca0) 0.12 = 2 ; parent=(0x103f02420)
(0x103f02020) 0.11 = 1 ; parent=(0x103f02420)
(0x103f022a0) 0.10 = 3 ; parent=(0x103f02420)
(0x103f02420) 0.9 = 4 ; parent=(0x103f02720)
(0x103f025a0) 0.8 = 1 ; parent=(0x103f02720)
(0x103f02720) 0.7 = 3 ; parent=(0x103f02fa0)
(0x103f028a0) 0.6 = 1 ; parent=(0x103f02fa0)
(0x103f02aa0) 0.5 = 1 ; parent=(0x103f02ca0)
(0x103f02ca0) 0.4 = 2 ; parent=(0x103f02e20)
(0x103f02e20) 0.3 = 2 ; parent=(0x103f03120)
(0x103f02fa0) 0.2 = 3 ; parent=(0x0)
(0x103f03120) 0.1 = 2 ; parent=(0x0)
device list end
removed (0x103f056a0) 0.15 = 1 ; parent=(0x103f05ca0)
will unref (0x103f056a0) 0.15 = 1 ; parent=(0x103f05ca0)
freed: (0x103f056a0)

removed (0x103f058a0) 0.14 = 1 ; parent=(0x103f022a0)
will unref (0x103f058a0) 0.14 = 1 ; parent=(0x103f022a0)
freed: (0x103f058a0)

removed (0x103f05aa0) 0.13 = 1 ; parent=(0x103f022a0)
will unref (0x103f05aa0) 0.13 = 1 ; parent=(0x103f022a0)
freed: (0x103f05aa0)

removed (0x103f05ca0) 0.12 = 1 ; parent=(0x103f02420)
will unref (0x103f05ca0) 0.12 = 1 ; parent=(0x103f02420)
freed: (0x103f05ca0)

removed (0x103f02020) 0.11 = 1 ; parent=(0x103f02420)
will unref (0x103f02020) 0.11 = 1 ; parent=(0x103f02420)
freed: (0x103f02020)

removed (0x103f022a0) 0.10 = 1 ; parent=(0x103f02420)
will unref (0x103f022a0) 0.10 = 1 ; parent=(0x103f02420)
freed: (0x103f022a0)

removed (0x103f02420) 0.9 = 1 ; parent=(0x103f02720)
will unref (0x103f02420) 0.9 = 1 ; parent=(0x103f02720)
freed: (0x103f02420)

removed (0x103f025a0) 0.8 = 1 ; parent=(0x103f02720)
will unref (0x103f025a0) 0.8 = 1 ; parent=(0x103f02720)
freed: (0x103f025a0)

removed (0x103f02720) 0.7 = 1 ; parent=(0x103f02fa0)
will unref (0x103f02720) 0.7 = 1 ; parent=(0x103f02fa0)
freed: (0x103f02720)

removed (0x103f028a0) 0.6 = 1 ; parent=(0x103f02fa0)
will unref (0x103f028a0) 0.6 = 1 ; parent=(0x103f02fa0)
freed: (0x103f028a0)

removed (0x103f02aa0) 0.5 = 1 ; parent=(0x103f02ca0)
will unref (0x103f02aa0) 0.5 = 1 ; parent=(0x103f02ca0)
freed: (0x103f02aa0)

removed (0x103f02ca0) 0.4 = 1 ; parent=(0x103f02e20)
will unref (0x103f02ca0) 0.4 = 1 ; parent=(0x103f02e20)
freed: (0x103f02ca0)

removed (0x103f02e20) 0.3 = 1 ; parent=(0x103f03120)
will unref (0x103f02e20) 0.3 = 1 ; parent=(0x103f03120)
freed: (0x103f02e20)

removed (0x103f02fa0) 0.2 = 1 ; parent=(0x0)
will unref (0x103f02fa0) 0.2 = 1 ; parent=(0x0)
freed: (0x103f02fa0)

removed (0x103f03120) 0.1 = 1 ; parent=(0x0)
will unref (0x103f03120) 0.1 = 1 ; parent=(0x0)
freed: (0x103f03120)

mcuee@mcuees-Mac-mini debug_apple_clang64 % sudo ./examples/hotplugtest
Device detached: 05e3:0610
Device detached: 03eb:2104
freed: (0x1074004a0)
Device detached: 0bda:5411
Device detached: 0bda:5411
freed: (0x1074001a0)
Device detached: 1a40:0201
Device detached: 05e3:0608
Device detached: 1a40:0201
Device detached: 05e3:0612
Device detached: 046d:c52b
freed: (0x107403a20)
Device detached: 0bda:0411
Device detached: 0bda:0411
Device detached: 05e3:0749
freed: (0x107400d20)
freed: (0x107400a20)
freed: (0x1074008a0)
freed: (0x1074006a0)
Device detached: 0b95:772b
freed: (0x1074036a0)
Device detached: 16c0:05dc
freed: (0x107403ca0)
freed: (0x1074034a0)
Device detached: 1915:1025
freed: (0x107400ba0)
freed: (0x107400320)
freed: (0x107400020)
freed: (0x1074038a0)
freed: (0x1074032a0)
device list begin
device list end
mcuee@mcuees-Mac-mini debug_apple_clang64 % sudo ./examples/listdevs   
1915:1025 (bus 1, device 15) path: 1.3.4.5.6
16c0:05dc (bus 1, device 14) path: 1.3.4.4.3
0b95:772b (bus 1, device 13) path: 1.3.4.4.1
046d:c52b (bus 1, device 12) path: 1.3.4.6
1a40:0201 (bus 1, device 11) path: 1.3.4.5
05e3:0608 (bus 1, device 10) path: 1.3.4.4
1a40:0201 (bus 1, device 9) path: 1.3.4
0bda:5411 (bus 1, device 8) path: 1.3.1
0bda:5411 (bus 1, device 7) path: 1.3
03eb:2104 (bus 1, device 6) path: 1.1
05e3:0749 (bus 1, device 5) path: 2.3.1.2
0bda:0411 (bus 1, device 4) path: 2.3.1
0bda:0411 (bus 1, device 3) path: 2.3
05e3:0610 (bus 1, device 2) path: 1
05e3:0612 (bus 1, device 1) path: 2
device list begin
(0x105b032a0) 1.15 = 1 ; parent=(0x105b03b20)
(0x105b034a0) 1.14 = 1 ; parent=(0x105b03ca0)
(0x105b036a0) 1.13 = 1 ; parent=(0x105b03ca0)
(0x105b038a0) 1.12 = 1 ; parent=(0x105b00020)
(0x105b03b20) 1.11 = 2 ; parent=(0x105b00020)
(0x105b03ca0) 1.10 = 3 ; parent=(0x105b00020)
(0x105b00020) 1.9 = 4 ; parent=(0x105b00320)
(0x105b001a0) 1.8 = 1 ; parent=(0x105b00320)
(0x105b00320) 1.7 = 3 ; parent=(0x105b00ba0)
(0x105b004a0) 1.6 = 1 ; parent=(0x105b00ba0)
(0x105b006a0) 1.5 = 1 ; parent=(0x105b008a0)
(0x105b008a0) 1.4 = 2 ; parent=(0x105b00a20)
(0x105b00a20) 1.3 = 2 ; parent=(0x105b00d20)
(0x105b00ba0) 1.2 = 3 ; parent=(0x0)
(0x105b00d20) 1.1 = 2 ; parent=(0x0)
device list end
removed (0x105b032a0) 1.15 = 1 ; parent=(0x105b03b20)
will unref (0x105b032a0) 1.15 = 1 ; parent=(0x105b03b20)
freed: (0x105b032a0)

removed (0x105b034a0) 1.14 = 1 ; parent=(0x105b03ca0)
will unref (0x105b034a0) 1.14 = 1 ; parent=(0x105b03ca0)
freed: (0x105b034a0)

removed (0x105b036a0) 1.13 = 1 ; parent=(0x105b03ca0)
will unref (0x105b036a0) 1.13 = 1 ; parent=(0x105b03ca0)
freed: (0x105b036a0)

removed (0x105b038a0) 1.12 = 1 ; parent=(0x105b00020)
will unref (0x105b038a0) 1.12 = 1 ; parent=(0x105b00020)
freed: (0x105b038a0)

removed (0x105b03b20) 1.11 = 1 ; parent=(0x105b00020)
will unref (0x105b03b20) 1.11 = 1 ; parent=(0x105b00020)
freed: (0x105b03b20)

removed (0x105b03ca0) 1.10 = 1 ; parent=(0x105b00020)
will unref (0x105b03ca0) 1.10 = 1 ; parent=(0x105b00020)
freed: (0x105b03ca0)

removed (0x105b00020) 1.9 = 1 ; parent=(0x105b00320)
will unref (0x105b00020) 1.9 = 1 ; parent=(0x105b00320)
freed: (0x105b00020)

removed (0x105b001a0) 1.8 = 1 ; parent=(0x105b00320)
will unref (0x105b001a0) 1.8 = 1 ; parent=(0x105b00320)
freed: (0x105b001a0)

removed (0x105b00320) 1.7 = 1 ; parent=(0x105b00ba0)
will unref (0x105b00320) 1.7 = 1 ; parent=(0x105b00ba0)
freed: (0x105b00320)

removed (0x105b004a0) 1.6 = 1 ; parent=(0x105b00ba0)
will unref (0x105b004a0) 1.6 = 1 ; parent=(0x105b00ba0)
freed: (0x105b004a0)

removed (0x105b006a0) 1.5 = 1 ; parent=(0x105b008a0)
will unref (0x105b006a0) 1.5 = 1 ; parent=(0x105b008a0)
freed: (0x105b006a0)

removed (0x105b008a0) 1.4 = 1 ; parent=(0x105b00a20)
will unref (0x105b008a0) 1.4 = 1 ; parent=(0x105b00a20)
freed: (0x105b008a0)

removed (0x105b00a20) 1.3 = 1 ; parent=(0x105b00d20)
will unref (0x105b00a20) 1.3 = 1 ; parent=(0x105b00d20)
freed: (0x105b00a20)

removed (0x105b00ba0) 1.2 = 1 ; parent=(0x0)
will unref (0x105b00ba0) 1.2 = 1 ; parent=(0x0)
freed: (0x105b00ba0)

removed (0x105b00d20) 1.1 = 1 ; parent=(0x0)
will unref (0x105b00d20) 1.1 = 1 ; parent=(0x0)
freed: (0x105b00d20)

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

The above log is with AScan. The following is with TScan, CFLAGS="-g -fsanitize=thread".

cuee@mcuees-Mac-mini debug_tscan % sudo ./examples/listdevs
Password:
listdevs(6211,0x1db1e1c40) malloc: nano zone abandoned due to inability to reserve vm space.
1915:1025 (bus 1, device 15) path: 1.3.4.5.6
16c0:05dc (bus 1, device 14) path: 1.3.4.4.3
0b95:772b (bus 1, device 13) path: 1.3.4.4.1
046d:c52b (bus 1, device 12) path: 1.3.4.6
1a40:0201 (bus 1, device 11) path: 1.3.4.5
05e3:0608 (bus 1, device 10) path: 1.3.4.4
1a40:0201 (bus 1, device 9) path: 1.3.4
0bda:5411 (bus 1, device 8) path: 1.3.1
0bda:5411 (bus 1, device 7) path: 1.3
03eb:2104 (bus 1, device 6) path: 1.1
05e3:0749 (bus 1, device 5) path: 2.3.1.2
0bda:0411 (bus 1, device 4) path: 2.3.1
0bda:0411 (bus 1, device 3) path: 2.3
05e3:0610 (bus 1, device 2) path: 1
05e3:0612 (bus 1, device 1) path: 2
device list begin
(0x106e00d80) 1.15 = 1 ; parent=(0x106e00f60)
(0x106e00de0) 1.14 = 1 ; parent=(0x106e00fc0)
(0x106e00e40) 1.13 = 1 ; parent=(0x106e00fc0)
(0x106e00f00) 1.12 = 1 ; parent=(0x106e01020)
(0x106e00f60) 1.11 = 2 ; parent=(0x106e01020)
(0x106e00fc0) 1.10 = 3 ; parent=(0x106e01020)
(0x106e01020) 1.9 = 4 ; parent=(0x106e010e0)
(0x106e01080) 1.8 = 1 ; parent=(0x106e010e0)
(0x106e010e0) 1.7 = 3 ; parent=(0x106e01320)
(0x106e01140) 1.6 = 1 ; parent=(0x106e01320)
(0x106e011a0) 1.5 = 1 ; parent=(0x106e01200)
(0x106e01200) 1.4 = 2 ; parent=(0x106e01260)
(0x106e01260) 1.3 = 2 ; parent=(0x106e012c0)
(0x106e01320) 1.2 = 3 ; parent=(0x0)
(0x106e012c0) 1.1 = 2 ; parent=(0x0)
device list end
removed (0x106e00d80) 1.15 = 1 ; parent=(0x106e00f60)
will unref (0x106e00d80) 1.15 = 1 ; parent=(0x106e00f60)
freed: (0x106e00d80)

removed (0x106e00de0) 1.14 = 1 ; parent=(0x106e00fc0)
will unref (0x106e00de0) 1.14 = 1 ; parent=(0x106e00fc0)
freed: (0x106e00de0)

removed (0x106e00e40) 1.13 = 1 ; parent=(0x106e00fc0)
will unref (0x106e00e40) 1.13 = 1 ; parent=(0x106e00fc0)
freed: (0x106e00e40)

removed (0x106e00f00) 1.12 = 1 ; parent=(0x106e01020)
will unref (0x106e00f00) 1.12 = 1 ; parent=(0x106e01020)
freed: (0x106e00f00)

removed (0x106e00f60) 1.11 = 1 ; parent=(0x106e01020)
will unref (0x106e00f60) 1.11 = 1 ; parent=(0x106e01020)
freed: (0x106e00f60)

removed (0x106e00fc0) 1.10 = 1 ; parent=(0x106e01020)
will unref (0x106e00fc0) 1.10 = 1 ; parent=(0x106e01020)
freed: (0x106e00fc0)

removed (0x106e01020) 1.9 = 1 ; parent=(0x106e010e0)
will unref (0x106e01020) 1.9 = 1 ; parent=(0x106e010e0)
freed: (0x106e01020)

removed (0x106e01080) 1.8 = 1 ; parent=(0x106e010e0)
will unref (0x106e01080) 1.8 = 1 ; parent=(0x106e010e0)
freed: (0x106e01080)

removed (0x106e010e0) 1.7 = 1 ; parent=(0x106e01320)
will unref (0x106e010e0) 1.7 = 1 ; parent=(0x106e01320)
freed: (0x106e010e0)

removed (0x106e01140) 1.6 = 1 ; parent=(0x106e01320)
will unref (0x106e01140) 1.6 = 1 ; parent=(0x106e01320)
freed: (0x106e01140)

removed (0x106e011a0) 1.5 = 1 ; parent=(0x106e01200)
will unref (0x106e011a0) 1.5 = 1 ; parent=(0x106e01200)
freed: (0x106e011a0)

removed (0x106e01200) 1.4 = 1 ; parent=(0x106e01260)
will unref (0x106e01200) 1.4 = 1 ; parent=(0x106e01260)
freed: (0x106e01200)

removed (0x106e01260) 1.3 = 1 ; parent=(0x106e012c0)
will unref (0x106e01260) 1.3 = 1 ; parent=(0x106e012c0)
freed: (0x106e01260)

removed (0x106e01320) 1.2 = 1 ; parent=(0x0)
will unref (0x106e01320) 1.2 = 1 ; parent=(0x0)
freed: (0x106e01320)

removed (0x106e012c0) 1.1 = 1 ; parent=(0x0)
will unref (0x106e012c0) 1.1 = 1 ; parent=(0x0)
freed: (0x106e012c0)

mcuee@mcuees-Mac-mini debug_tscan % sudo ./examples/hotplugtest
hotplugtest(6229,0x1db1e1c40) malloc: nano zone abandoned due to inability to reserve vm space.
Device detached: 05e3:0610
Device detached: 03eb:2104
freed: (0x104d01140)
Device detached: 0bda:5411
Device detached: 05e3:0608
Device detached: 0bda:5411
freed: (0x104d01080)
Device detached: 1a40:0201
Device detached: 1915:1025
freed: (0x104d00f60)
freed: (0x104d00d80)
Device detached: 1a40:0201
Device detached: 16c0:05dc
freed: (0x104d00de0)
Device detached: 0b95:772b
freed: (0x104d00fc0)
freed: (0x104d00e40)
Device detached: 046d:c52b
freed: (0x104d01320)
freed: (0x104d010e0)
freed: (0x104d01020)
freed: (0x104d00f00)
Device attached: 05e3:0610
Device attached: 03eb:2104
Device attached: 0bda:5411
Device detached: 05e3:0612
device list begin
(0x104d02d60) 1.7 = 1 ; parent=(0x104d02e20)
(0x104d02dc0) 1.6 = 1 ; parent=(0x104d02e20)
(0x104d02e20) 1.2 = 3 ; parent=(0x0)
(0x104d011a0) 1.5 = 1 ; parent=(0x104d01200)
(0x104d01200) 1.4 = 2 ; parent=(0x104d01260)
(0x104d01260) 1.3 = 2 ; parent=(0x104d012c0)
device list end
removed (0x104d02d60) 1.7 = 1 ; parent=(0x104d02e20)
will unref (0x104d02d60) 1.7 = 1 ; parent=(0x104d02e20)
freed: (0x104d02d60)

removed (0x104d02dc0) 1.6 = 1 ; parent=(0x104d02e20)
will unref (0x104d02dc0) 1.6 = 1 ; parent=(0x104d02e20)
freed: (0x104d02dc0)

removed (0x104d02e20) 1.2 = 1 ; parent=(0x0)
will unref (0x104d02e20) 1.2 = 1 ; parent=(0x0)
freed: (0x104d02e20)

removed (0x104d011a0) 1.5 = 1 ; parent=(0x104d01200)
Unexpected dangling list head for parent 1.1
will unref (0x104d011a0) 1.5 = 1 ; parent=(0x104d01200)
freed: (0x104d011a0)

removed (0x104d01200) 1.4 = 1 ; parent=(0x104d01260)
Unexpected dangling list head for parent 1.1
will unref (0x104d01200) 1.4 = 1 ; parent=(0x104d01260)
freed: (0x104d01200)

removed (0x104d01260) 1.3 = 1 ; parent=(0x104d012c0)
Unexpected dangling list head for parent 1.1
will unref (0x104d01260) 1.3 = 1 ; parent=(0x104d012c0)
freed: (0x104d012c0)
freed: (0x104d01260)

mcuee@mcuees-Mac-mini debug_tscan % sudo ./examples/hotplugtest
hotplugtest(6278,0x1db1e1c40) malloc: nano zone abandoned due to inability to reserve vm space.
Device attached: 05e3:0612
Device attached: 05e3:0610
Device attached: 0bda:0411
Device attached: 0bda:0411
Device attached: 05e3:0749
Device attached: 03eb:2104
Device attached: 0bda:5411
Device attached: 0bda:5411
Device attached: 1a40:0201
Device attached: 05e3:0608
Device attached: 046d:c52b
Device attached: 1a40:0201
Device attached: 0b95:772b
Device attached: 16c0:05dc
Device attached: 1915:1025
device list begin
(0x106c025e0) 0.15 = 1 ; parent=(0x106c02700)
(0x106c02640) 0.14 = 1 ; parent=(0x106c02820)
(0x106c026a0) 0.13 = 1 ; parent=(0x106c02820)
(0x106c02700) 0.12 = 2 ; parent=(0x106c02880)
(0x106c027c0) 0.11 = 1 ; parent=(0x106c02880)
(0x106c02820) 0.10 = 3 ; parent=(0x106c02880)
(0x106c02880) 0.9 = 4 ; parent=(0x106c02940)
(0x106c028e0) 0.8 = 1 ; parent=(0x106c02940)
(0x106c02940) 0.7 = 3 ; parent=(0x106c02b80)
(0x106c029a0) 0.6 = 1 ; parent=(0x106c02b80)
(0x106c02a00) 0.5 = 1 ; parent=(0x106c02a60)
(0x106c02a60) 0.4 = 2 ; parent=(0x106c02ac0)
(0x106c02ac0) 0.3 = 2 ; parent=(0x106c02b20)
(0x106c02b80) 0.2 = 3 ; parent=(0x0)
(0x106c02b20) 0.1 = 2 ; parent=(0x0)
device list end
removed (0x106c025e0) 0.15 = 1 ; parent=(0x106c02700)
will unref (0x106c025e0) 0.15 = 1 ; parent=(0x106c02700)
freed: (0x106c025e0)

removed (0x106c02640) 0.14 = 1 ; parent=(0x106c02820)
will unref (0x106c02640) 0.14 = 1 ; parent=(0x106c02820)
freed: (0x106c02640)

removed (0x106c026a0) 0.13 = 1 ; parent=(0x106c02820)
will unref (0x106c026a0) 0.13 = 1 ; parent=(0x106c02820)
freed: (0x106c026a0)

removed (0x106c02700) 0.12 = 1 ; parent=(0x106c02880)
will unref (0x106c02700) 0.12 = 1 ; parent=(0x106c02880)
freed: (0x106c02700)

removed (0x106c027c0) 0.11 = 1 ; parent=(0x106c02880)
will unref (0x106c027c0) 0.11 = 1 ; parent=(0x106c02880)
freed: (0x106c027c0)

removed (0x106c02820) 0.10 = 1 ; parent=(0x106c02880)
will unref (0x106c02820) 0.10 = 1 ; parent=(0x106c02880)
freed: (0x106c02820)

removed (0x106c02880) 0.9 = 1 ; parent=(0x106c02940)
will unref (0x106c02880) 0.9 = 1 ; parent=(0x106c02940)
freed: (0x106c02880)

removed (0x106c028e0) 0.8 = 1 ; parent=(0x106c02940)
will unref (0x106c028e0) 0.8 = 1 ; parent=(0x106c02940)
freed: (0x106c028e0)

removed (0x106c02940) 0.7 = 1 ; parent=(0x106c02b80)
will unref (0x106c02940) 0.7 = 1 ; parent=(0x106c02b80)
freed: (0x106c02940)

removed (0x106c029a0) 0.6 = 1 ; parent=(0x106c02b80)
will unref (0x106c029a0) 0.6 = 1 ; parent=(0x106c02b80)
freed: (0x106c029a0)

removed (0x106c02a00) 0.5 = 1 ; parent=(0x106c02a60)
will unref (0x106c02a00) 0.5 = 1 ; parent=(0x106c02a60)
freed: (0x106c02a00)

removed (0x106c02a60) 0.4 = 1 ; parent=(0x106c02ac0)
will unref (0x106c02a60) 0.4 = 1 ; parent=(0x106c02ac0)
freed: (0x106c02a60)

removed (0x106c02ac0) 0.3 = 1 ; parent=(0x106c02b20)
will unref (0x106c02ac0) 0.3 = 1 ; parent=(0x106c02b20)
freed: (0x106c02ac0)

removed (0x106c02b80) 0.2 = 1 ; parent=(0x0)
will unref (0x106c02b80) 0.2 = 1 ; parent=(0x0)
freed: (0x106c02b80)

removed (0x106c02b20) 0.1 = 1 ; parent=(0x0)
will unref (0x106c02b20) 0.1 = 1 ; parent=(0x0)
freed: (0x106c02b20)

@sonatique
Copy link
Contributor

@mcuee : that is interesting. I pushed a little fix along the way in my debug branch (added the lock to prevent background hot plug thread to concurrently modify device list during exit, previously talked about in windows hotplug branch).

This is probably what helps.

I will look a logs into details later, thanks.

@mcuee
Copy link
Member Author

mcuee commented Feb 4, 2024

@seanm and @tormodvolden

Maybe you are also interested in taking a look at the branch here, since it seems to fix this issue (maybe a surgical fix).

sonatique@e393d8e

@tormodvolden
Copy link
Contributor

@seanm and @tormodvolden

Maybe you are also interested in taking a look at the branch here, since it seems to fix this issue (maybe a surgical fix).

Isn't this what is in PR #1452?

@sonatique
Copy link
Contributor

@tormodvolden : let me explain: What @mcuee is referring to is not yet in #1452 . It happens that I made a special debug commit with lots of printf for debugging the remaining seg fault @mcuee is experiencing with my Windows hotplug implementation.
@mcuee used this commit under MacOS and noticed it fixed a bug. It occurred that I made a commit for doing a "sanity fix" and included it in the branch containing the debug commit, with the aim of validating it later.
I first mentioned the problem related to the fix here: #1406 (comment)
It seems that this was actually a good idea.
I will move the fix to #1452 with some explanations, since it is related to hotplug_exit

@sonatique
Copy link
Contributor

@tormodvolden the fix is now included in #1452

@mcuee
Copy link
Member Author

mcuee commented Feb 5, 2024

@sonatique

Thanks. I will test #1452 this evening or tomorrow.

@mcuee
Copy link
Member Author

mcuee commented Feb 5, 2024

@sonatique

Yes PR #1452 is good to fix the issue.

Mac Mini M1 --> 7 ports powered USB 3.0 hub --> 13 ports powered USB 2.0 hub

Unplug and plug the 7-ports USB 3.0 hub --> no longer crashes.

mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/listdevs 
1915:1025 (bus 2, device 18) path: 2.4.5.6
05e3:0749 (bus 2, device 11) path: 6.1.2
0bda:0411 (bus 2, device 12) path: 6.1
1a40:0201 (bus 2, device 15) path: 2.4.5
046d:c52b (bus 2, device 1) path: 2.4.6
0bda:0411 (bus 2, device 6) path: 6
1a40:0201 (bus 2, device 5) path: 2.4
0bda:5411 (bus 2, device 8) path: 2.1
0bda:5411 (bus 2, device 7) path: 2

mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/hotplugtest 
Device detached: 0bda:5411
Device detached: 0bda:0411
Device detached: 0bda:0411
Device detached: 0bda:5411
Device detached: 05e3:0749
Device detached: 1a40:0201
Device detached: 1a40:0201
Device detached: 1915:1025
Device detached: 046d:c52b

mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/hotplugtest
Device attached: 0bda:0411
Device attached: 0bda:5411
Device attached: 0bda:0411
Device attached: 0bda:5411
Device attached: 1a40:0201
Device attached: 05e3:0749
Device attached: 046d:c52b
Device attached: 1a40:0201
Device attached: 1915:1025

mcuee@mcuees-Mac-mini libusb_pr1452 % git diff
diff --git a/examples/hotplugtest.c b/examples/hotplugtest.c
index c22bf747..88856bc1 100644
--- a/examples/hotplugtest.c
+++ b/examples/hotplugtest.c
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       while (done < 2) {
+       while (done < 9) {
                rc = libusb_handle_events (NULL);
                if (LIBUSB_SUCCESS != rc)
                        printf ("libusb_handle_events() failed: %s\n",

Detailed debug log for unplug and plug.

mcuee@mcuees-Mac-mini libusb_pr1452 % export LIBUSB_DEBUG=4
mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000023] [00008d96] libusb: debug [libusb_init_context] created default context
[ 0.000028] [00008d96] libusb: debug [libusb_init_context] libusb v1.0.27.11882
[ 0.000040] [00008d96] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000116] [00008d97] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000375] [00008d97] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000490] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x6010aa3a7
[ 0.000526] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x6010aa3a7
[ 0.002682] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002688] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002690] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.002692] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002693] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002695] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.002696] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.002698] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002700] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.002702] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002704] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002705] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002707] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002708] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.002725] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.002727] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x6010aa3a7
[ 0.002731] [00008d96] libusb: debug [process_new_device] found device with address 17 port = 6 parent = 0x0 at 0x600000c241ba
[ 0.002781] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x6010ba471
[ 0.002805] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6010ba471/0x2200000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.002808] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x6010ba471
[ 0.002973] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.002977] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.002979] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.002980] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.002982] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.002984] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.002985] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.002987] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.002988] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.002990] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.002992] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.002994] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.002995] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.002996] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003008] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003010] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x6010ba471
[ 0.003012] [00008d96] libusb: debug [process_new_device] found device with address 16 port = 2 parent = 0x0 at 0x600000c243ba
[ 0.003055] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x6012a90ee
[ 0.003071] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x6010aa3a7
[ 0.003073] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6012a90ee/0x2610000 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.003075] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6012a90ee/0x2610000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.003078] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x6012a90ee
[ 0.003229] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003233] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003235] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003237] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003238] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003240] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003241] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003243] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003244] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003246] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003248] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003250] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003251] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003253] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003262] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003264] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x6012a90ee
[ 0.003267] [00008d96] libusb: debug [process_new_device] found device with address 13 port = 1 parent = 0x600000624120 at 0x600000c244ba
[ 0.003310] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x60153294a
[ 0.003325] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x6010ba471
[ 0.003327] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60153294a/0x2210000 against cached device with sessionID/locationID 0x6012a90ee/0x2610000
[ 0.003329] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60153294a/0x2210000 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.003331] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60153294a/0x2210000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.003333] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x60153294a
[ 0.003476] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003480] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003481] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.003483] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003485] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003487] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003488] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003490] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003491] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.003493] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003495] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003496] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003498] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003499] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003509] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003512] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x60153294a
[ 0.003514] [00008d96] libusb: debug [process_new_device] found device with address 14 port = 1 parent = 0x600000624180 at 0x600000c245ba
[ 0.003554] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x6015e8227
[ 0.003569] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x6010ba471
[ 0.003571] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6015e8227/0x2240000 against cached device with sessionID/locationID 0x60153294a/0x2210000
[ 0.003573] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6015e8227/0x2240000 against cached device with sessionID/locationID 0x6012a90ee/0x2610000
[ 0.003574] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6015e8227/0x2240000 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.003577] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6015e8227/0x2240000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.003579] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x6015e8227
[ 0.003712] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003716] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003718] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.003720] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003721] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003723] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003724] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003726] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.003728] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.003729] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.003731] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.003733] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.003734] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003736] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003745] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003748] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x6015e8227
[ 0.003750] [00008d96] libusb: debug [process_new_device] found device with address 10 port = 4 parent = 0x600000624180 at 0x600000c246ba
[ 0.003793] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x60165b21b
[ 0.003808] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x6012a90ee
[ 0.003810] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60165b21b/0x2612000 against cached device with sessionID/locationID 0x6015e8227/0x2240000
[ 0.003812] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60165b21b/0x2612000 against cached device with sessionID/locationID 0x60153294a/0x2210000
[ 0.003814] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60165b21b/0x2612000 against cached device with sessionID/locationID 0x6012a90ee/0x2610000
[ 0.003816] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60165b21b/0x2612000 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.003818] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x60165b21b/0x2612000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.003820] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x60165b21b
[ 0.003972] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003975] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003977] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.003979] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.003980] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003982] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.003983] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003985] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.003986] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.003988] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.003990] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.003991] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.003993] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.003994] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004005] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004007] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x60165b21b
[ 0.004009] [00008d96] libusb: debug [process_new_device] found device with address 24 port = 2 parent = 0x6000006241e0 at 0x600000c247ba
[ 0.004052] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x601c0bd25
[ 0.004069] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x6015e8227
[ 0.004071] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601c0bd25/0x2246000 against cached device with sessionID/locationID 0x60165b21b/0x2612000
[ 0.004073] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601c0bd25/0x2246000 against cached device with sessionID/locationID 0x6015e8227/0x2240000
[ 0.004075] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601c0bd25/0x2246000 against cached device with sessionID/locationID 0x60153294a/0x2210000
[ 0.004077] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601c0bd25/0x2246000 against cached device with sessionID/locationID 0x6012a90ee/0x2610000
[ 0.004079] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601c0bd25/0x2246000 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.004081] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601c0bd25/0x2246000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.004083] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x601c0bd25
[ 0.004221] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004225] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004227] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004228] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004230] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004232] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004233] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004235] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x046d
[ 0.004236] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0xc52b
[ 0.004238] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x2410
[ 0.004240] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004241] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004243] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004244] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004255] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004258] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x601c0bd25
[ 0.004260] [00008d96] libusb: debug [process_new_device] found device with address 21 port = 6 parent = 0x6000006242a0 at 0x600000c248ba
[ 0.004302] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x601cdb175
[ 0.004318] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x6015e8227
[ 0.004320] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x601c0bd25/0x2246000
[ 0.004322] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x60165b21b/0x2612000
[ 0.004324] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x6015e8227/0x2240000
[ 0.004326] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x60153294a/0x2210000
[ 0.004328] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x6012a90ee/0x2610000
[ 0.004330] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.004332] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x601cdb175/0x2245000 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.004334] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x601cdb175
[ 0.004465] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004468] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004470] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.004472] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004474] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004475] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.004477] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004478] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.004480] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.004481] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.004483] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.004485] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.004486] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004488] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004497] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004499] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x601cdb175
[ 0.004501] [00008d96] libusb: debug [process_new_device] found device with address 20 port = 5 parent = 0x6000006242a0 at 0x600000c249ba
[ 0.004542] [00008d96] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x6022d9287
[ 0.004557] [00008d96] libusb: debug [darwin_get_cached_device] parent sessionID: 0x601cdb175
[ 0.004559] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x601cdb175/0x2245000
[ 0.004561] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x601c0bd25/0x2246000
[ 0.004564] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x60165b21b/0x2612000
[ 0.004566] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x6015e8227/0x2240000
[ 0.004567] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x60153294a/0x2210000
[ 0.004569] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x6012a90ee/0x2610000
[ 0.004571] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x6010ba471/0x2200000
[ 0.004574] [00008d96] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x6022d9287/0x2245600 against cached device with sessionID/locationID 0x6010aa3a7/0x2600000
[ 0.004575] [00008d96] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x6022d9287
[ 0.004712] [00008d96] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004716] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004717] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.004719] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004721] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004722] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004724] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.004725] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.004727] [00008d96] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.004729] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.004730] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004732] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004733] [00008d96] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004735] [00008d96] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004744] [00008d96] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004746] [00008d96] libusb: debug [process_new_device] allocating new device in context 0x13d704d50 for with session 0x6022d9287
[ 0.004748] [00008d96] libusb: debug [process_new_device] found device with address 27 port = 6 parent = 0x600000624420 at 0x600000c24aba
[ 0.004755] [00008d96] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600002c245a0 with handle 1
[ 0.004758] [00008d96] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600002c24600 with handle 2
[ 0.004764] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.004767] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.004770] [00008d96] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.004774] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.128690] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.128784] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.128793] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.128801] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.128810] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:5411
[ 3.128871] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.128877] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.128882] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.131606] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.132065] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.132078] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.132082] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.132102] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.132125] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 3.132140] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.132144] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.132150] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.132246] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.132254] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.132259] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.132265] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:5411
[ 3.132275] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.14
[ 3.134155] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.134181] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.134190] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.134578] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.134840] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.135409] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.135427] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.135433] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.135444] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1a40:0201
[ 3.135454] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 0bda:0411
[ 3.135727] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.135737] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.135743] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.137401] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.137469] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.137478] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.137482] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.137489] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 05e3:0749
[ 3.137497] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.24
[ 3.137501] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.13
[ 3.137504] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.17
[ 3.155875] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.155914] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.155921] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.155889] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.155979] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.155987] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.155991] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.156000] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1a40:0201
[ 3.156010] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.156015] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.156020] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.163154] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.165235] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.165290] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.165295] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.165308] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 1915:1025
[ 3.165315] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.27
[ 3.165319] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.20
[ 3.166555] [00008d96] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.166569] [00008d96] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.166574] [00008d96] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.176047] [00008d97] libusb: debug [darwin_devices_detached] notifying context 0x13d704d50 of device disconnect
[ 3.176087] [00008d96] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.176091] [00008d96] libusb: debug [handle_event_trigger] event triggered
[ 3.176094] [00008d96] libusb: debug [handle_event_trigger] hotplug message received
[ 3.176098] [00008d96] libusb: debug [libusb_get_device_descriptor]  
Device detached: 046d:c52b
[ 3.176103] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.21
[ 3.176105] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.10
[ 3.176107] [00008d96] libusb: debug [libusb_unref_device] destroy device 2.16
[ 3.176129] [00008d96] libusb: debug [libusb_exit] destroying default context
[ 3.176144] [00008d97] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 3.176255] [00008d96] libusb: debug [usbi_remove_event_source] remove fd 3
mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/hotplugtest
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000019] [00008e51] libusb: debug [libusb_init_context] created default context
[ 0.000024] [00008e51] libusb: debug [libusb_init_context] libusb v1.0.27.11882
[ 0.000036] [00008e51] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000119] [00008e52] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000300] [00008e52] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000336] [00008e51] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600002cac5d0 with handle 1
[ 0.000340] [00008e51] libusb: debug [libusb_hotplug_register_callback] new hotplug cb 0x600002cac5a0 with handle 2
[ 0.000347] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.000349] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.000352] [00008e51] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.000356] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.653964] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x715e910e7
[ 3.654083] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x715e910e7
[ 3.665364] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 3.665403] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 3.665433] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 3.665439] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 3.665442] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 3.665444] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 3.665447] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 3.665449] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 3.665452] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 3.665454] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 3.665457] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 3.665459] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 3.665462] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 3.665532] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 3.665943] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 3.665955] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x715e910e7
[ 3.665960] [00008e52] libusb: debug [process_new_device] found device with address 26 port = 6 parent = 0x0 at 0x600000cb803a
[ 3.666512] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x715ea9404
[ 3.666543] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.666551] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 3.666554] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 3.666563] [00008e51] libusb: debug [libusb_get_device_descriptor]  
[ 3.666572] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x715ea9404/0x2200000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 3.666582] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x715ea9404
Device attached: 0bda:0411
[ 3.666597] [00008e51] libusb: debug [libusb_open] open 2.26
[ 3.666881] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.666951] [00008e51] libusb: debug [darwin_open] device open for access
[ 3.666958] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.666961] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.666965] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.673486] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 3.673513] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 3.673516] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 3.673518] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 3.673520] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 3.673522] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 3.673524] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 3.673526] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 3.673528] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 3.673530] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 3.673532] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 3.673747] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 3.673751] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 3.673753] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 3.673784] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 3.673787] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x715ea9404
[ 3.673792] [00008e52] libusb: debug [process_new_device] found device with address 25 port = 2 parent = 0x0 at 0x600000ca413a
[ 3.673883] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.673888] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 3.673891] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 3.673897] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:5411
[ 3.673903] [00008e51] libusb: debug [libusb_close]  
[ 3.673918] [00008e51] libusb: debug [libusb_open] open 2.25
[ 3.673990] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.674023] [00008e51] libusb: debug [darwin_open] device open for access
[ 3.674027] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.674031] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.674034] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.735641] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x71608f642
[ 3.735691] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x715e910e7
[ 3.735695] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x71608f642/0x2610000 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 3.735700] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x71608f642/0x2610000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 3.735703] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x71608f642
[ 3.741693] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 3.741741] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 3.741748] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 3.741753] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 3.741758] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 3.741763] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 3.741767] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 3.741772] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 3.741776] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 3.741782] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 3.741787] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 3.741791] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 3.741795] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 3.741799] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 3.742312] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 3.742335] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x71608f642
[ 3.742345] [00008e52] libusb: debug [process_new_device] found device with address 22 port = 1 parent = 0x6000006b8000 at 0x600000ca423a
[ 3.742419] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.742429] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 3.742435] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 3.742446] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:0411
[ 3.742459] [00008e51] libusb: debug [libusb_close]  
[ 3.742487] [00008e51] libusb: debug [libusb_open] open 2.22
[ 3.742648] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.742810] [00008e51] libusb: debug [darwin_open] device open for access
[ 3.742825] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.742831] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.742837] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.781586] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x7161caa7a
[ 3.781653] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x71608f642
[ 3.781659] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7161caa7a/0x2612000 against cached device with sessionID/locationID 0x71608f642/0x2610000
[ 3.781663] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7161caa7a/0x2612000 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 3.781667] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7161caa7a/0x2612000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 3.781671] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x7161caa7a
[ 3.782291] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 3.782300] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 3.782342] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 3.782346] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 3.782349] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 3.782351] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 3.782354] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 3.782356] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 3.782359] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 3.782361] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 3.782364] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 3.782367] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 3.782370] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 3.782372] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 3.926721] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 3.926760] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x7161caa7a
[ 3.926772] [00008e52] libusb: debug [process_new_device] found device with address 23 port = 2 parent = 0x6000006a00c0 at 0x600000ca043a
[ 3.926946] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x7164342de
[ 3.927239] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x715ea9404
[ 3.927271] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7164342de/0x2240000 against cached device with sessionID/locationID 0x7161caa7a/0x2612000
[ 3.927280] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7164342de/0x2240000 against cached device with sessionID/locationID 0x71608f642/0x2610000
[ 3.927287] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7164342de/0x2240000 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 3.927247] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.927308] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 3.927315] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 3.927293] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7164342de/0x2240000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 3.927340] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x7164342de
[ 3.927330] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 05e3:0749
[ 3.927360] [00008e51] libusb: debug [libusb_close]  
[ 3.927626] [00008e51] libusb: debug [libusb_open] open 2.23
[ 3.928925] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.929008] [00008e51] libusb: debug [darwin_open] device open for access
[ 3.929018] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.929024] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.929030] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.929696] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 3.929717] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 3.929723] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 3.929728] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 3.929733] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 3.929740] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 3.929744] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 3.929748] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 3.929753] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 3.929757] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 3.929762] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 3.929766] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 3.929771] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 3.929775] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 3.929811] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 3.929818] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x7164342de
[ 3.929827] [00008e52] libusb: debug [process_new_device] found device with address 32 port = 4 parent = 0x6000006b80c0 at 0x600000cb813a
[ 3.929981] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.929990] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 3.929994] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 3.930002] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 1a40:0201
[ 3.930012] [00008e51] libusb: debug [libusb_close]  
[ 3.930029] [00008e51] libusb: debug [libusb_open] open 2.32
[ 3.930216] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x7163432ae
[ 3.930277] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x715ea9404
[ 3.930286] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7163432ae/0x2210000 against cached device with sessionID/locationID 0x7164342de/0x2240000
[ 3.930293] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7163432ae/0x2210000 against cached device with sessionID/locationID 0x7161caa7a/0x2612000
[ 3.930299] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7163432ae/0x2210000 against cached device with sessionID/locationID 0x71608f642/0x2610000
[ 3.930305] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7163432ae/0x2210000 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 3.930311] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7163432ae/0x2210000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 3.930367] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x7163432ae
[ 3.931041] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.931108] [00008e51] libusb: debug [darwin_open] device open for access
[ 3.931118] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.931123] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.931128] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 3.931619] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 3.931636] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 3.931641] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 3.931646] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 3.931651] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 3.931655] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 3.931659] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 3.931663] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 3.931668] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 3.931673] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 3.931677] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 3.931681] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 3.931685] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 3.931690] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 3.931725] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 3.931733] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x7163432ae
[ 3.931740] [00008e52] libusb: debug [process_new_device] found device with address 19 port = 1 parent = 0x6000006b80c0 at 0x600000ca05ba
[ 3.931916] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 3.931926] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 3.931932] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 3.931940] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 0bda:5411
[ 3.931949] [00008e51] libusb: debug [libusb_close]  
[ 3.931963] [00008e51] libusb: debug [libusb_open] open 2.19
[ 3.932050] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.932119] [00008e51] libusb: debug [darwin_open] device open for access
[ 3.932129] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.932134] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.932139] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.147267] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x716a0d3aa
[ 4.147391] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x7164342de
[ 4.147413] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716a0d3aa/0x2245000 against cached device with sessionID/locationID 0x7163432ae/0x2210000
[ 4.147421] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716a0d3aa/0x2245000 against cached device with sessionID/locationID 0x7164342de/0x2240000
[ 4.147427] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716a0d3aa/0x2245000 against cached device with sessionID/locationID 0x7161caa7a/0x2612000
[ 4.147434] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716a0d3aa/0x2245000 against cached device with sessionID/locationID 0x71608f642/0x2610000
[ 4.147439] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716a0d3aa/0x2245000 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 4.147796] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716a0d3aa/0x2245000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 4.147809] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x716a0d3aa
[ 4.161030] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 4.161059] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 4.161142] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 4.161158] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 4.161165] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 4.161170] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 4.161174] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 4.161179] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 4.161184] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 4.161189] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 4.161270] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 4.161275] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 4.161279] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 4.161284] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 4.161418] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 4.161427] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x716a0d3aa
[ 4.161435] [00008e52] libusb: debug [process_new_device] found device with address 30 port = 5 parent = 0x6000006b4000 at 0x600000ca06ba
[ 4.161490] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.161520] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 4.161526] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 4.161536] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 1a40:0201
[ 4.161575] [00008e51] libusb: debug [libusb_close]  
[ 4.161751] [00008e51] libusb: debug [libusb_open] open 2.30
[ 4.161878] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 4.162072] [00008e51] libusb: debug [darwin_open] device open for access
[ 4.162109] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 4.162116] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 4.162123] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.198847] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x716b3e432
[ 4.198910] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x7164342de
[ 4.198915] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x716a0d3aa/0x2245000
[ 4.198921] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x7163432ae/0x2210000
[ 4.198926] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x7164342de/0x2240000
[ 4.198931] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x7161caa7a/0x2612000
[ 4.198934] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x71608f642/0x2610000
[ 4.199966] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 4.199972] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x716b3e432/0x2246000 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 4.199975] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x716b3e432
[ 4.200320] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 4.200327] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 4.200329] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 4.200332] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 4.200335] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 4.200571] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 4.200574] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 4.200577] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x046d
[ 4.200579] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0xc52b
[ 4.200581] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x2410
[ 4.200583] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 4.200585] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 4.200588] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 4.200589] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 4.270572] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 4.270601] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x716b3e432
[ 4.270608] [00008e52] libusb: debug [process_new_device] found device with address 29 port = 6 parent = 0x6000006b4000 at 0x600000cb823a
[ 4.271108] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.271121] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 4.271124] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 4.271131] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 046d:c52b
[ 4.271137] [00008e51] libusb: debug [libusb_close]  
[ 4.271155] [00008e51] libusb: debug [libusb_open] open 2.29
[ 4.272015] [00008e51] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 4.275512] [00008e51] libusb: debug [darwin_open] device open for access
[ 4.275536] [00008e51] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 4.275540] [00008e51] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 4.275544] [00008e51] libusb: debug [usbi_wait_for_events] poll() 1 fds with timeout in 60000ms
[ 4.432287] [00008e52] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x7170480d3
[ 4.432330] [00008e52] libusb: debug [darwin_get_cached_device] parent sessionID: 0x716a0d3aa
[ 4.432335] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x716b3e432/0x2246000
[ 4.432339] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x716a0d3aa/0x2245000
[ 4.432342] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x7163432ae/0x2210000
[ 4.432345] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x7164342de/0x2240000
[ 4.432348] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x7161caa7a/0x2612000
[ 4.432760] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x71608f642/0x2610000
[ 4.432766] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x715ea9404/0x2200000
[ 4.432768] [00008e52] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x7170480d3/0x2245600 against cached device with sessionID/locationID 0x715e910e7/0x2600000
[ 4.432770] [00008e52] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x7170480d3
[ 4.432948] [00008e52] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 4.432954] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 4.432956] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 4.432957] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 4.432958] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 4.432959] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 4.432960] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 4.432961] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 4.432962] [00008e52] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 4.432964] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 4.432965] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 4.432966] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 4.432967] [00008e52] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 4.432969] [00008e52] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 4.458043] [00008e52] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 4.458050] [00008e52] libusb: debug [process_new_device] allocating new device in context 0x13bf04d90 for with session 0x7170480d3
[ 4.458054] [00008e52] libusb: debug [process_new_device] found device with address 9 port = 6 parent = 0x6000006b4060 at 0x600000cacdba
[ 4.458089] [00008e51] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 4.458095] [00008e51] libusb: debug [handle_event_trigger] event triggered
[ 4.458097] [00008e51] libusb: debug [handle_event_trigger] hotplug message received
[ 4.458101] [00008e51] libusb: debug [libusb_get_device_descriptor]  
Device attached: 1915:1025
[ 4.458104] [00008e51] libusb: debug [libusb_close]  
[ 4.458112] [00008e51] libusb: debug [libusb_open] open 2.9
[ 4.459056] [00008e51] libusb: debug [darwin_open] device open for access
[ 4.459065] [00008e51] libusb: debug [libusb_close]  
[ 4.459088] [00008e51] libusb: debug [libusb_exit] destroying default context
[ 4.459091] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.9
[ 4.459093] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.29
[ 4.459095] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.30
[ 4.459096] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.19
[ 4.459098] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.32
[ 4.459099] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.23
[ 4.459101] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.22
[ 4.459102] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.25
[ 4.459104] [00008e51] libusb: debug [libusb_unref_device] destroy device 2.26
[ 4.459147] [00008e52] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 4.461119] [00008e51] libusb: debug [usbi_remove_event_source] remove fd 3

@mcuee
Copy link
Member Author

mcuee commented Feb 5, 2024

@sonatique

BTW, the Windows hotplug commit is also good under macOS.
sonatique@497885d

mcuee@mcuees-Mac-mini libusb_win_hotplug % ./examples/listdevs          
1915:1025 (bus 2, device 18) path: 2.4.5.6
1a40:0201 (bus 2, device 6) path: 2.4.5
046d:c52b (bus 2, device 12) path: 2.4.6
05e3:0749 (bus 2, device 11) path: 6.1.2
1a40:0201 (bus 2, device 28) path: 2.4
0bda:5411 (bus 2, device 4) path: 2.1
0bda:0411 (bus 2, device 31) path: 6.1
0bda:0411 (bus 2, device 2) path: 6
0bda:5411 (bus 2, device 3) path: 2

mcuee@mcuees-Mac-mini libusb_win_hotplug % ./examples/hotplugtest       
Device detached: 0bda:0411
Device detached: 0bda:5411
Device detached: 0bda:0411
Device detached: 0bda:5411
Device detached: 05e3:0749
Device detached: 1a40:0201
Device detached: 1a40:0201
Device detached: 1915:1025
Device detached: 046d:c52b

mcuee@mcuees-Mac-mini libusb_win_hotplug % ./examples/hotplugtest
Device attached: 0bda:5411
Device attached: 0bda:0411
Device attached: 0bda:0411
Device attached: 05e3:0749
Device attached: 1a40:0201
Device attached: 0bda:5411
Device attached: 046d:c52b
Device attached: 1a40:0201
Device attached: 1915:1025
mcuee@mcuees-Mac-mini libusb_win_hotplug % git diff
diff --git a/examples/hotplugtest.c b/examples/hotplugtest.c
index c22bf747..88856bc1 100644
--- a/examples/hotplugtest.c
+++ b/examples/hotplugtest.c
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       while (done < 2) {
+       while (done < 9) {
                rc = libusb_handle_events (NULL);
                if (LIBUSB_SUCCESS != rc)
                        printf ("libusb_handle_events() failed: %s\n",

@mcuee
Copy link
Member Author

mcuee commented Feb 13, 2024

Adding the Dell Thunberbolt Dock to the test, using git 02a1457

Mac Mini M1 -- Dell Dock -- 7-Port USB 3.0 Powered Hub -- 13-Port USB 2.0 Powered Hub

mcuee@mcuees-Mac-mini libusb_pr1452 % git diff
diff --git a/examples/hotplugtest.c b/examples/hotplugtest.c
index c22bf747..75ada625 100644
--- a/examples/hotplugtest.c
+++ b/examples/hotplugtest.c
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-       while (done < 2) {
+       while (done < 18) {
                rc = libusb_handle_events (NULL);
                if (LIBUSB_SUCCESS != rc)
                        printf ("libusb_handle_events() failed: %s\n",

mcuee@mcuees-Mac-mini libusb_pr1452 % sudo ./examples/hotplugtest
Device detached: 0bda:5487
Device detached: 0bda:0487
Device detached: 0bda:5413
Device detached: 0bda:0413
Device detached: 0bda:8153
Device detached: 413c:b06e
Device detached: 0bda:5411
Device detached: 413c:b06f
Device detached: 0bda:402e
Device detached: 0bda:0411
Device detached: 0bda:5411
Device detached: 1a40:0201
Device detached: 0bda:0411
Device detached: 0ac8:3420
Device detached: 1a40:0201
Device detached: 046d:c52b
Device detached: 05e3:0749
Device detached: 1915:1025

mcuee@mcuees-Mac-mini libusb_pr1452 % sudo ./examples/hotplugtest
Device attached: 0bda:5487
Device attached: 0bda:0487
Device attached: 0bda:8153
Device attached: 0bda:0413
Device attached: 0bda:5413
Device attached: 0bda:0411
Device attached: 0bda:0411
Device attached: 05e3:0749
Device attached: 413c:b06e
Device attached: 0bda:5411
Device attached: 0bda:402e
Device attached: 1a40:0201
Device attached: 413c:b06f
Device attached: 0bda:5411
Device attached: 1a40:0201
Device attached: 0ac8:3420
Device attached: 046d:c52b
Device attached: 1915:1025

mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/listdevs  
1915:1025 (bus 3, device 18) path: 2.3.2.4.5.6
046d:c52b (bus 3, device 17) path: 2.3.2.4.7
1a40:0201 (bus 3, device 16) path: 2.3.2.4.5
0ac8:3420 (bus 3, device 15) path: 2.3.2.1.1
1a40:0201 (bus 3, device 14) path: 2.3.2.4
0bda:5411 (bus 3, device 13) path: 2.3.2.1
413c:b06f (bus 3, device 12) path: 2.3.5
0bda:402e (bus 3, device 11) path: 2.3.4
0bda:5411 (bus 3, device 10) path: 2.3.2
05e3:0749 (bus 3, device 9) path: 4.3.2.1.2
0bda:0411 (bus 3, device 8) path: 4.3.2.1
0bda:0411 (bus 3, device 7) path: 4.3.2
413c:b06e (bus 3, device 6) path: 2.5
0bda:5413 (bus 3, device 5) path: 2.3
0bda:0413 (bus 3, device 4) path: 4.3
0bda:8153 (bus 3, device 3) path: 4.4
0bda:0487 (bus 3, device 2) path: 4
0bda:5487 (bus 3, device 1) path: 2

mcuee@mcuees-Mac-mini libusb_pr1452 % ./examples/testlibusb 
Dev (bus 3, device 18): 1915 - 1025 speed: 12M
  Manufacturer:              ZY.Ltd
  Product:                   ZY Control Mic
Dev (bus 3, device 17): 046D - C52B speed: 12M
  Manufacturer:              Logitech
  Product:                   USB Receiver
Dev (bus 3, device 16): 1A40 - 0201 speed: 480M
  Product:                   USB 2.0 Hub [MTT]
Dev (bus 3, device 15): 0AC8 - 3420 speed: 480M
  Manufacturer:              Vimicro Corp.
  Product:                   PROLiNK PCC3220
Dev (bus 3, device 14): 1A40 - 0201 speed: 480M
  Product:                   USB 2.0 Hub [MTT]
Dev (bus 3, device 13): 0BDA - 5411 speed: 480M
  Manufacturer:              Generic
  Product:                   4-Port USB 2.0 Hub
Dev (bus 3, device 12): 413C - B06F speed: 480M
  Product:                   Dell dock
Dev (bus 3, device 11): 0BDA - 402E speed: 480M
  Manufacturer:              Generic
  Product:                   USB Audio
Dev (bus 3, device 10): 0BDA - 5411 speed: 480M
  Manufacturer:              Generic
  Product:                   4-Port USB 2.0 Hub
Dev (bus 3, device 9): 05E3 - 0749 speed: 5G
  Manufacturer:              Generic
  Product:                   USB3.0 Card Reader
Dev (bus 3, device 8): 0BDA - 0411 speed: 5G
  Manufacturer:              Generic
  Product:                   4-Port USB 3.0 Hub
Dev (bus 3, device 7): 0BDA - 0411 speed: 5G
  Manufacturer:              Generic
  Product:                   4-Port USB 3.0 Hub
Dev (bus 3, device 6): 413C - B06E speed: 480M
  Product:                   Dell dock
Dev (bus 3, device 5): 0BDA - 5413 speed: 480M
  Manufacturer:              Dell Inc.
  Product:                   Dell dock
Dev (bus 3, device 4): 0BDA - 0413 speed: 5G
  Manufacturer:              Dell Inc.
  Product:                   Dell dock
Dev (bus 3, device 3): 0BDA - 8153 speed: 5G
  Manufacturer:              Realtek
  Product:                   USB 10/100/1000 LAN
Dev (bus 3, device 2): 0BDA - 0487 speed: 10G
  Manufacturer:              Dell Inc.
  Product:                   Dell dock
Dev (bus 3, device 1): 0BDA - 5487 speed: 480M
  Manufacturer:              Dell Inc.
  Product:                   Dell dock

@mcuee
Copy link
Member Author

mcuee commented Feb 13, 2024

Latest PR #1452 git is also fine.
sonatique@8b20a20

@tormodvolden
Copy link
Contributor

Just a note: The crash is not due to the unplug event alone, but because hotplugtest at the same time is calling libusb_exit immediately after seeing the unplug event. So I suppose it only appears when leaving the loop in hotplugtest.c.
while (done < 2) {
Or said differently, if 2 is replaced with a higher number, the plug/unplug cycles go fine until the count is reached, (which happens sooner if a hub with multiple devices is involved). Does that match what you see?

@mcuee
Copy link
Member Author

mcuee commented Mar 15, 2024

Just a note: The crash is not due to the unplug event alone, but because hotplugtest at the same time is calling libusb_exit immediately after seeing the unplug event. So I suppose it only appears when leaving the loop in hotplugtest.c. while (done < 2) { Or said differently, if 2 is replaced with a higher number, the plug/unplug cycles go fine until the count is reached, (which happens sooner if a hub with multiple devices is involved). Does that match what you see?

Yes, you can see in my test I increase the number 2 to the number of devices being plugged out or plugged in (the USB hub and the devices connected to the hub).

@tormodvolden
Copy link
Contributor

Yes, but if you raise the number to something much higher, so that it doesn't exit, you don't see the crash appearing, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants