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

libusb-compat-0.1 devices still referenced upon exit #988

Open
mcuee opened this issue Sep 1, 2021 · 16 comments
Open

libusb-compat-0.1 devices still referenced upon exit #988

mcuee opened this issue Sep 1, 2021 · 16 comments

Comments

@mcuee
Copy link
Member

mcuee commented Sep 1, 2021

From here:
#974

Even the example lsusb.c and testlibusb.c are having the same behavior. I am not so sure if this is an issue with libusb-1.0 Windows or libusb-compat-0.1 codes.

Super simple test application (subset of lsusb.c)

#include <usb.h>
#include <stdio.h>

int main( void )
{
    struct usb_bus *busses;
    struct usb_bus *bus;
    usb_set_debug(255);
    usb_init();
    usb_find_busses();
    usb_find_devices();

	return 0;
}

(py39venv) C:\work\libusb\tests> .\libusb_compat_leak1.exe
libusb: warning [libusb_exit] device 1.9 still referenced
libusb: warning [libusb_exit] device 1.2 still referenced
libusb: warning [libusb_exit] device 1.4 still referenced
libusb: warning [libusb_exit] device 1.3 still referenced
libusb: warning [libusb_exit] device 1.27 still referenced
libusb: warning [libusb_exit] device 1.5 still referenced
libusb: warning [libusb_exit] device 2.0 still referenced
libusb: warning [libusb_exit] device 1.0 still referenced

Debug log:

Click for debug log
(py39venv) C:\work\libusb\tests> .\libusb_compat_leak1.exe
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000349] [00005fe8] libusb: debug [libusb_init] libusb v1.0.24.11650
[ 0.000513] [00005fe8] libusb: debug [usbi_add_event_source] add HANDLE 0000000000000094 events 0
[ 0.000673] [00005fe8] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.000810] [00005fe8] libusb: debug [usbi_add_event_source] add HANDLE 0000000000000098 events 0
[ 0.000965] [00005fe8] libusb: debug [get_windows_version] Windows 10 64-bit
[ 0.001110] [00005fe8] libusb: debug [htab_create] using 1021 entries hash table
[ 0.005843] [00005fe8] libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
[ 0.011122] [00005fe8] libusb: debug [winusbx_init] libusbK DLL found, version: 3.1.0.0
[ 0.019561] [00005fe8] libusb: debug [windows_init] UsbDk backend is available
[ 0.019931] [00005fe8] libusb: debug [libusb_get_device_list]
[ 0.021071] [00000a2c] libusb: debug [windows_iocp_thread] I/O completion thread started
[ 0.041610] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [93]
[ 0.041865] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [94]
[ 0.042322] [00005fe8] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.042565] [00005fe8] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.042730] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [10]
[ 0.043134] [00005fe8] libusb: debug [get_api_type] driver(s): WinUSB
[ 0.043338] [00005fe8] libusb: debug [get_api_type] matched driver name against WinUSB
[ 0.043493] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [1E]
[ 0.044204] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.044406] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.044571] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [71]
[ 0.044904] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.045104] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.045261] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [72]
[ 0.045648] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.045840] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.045977] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [73]
[ 0.046504] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.046686] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.046814] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [74]
[ 0.047187] [00005fe8] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A36D&SUBSYS_091A1028&REV_10\3&11583659&0&A0' bus number 1
[ 0.047356] [00005fe8] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_15DB&SUBSYS_091A1028&REV_02\71D9F51854B3020000' bus number 2
[ 0.049085] [00005fe8] libusb: debug [winusb_get_device_list] extra GUID: {865C4DDE-10B6-6373-FAEE-1506B321A619}
[ 0.049236] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [71]
[ 0.049505] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.049662] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 0.049821] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 3): 'USB\VID_046D&PID_C534\5&E9F3E45&0&3'
[ 0.050132] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [10]
[ 0.050408] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.050553] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.050698] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 5, depth: 1, port: 14): 'USB\VID_8087&PID_0AAA\5&E9F3E45&0&14'
[ 0.051200] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [74]
[ 0.051451] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.051588] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 288 bytes)
[ 0.051739] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 9, depth: 1, port: 2): 'USB\VID_047F&PID_C056\D1CEC32927974D5F9BD6B2AEBF2EA8E3'
[ 0.052279] [00005fe8] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&36020D6F&0&0' reports 26 ports
[ 0.052499] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&36020D6F&0&0'
[ 0.052765] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [73]
[ 0.053001] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.053136] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 269 bytes)
[ 0.053261] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 10): 'USB\VID_0A5C&PID_5842\0123456789ABCD'
[ 0.053758] [00005fe8] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\7&2452366F&0&0' reports 4 ports
[ 0.053889] [00005fe8] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\7&2452366F&0&0'
[ 0.054245] [00005fe8] libusb: debug [winusb_get_device_list] extra GUID: {209D0288-9C4C-5B63-3A38-9EBE14E03F48}
[ 0.054362] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [1E]
[ 0.054563] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.054677] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 44 bytes)
[ 0.054795] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 27, depth: 1, port: 17): 'USB\VID_04B4&PID_00F0\5&E9F3E45&0&17'
[ 0.055335] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [72]
[ 0.055534] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.055668] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 1112 bytes)
[ 0.055783] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 4, depth: 1, port: 11): 'USB\VID_0BDA&PID_58FD\200901010001'
[ 0.056228] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\VID_044E&PID_1212&COL01&COL01\7&290AACAE&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.056390] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.056503] [00005fe8] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C534&MI_01&COL01#7&383A3A17&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.056672] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL01\5&99B72D3&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.056840] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.056948] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL03\7&383A3A17&0&0002
[ 0.057124] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&379854AA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.057279] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.057384] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL02\7&383A3A17&0&0001
[ 0.057534] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.057641] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL04\7&383A3A17&0&0003
[ 0.057798] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816&COL01\3&36A7043C&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.057966] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\VID_044E&PID_1212&COL01&COL02\7&290AACAE&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.058119] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.058228] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL05\7&383A3A17&0&0004
[ 0.058384] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816&COL02\3&36A7043C&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.058493] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL02\5&99B72D3&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.058594] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.058646] [00005fe8] libusb: debug [set_composite_interface] interface[3] = \\?\HID#VID_047F&PID_C056&MI_03&COL01#F&39E6F119&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.058759] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&379854AA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.058859] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.058910] [00005fe8] libusb: debug [set_composite_interface] interface[3] already set - ignoring HID collection: HID\VID_047F&PID_C056&MI_03&COL02\F&39E6F119&0&0001
[ 0.059009] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.059062] [00005fe8] libusb: debug [set_composite_interface] interface[3] already set - ignoring HID collection: HID\VID_047F&PID_C056&MI_03&COL03\F&39E6F119&0&0002
[ 0.059171] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL03\5&99B72D3&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.059270] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.059322] [00005fe8] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C534&MI_00#7&1C54B96&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.059429] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL04\5&99B72D3&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.059539] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL05\5&99B72D3&0&0004' (non USB HID, newly connected, etc.) - ignoring
[ 0.059650] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&379854AA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.060695] [00005fe8] libusb: debug [get_api_type] driver(s): WinUSB
[ 0.060847] [00005fe8] libusb: debug [get_api_type] matched driver name against WinUSB
[ 0.061739] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.3
[ 0.061818] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.5
[ 0.061876] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.9
[ 0.061946] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.061999] [00005fe8] libusb: debug [libusb_unref_device] destroy device 2.0
[ 0.062089] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.27
[ 0.062349] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.4
[ 0.062443] [00005fe8] libusb: debug [libusb_unref_device] destroy device 1.0
[ 0.062542] [00005fe8] libusb: debug [libusb_get_device_list]
[ 0.083069] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [93]
[ 0.083337] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [94]
[ 0.083772] [00005fe8] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.084005] [00005fe8] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.084169] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [10]
[ 0.084570] [00005fe8] libusb: debug [get_api_type] driver(s): WinUSB
[ 0.084766] [00005fe8] libusb: debug [get_api_type] matched driver name against WinUSB
[ 0.084922] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [1E]
[ 0.085507] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.085706] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.085864] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [71]
[ 0.086220] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.086413] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.086567] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [72]
[ 0.086929] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.087140] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.087298] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [73]
[ 0.087672] [00005fe8] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.087867] [00005fe8] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.088031] [00005fe8] libusb: debug [winusb_get_device_list] allocating new device for session [74]
[ 0.088425] [00005fe8] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A36D&SUBSYS_091A1028&REV_10\3&11583659&0&A0' bus number 1
[ 0.088611] [00005fe8] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_15DB&SUBSYS_091A1028&REV_02\71D9F51854B3020000' bus number 2
[ 0.090263] [00005fe8] libusb: debug [winusb_get_device_list] extra GUID: {865C4DDE-10B6-6373-FAEE-1506B321A619}
[ 0.090405] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [71]
[ 0.090693] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.090856] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 0.091039] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 3): 'USB\VID_046D&PID_C534\5&E9F3E45&0&3'
[ 0.091326] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [10]
[ 0.091585] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.091742] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.091870] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 5, depth: 1, port: 14): 'USB\VID_8087&PID_0AAA\5&E9F3E45&0&14'
[ 0.092334] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [74]
[ 0.092540] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.092660] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 288 bytes)
[ 0.092783] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 9, depth: 1, port: 2): 'USB\VID_047F&PID_C056\D1CEC32927974D5F9BD6B2AEBF2EA8E3'
[ 0.093232] [00005fe8] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&36020D6F&0&0' reports 26 ports
[ 0.093432] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&36020D6F&0&0'
[ 0.093674] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [73]
[ 0.093937] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.094108] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 269 bytes)
[ 0.094275] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 10): 'USB\VID_0A5C&PID_5842\0123456789ABCD'
[ 0.094932] [00005fe8] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\7&2452366F&0&0' reports 4 ports
[ 0.095109] [00005fe8] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\7&2452366F&0&0'
[ 0.095570] [00005fe8] libusb: debug [winusb_get_device_list] extra GUID: {209D0288-9C4C-5B63-3A38-9EBE14E03F48}
[ 0.095710] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [1E]
[ 0.095977] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.096140] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 44 bytes)
[ 0.096320] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 27, depth: 1, port: 17): 'USB\VID_04B4&PID_00F0\5&E9F3E45&0&17'
[ 0.097145] [00005fe8] libusb: debug [winusb_get_device_list] found existing device for session [72]
[ 0.097361] [00005fe8] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.097505] [00005fe8] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 1112 bytes)
[ 0.097606] [00005fe8] libusb: debug [init_device] (bus: 1, addr: 4, depth: 1, port: 11): 'USB\VID_0BDA&PID_58FD\200901010001'
[ 0.098030] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\VID_044E&PID_1212&COL01&COL01\7&290AACAE&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.098203] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.098277] [00005fe8] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C534&MI_01&COL01#7&383A3A17&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.098410] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL01\5&99B72D3&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.098581] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.098675] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL03\7&383A3A17&0&0002
[ 0.098848] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&379854AA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.098956] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.099040] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL02\7&383A3A17&0&0001
[ 0.099166] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.099243] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL04\7&383A3A17&0&0003
[ 0.099378] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816&COL01\3&36A7043C&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.099523] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\VID_044E&PID_1212&COL01&COL02\7&290AACAE&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.099652] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.099735] [00005fe8] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL05\7&383A3A17&0&0004
[ 0.099840] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816&COL02\3&36A7043C&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.100275] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL02\5&99B72D3&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.100454] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.100528] [00005fe8] libusb: debug [set_composite_interface] interface[3] = \\?\HID#VID_047F&PID_C056&MI_03&COL01#F&39E6F119&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.100659] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&379854AA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.100764] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.100817] [00005fe8] libusb: debug [set_composite_interface] interface[3] already set - ignoring HID collection: HID\VID_047F&PID_C056&MI_03&COL02\F&39E6F119&0&0001
[ 0.100921] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.100974] [00005fe8] libusb: debug [set_composite_interface] interface[3] already set - ignoring HID collection: HID\VID_047F&PID_C056&MI_03&COL03\F&39E6F119&0&0002
[ 0.101090] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL03\5&99B72D3&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.101207] [00005fe8] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.101267] [00005fe8] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C534&MI_00#7&1C54B96&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.101465] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL04\5&99B72D3&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.101606] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL05\5&99B72D3&0&0004' (non USB HID, newly connected, etc.) - ignoring
[ 0.101739] [00005fe8] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&379854AA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.102809] [00005fe8] libusb: debug [get_api_type] driver(s): WinUSB
[ 0.102906] [00005fe8] libusb: debug [get_api_type] matched driver name against WinUSB
[ 0.103699] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.103754] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.103809] [00005fe8] libusb: debug [parse_configuration] skipping descriptor 0xff
[ 0.103861] [00005fe8] libusb: debug [parse_configuration] skipping descriptor 0xb
[ 0.103915] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.103971] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0xb
[ 0.104021] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.104094] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.104143] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.104193] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.104243] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.104298] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.104348] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.104402] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.104452] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.104501] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.104550] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.104599] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.104650] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.104698] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.104757] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.104807] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.104864] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.104916] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.104970] [00005fe8] libusb: debug [libusb_get_device_descriptor]
[ 0.105019] [00005fe8] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.105068] [00005fe8] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.105551] [00005fe8] libusb: debug [libusb_exit]
[ 0.105627] [00005fe8] libusb: debug [usbi_remove_event_source] remove HANDLE 0000000000000098
[ 0.105684] [00005fe8] libusb: debug [usbi_remove_event_source] remove HANDLE 0000000000000094
[ 0.105738] [00005fe8] libusb: warning [libusb_exit] device 1.9 still referenced
[ 0.105787] [00005fe8] libusb: warning [libusb_exit] device 1.2 still referenced
[ 0.105836] [00005fe8] libusb: warning [libusb_exit] device 1.4 still referenced
[ 0.105886] [00005fe8] libusb: warning [libusb_exit] device 1.3 still referenced
[ 0.105956] [00005fe8] libusb: warning [libusb_exit] device 1.27 still referenced
[ 0.106005] [00005fe8] libusb: warning [libusb_exit] device 1.5 still referenced
[ 0.106055] [00005fe8] libusb: warning [libusb_exit] device 2.0 still referenced
[ 0.106104] [00005fe8] libusb: warning [libusb_exit] device 1.0 still referenced
@mcuee mcuee added the windows label Sep 1, 2021
@mcuee
Copy link
Member Author

mcuee commented Sep 1, 2021

The following is okay.

#include <usb.h>
#include <stdio.h>

int main( void )
{
    struct usb_bus *busses;
    struct usb_bus *bus;
    usb_set_debug(255);
    usb_init();
    usb_find_busses();
    //usb_find_devices();

    return 0;
}

Debug log:

Click for debug log
(py39venv) C:\work\libusb\tests> .\libusb_compat_leak3.exe
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000333] [00002b38] libusb: debug [libusb_init] libusb v1.0.24.11650
[ 0.000512] [00002b38] libusb: debug [usbi_add_event_source] add HANDLE 0000000000000094 events 0
[ 0.000674] [00002b38] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.000781] [00002b38] libusb: debug [usbi_add_event_source] add HANDLE 0000000000000098 events 0
[ 0.000914] [00002b38] libusb: debug [get_windows_version] Windows 10 64-bit
[ 0.001056] [00002b38] libusb: debug [htab_create] using 1021 entries hash table
[ 0.006228] [00002b38] libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
[ 0.012230] [00002b38] libusb: debug [winusbx_init] libusbK DLL found, version: 3.1.0.0
[ 0.019718] [00002b38] libusb: debug [windows_init] UsbDk backend is available
[ 0.020164] [00002b38] libusb: debug [libusb_get_device_list]
[ 0.021410] [00002f04] libusb: debug [windows_iocp_thread] I/O completion thread started
[ 0.041463] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [93]
[ 0.041738] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [94]
[ 0.042176] [00002b38] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.042412] [00002b38] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.042572] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [10]
[ 0.042966] [00002b38] libusb: debug [get_api_type] driver(s): WinUSB
[ 0.043159] [00002b38] libusb: debug [get_api_type] matched driver name against WinUSB
[ 0.043318] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [1E]
[ 0.043925] [00002b38] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.044123] [00002b38] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.044279] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [71]
[ 0.044654] [00002b38] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.044864] [00002b38] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.045024] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [72]
[ 0.045392] [00002b38] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.045591] [00002b38] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.045737] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [73]
[ 0.046106] [00002b38] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.046310] [00002b38] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.046472] [00002b38] libusb: debug [winusb_get_device_list] allocating new device for session [74]
[ 0.046860] [00002b38] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A36D&SUBSYS_091A1028&REV_10\3&11583659&0&A0' bus number 1
[ 0.047065] [00002b38] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_15DB&SUBSYS_091A1028&REV_02\71D9F51854B3020000' bus number 2
[ 0.048739] [00002b38] libusb: debug [winusb_get_device_list] extra GUID: {865C4DDE-10B6-6373-FAEE-1506B321A619}
[ 0.048886] [00002b38] libusb: debug [winusb_get_device_list] found existing device for session [71]
[ 0.049173] [00002b38] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.049343] [00002b38] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 59 bytes)
[ 0.049511] [00002b38] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 3): 'USB\VID_046D&PID_C534\5&E9F3E45&0&3'
[ 0.049796] [00002b38] libusb: debug [winusb_get_device_list] found existing device for session [10]
[ 0.050052] [00002b38] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.050210] [00002b38] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.050339] [00002b38] libusb: debug [init_device] (bus: 1, addr: 5, depth: 1, port: 14): 'USB\VID_8087&PID_0AAA\5&E9F3E45&0&14'
[ 0.050823] [00002b38] libusb: debug [winusb_get_device_list] found existing device for session [74]
[ 0.051050] [00002b38] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.051169] [00002b38] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 288 bytes)
[ 0.051281] [00002b38] libusb: debug [init_device] (bus: 1, addr: 9, depth: 1, port: 2): 'USB\VID_047F&PID_C056\D1CEC32927974D5F9BD6B2AEBF2EA8E3'
[ 0.051763] [00002b38] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&36020D6F&0&0' reports 26 ports
[ 0.051999] [00002b38] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&36020D6F&0&0'
[ 0.052235] [00002b38] libusb: debug [winusb_get_device_list] found existing device for session [73]
[ 0.052439] [00002b38] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.052563] [00002b38] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 269 bytes)
[ 0.052696] [00002b38] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 10): 'USB\VID_0A5C&PID_5842\0123456789ABCD'
[ 0.053215] [00002b38] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\7&2452366F&0&0' reports 4 ports
[ 0.053372] [00002b38] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\7&2452366F&0&0'
[ 0.053770] [00002b38] libusb: debug [winusb_get_device_list] extra GUID: {209D0288-9C4C-5B63-3A38-9EBE14E03F48}
[ 0.053880] [00002b38] libusb: debug [winusb_get_device_list] found existing device for session [1E]
[ 0.054112] [00002b38] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.054235] [00002b38] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 44 bytes)
[ 0.054354] [00002b38] libusb: debug [init_device] (bus: 1, addr: 27, depth: 1, port: 17): 'USB\VID_04B4&PID_00F0\5&E9F3E45&0&17'
[ 0.054914] [00002b38] libusb: debug [winusb_get_device_list] found existing device for session [72]
[ 0.055108] [00002b38] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.055231] [00002b38] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 1112 bytes)
[ 0.055346] [00002b38] libusb: debug [init_device] (bus: 1, addr: 4, depth: 1, port: 11): 'USB\VID_0BDA&PID_58FD\200901010001'
[ 0.055789] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\VID_044E&PID_1212&COL01&COL01\7&290AACAE&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.055949] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.056053] [00002b38] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C534&MI_01&COL01#7&383A3A17&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.056218] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL01\5&99B72D3&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.056387] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.056489] [00002b38] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL03\7&383A3A17&0&0002
[ 0.056664] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&379854AA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.056797] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.056880] [00002b38] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL02\7&383A3A17&0&0001
[ 0.057004] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.057078] [00002b38] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL04\7&383A3A17&0&0003
[ 0.057206] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816&COL01\3&36A7043C&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.057348] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\VID_044E&PID_1212&COL01&COL02\7&290AACAE&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.057447] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.057497] [00002b38] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C534&MI_01&COL05\7&383A3A17&0&0004
[ 0.057597] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816&COL02\3&36A7043C&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.057706] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL02\5&99B72D3&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.057806] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.057857] [00002b38] libusb: debug [set_composite_interface] interface[3] = \\?\HID#VID_047F&PID_C056&MI_03&COL01#F&39E6F119&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.057966] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&379854AA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.059624] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.059711] [00002b38] libusb: debug [set_composite_interface] interface[3] already set - ignoring HID collection: HID\VID_047F&PID_C056&MI_03&COL02\F&39E6F119&0&0001
[ 0.059858] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [74]:
[ 0.059973] [00002b38] libusb: debug [set_composite_interface] interface[3] already set - ignoring HID collection: HID\VID_047F&PID_C056&MI_03&COL03\F&39E6F119&0&0002
[ 0.060142] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL03\5&99B72D3&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.060306] [00002b38] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.060398] [00002b38] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C534&MI_00#7&1C54B96&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.060574] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL04\5&99B72D3&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.060752] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\DELL091A&COL05\5&99B72D3&0&0004' (non USB HID, newly connected, etc.) - ignoring
[ 0.060932] [00002b38] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&379854AA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.062040] [00002b38] libusb: debug [get_api_type] driver(s): WinUSB
[ 0.062182] [00002b38] libusb: debug [get_api_type] matched driver name against WinUSB
[ 0.063051] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.3
[ 0.063166] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.5
[ 0.063279] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.9
[ 0.063391] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.063494] [00002b38] libusb: debug [libusb_unref_device] destroy device 2.0
[ 0.063587] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.27
[ 0.063677] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.4
[ 0.063765] [00002b38] libusb: debug [libusb_unref_device] destroy device 1.0
[ 0.064287] [00002b38] libusb: debug [libusb_exit]
[ 0.064396] [00002b38] libusb: debug [usbi_remove_event_source] remove HANDLE 0000000000000098
[ 0.064491] [00002b38] libusb: debug [usbi_remove_event_source] remove HANDLE 0000000000000094

@mcuee
Copy link
Member Author

mcuee commented Sep 1, 2021

For the release version of libusb-1.0.21, 1.0.22, 1.0.23 and 1.0.24, the warning message is like the following.

[ 0.108524] [00000ebc] libusb: debug [libusb_exit]
[ 0.108613] [00000ebc] libusb: debug [libusb_exit] destroying default context
[ 0.108682] [00000ebc] libusb: warning [libusb_exit] some libusb_devices were leaked

@mcuee
Copy link
Member Author

mcuee commented Sep 8, 2021

Looks like there is a bug in libusb Windows backend.
vpelletier/python-libusb1#77

@mcuee mcuee added the bug label Sep 8, 2021
@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2022

This is still there. Probably this is a bug of libusb-compat.

Here is the debug log under my Mac Mini M1 running macOS 12.3.


mcuee@mcuees-Mac-mini libusb-compat-0.1 % ./examples/testlibusb
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000022] [0000affd] libusb: debug [libusb_init] libusb v1.0.26.11717-rc1
[ 0.000038] [0000affd] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000252] [0000affd] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x141a4a7bd4
[ 0.000287] [0000affd] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x141a4a7bd4
[ 0.001765] [0000affd] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.001771] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.001773] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.001775] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0xff
[ 0.001777] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0xff
[ 0.001778] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0xff
[ 0.001779] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.001781] [0000affd] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x04b4
[ 0.001782] [0000affd] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x8613
[ 0.001784] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0xa001
[ 0.001786] [0000affd] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.001787] [0000affd] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x00
[ 0.001789] [0000affd] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.001790] [0000affd] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.001806] [0000affd] libusb: debug [darwin_check_configuration] active config: 0, first config: 1
[ 0.001809] [0000affd] libusb: debug [process_new_device] allocating new device in context 0x12ce04ad0 for with session 0x141a4a7bd4
[ 0.001813] [0000affd] libusb: debug [process_new_device] found device with address 12 port = 1 parent = 0x0 at 0x6000013a4dba
[ 0.001857] [0000affe] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.002009] [0000affe] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.002026] [0000affd] libusb: warning [libusb_init] installing new context as implicit default
[ 0.002032] [0000affd] libusb: debug [libusb_get_device_list]  
[ 0.002059] [0000affd] libusb: debug [libusb_get_device_list]  
[ 0.002070] [0000affd] libusb: debug [libusb_get_device_descriptor]  
[ 0.002073] [0000affd] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.002088] [0000affd] libusb: debug [libusb_open] open 2.12
[ 0.002140] [0000affd] libusb: debug [darwin_open] device open for access
Dev #12: 04B4 - 8613
[ 0.002151] [0000affd] libusb: debug [libusb_close]  
[ 0.002169] [0000affd] libusb: debug [libusb_exit]  
[ 0.002192] [0000affe] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 0.002304] [0000affd] libusb: debug [usbi_remove_event_source] remove fd 3
[ 0.002312] [0000affd] libusb: warning [libusb_exit] device 2.12 still referenced

@mcuee mcuee removed the windows label Apr 1, 2022
@mcuee mcuee changed the title libusb-compat-0.1 devices still referenced upon exit under Windows libusb-compat-0.1 devices still referenced upon exit Apr 1, 2022
@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2022

Same under Linux (Ubuntu Linux 20.04 x64 version).

click for debug log
mcuee@UbuntuSwift3:~/build/libusb-compat-0.1$ ./examples/testlibusb 
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000102] [00001212] libusb: debug [libusb_init] libusb v1.0.26.11717-rc1
[ 0.000137] [00001212] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000146] [00001212] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.000150] [00001212] libusb: debug [usbi_add_event_source] add fd 4 events 1
[ 0.000167] [00001212] libusb: debug [get_kernel_version] reported kernel version is 5.15.10-051510-generic
[ 0.000190] [00001212] libusb: debug [op_init] found usbfs at /dev/bus/usb
[ 0.000200] [00001212] libusb: debug [op_init] max iso packet length is (likely) 98304 bytes
[ 0.000209] [00001212] libusb: debug [op_init] sysfs is available
[ 0.001337] [00001220] libusb: debug [linux_udev_event_thread_main] udev event thread entering
[ 0.003910] [00001212] libusb: debug [linux_get_device_address] getting address for device: usb1 detached: 0
[ 0.003914] [00001212] libusb: debug [linux_get_device_address] scan usb1
[ 0.003927] [00001212] libusb: debug [linux_get_device_address] bus=1 dev=1
[ 0.003928] [00001212] libusb: debug [linux_enumerate_device] busnum 1 devaddr 1 session_id 257
[ 0.003931] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 1/1 (session 257)
[ 0.003967] [00001212] libusb: debug [linux_get_device_address] getting address for device: usb2 detached: 0
[ 0.003969] [00001212] libusb: debug [linux_get_device_address] scan usb2
[ 0.003979] [00001212] libusb: debug [linux_get_device_address] bus=2 dev=1
[ 0.003980] [00001212] libusb: debug [linux_enumerate_device] busnum 2 devaddr 1 session_id 513
[ 0.003983] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 2/1 (session 513)
[ 0.004030] [00001212] libusb: debug [linux_get_device_address] getting address for device: usb3 detached: 0
[ 0.004032] [00001212] libusb: debug [linux_get_device_address] scan usb3
[ 0.004042] [00001212] libusb: debug [linux_get_device_address] bus=3 dev=1
[ 0.004044] [00001212] libusb: debug [linux_enumerate_device] busnum 3 devaddr 1 session_id 769
[ 0.004047] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 3/1 (session 769)
[ 0.004081] [00001212] libusb: debug [linux_get_device_address] getting address for device: 3-10 detached: 0
[ 0.004083] [00001212] libusb: debug [linux_get_device_address] scan 3-10
[ 0.004093] [00001212] libusb: debug [linux_get_device_address] bus=3 dev=5
[ 0.004095] [00001212] libusb: debug [linux_enumerate_device] busnum 3 devaddr 5 session_id 773
[ 0.004097] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 3/5 (session 773)
[ 0.004111] [00001212] libusb: debug [linux_get_parent_info] dev 0x55f913ed7a20 (3-10) has parent 0x55f913ef5d50 (usb3) port 10
[ 0.004138] [00001212] libusb: debug [linux_get_device_address] getting address for device: 3-3 detached: 0
[ 0.004140] [00001212] libusb: debug [linux_get_device_address] scan 3-3
[ 0.004150] [00001212] libusb: debug [linux_get_device_address] bus=3 dev=2
[ 0.004152] [00001212] libusb: debug [linux_enumerate_device] busnum 3 devaddr 2 session_id 770
[ 0.004155] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 3/2 (session 770)
[ 0.004166] [00001212] libusb: debug [linux_get_parent_info] dev 0x55f913ef7440 (3-3) has parent 0x55f913ef5d50 (usb3) port 3
[ 0.004192] [00001212] libusb: debug [linux_get_device_address] getting address for device: 3-5 detached: 0
[ 0.004194] [00001212] libusb: debug [linux_get_device_address] scan 3-5
[ 0.004205] [00001212] libusb: debug [linux_get_device_address] bus=3 dev=3
[ 0.004207] [00001212] libusb: debug [linux_enumerate_device] busnum 3 devaddr 3 session_id 771
[ 0.004209] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 3/3 (session 771)
[ 0.004221] [00001212] libusb: debug [linux_get_parent_info] dev 0x55f913ef7360 (3-5) has parent 0x55f913ef5d50 (usb3) port 5
[ 0.004248] [00001212] libusb: debug [linux_get_device_address] getting address for device: 3-7 detached: 0
[ 0.004250] [00001212] libusb: debug [linux_get_device_address] scan 3-7
[ 0.004261] [00001212] libusb: debug [linux_get_device_address] bus=3 dev=4
[ 0.004262] [00001212] libusb: debug [linux_enumerate_device] busnum 3 devaddr 4 session_id 772
[ 0.004265] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 3/4 (session 772)
[ 0.004276] [00001212] libusb: debug [linux_get_parent_info] dev 0x55f913ed8c30 (3-7) has parent 0x55f913ef5d50 (usb3) port 7
[ 0.004301] [00001212] libusb: debug [linux_get_device_address] getting address for device: usb4 detached: 0
[ 0.004303] [00001212] libusb: debug [linux_get_device_address] scan usb4
[ 0.004313] [00001212] libusb: debug [linux_get_device_address] bus=4 dev=1
[ 0.004316] [00001212] libusb: debug [linux_enumerate_device] busnum 4 devaddr 1 session_id 1025
[ 0.004322] [00001212] libusb: debug [linux_enumerate_device] allocating new device for 4/1 (session 1025)
[ 0.004358] [00001212] libusb: warning [libusb_init] installing new context as implicit default
[ 0.004362] [00001212] libusb: debug [libusb_get_device_list]  
[ 0.004383] [00001212] libusb: debug [libusb_get_device_list]  
[ 0.004389] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004392] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004396] [00001212] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.004404] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004406] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004409] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004411] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004416] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004418] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004422] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004424] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004427] [00001212] libusb: debug [parse_configuration] skipping descriptor 0xb
[ 0.004429] [00001212] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.004434] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004436] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004440] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004442] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004444] [00001212] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.004448] [00001212] libusb: debug [libusb_get_device_descriptor]  
[ 0.004450] [00001212] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004453] [00001212] libusb: debug [libusb_open] open 4.1
[ 0.004468] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/004/001, errno=13
[ 0.004470] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.004472] [00001212] libusb: debug [libusb_open] open 4.1 returns -3
Dev #1: 1D6B - 0003
[ 0.004479] [00001212] libusb: debug [libusb_open] open 3.4
[ 0.125119] [00001212] libusb: debug [usbi_add_event_source] add fd 7 events 4
[ 0.125168] [00001212] libusb: debug [libusb_submit_transfer] transfer 0x55f913ef0500
[ 0.125178] [00001212] libusb: debug [add_to_flying_list] arm timer for timeout in 1000ms (first in line)
[ 0.125238] [00001212] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.125246] [00001212] libusb: debug [handle_events] event sources modified, reallocating event data
[ 0.125260] [00001212] libusb: debug [usbi_wait_for_events] poll() 3 fds with timeout in 60000ms
[ 0.125707] [00001212] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 0.125732] [00001212] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=4
[ 0.125737] [00001212] libusb: debug [handle_control_completion] handling completion status 0
[ 0.125742] [00001212] libusb: debug [arm_timer_for_next_timeout] no timeouts, disarming timer
[ 0.125748] [00001212] libusb: debug [usbi_handle_transfer_completion] transfer 0x55f913ef0500 has callback 0x7f397860d250
[ 0.125752] [00001212] libusb: debug [sync_transfer_cb] actual_length=4
[ 0.125763] [00001212] libusb: debug [libusb_free_transfer] transfer 0x55f913ef0500
[ 0.125769] [00001212] libusb: debug [libusb_submit_transfer] transfer 0x55f913ef05f0
[ 0.125777] [00001212] libusb: debug [add_to_flying_list] arm timer for timeout in 1000ms (first in line)
[ 0.125816] [00001212] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.125823] [00001212] libusb: debug [usbi_wait_for_events] poll() 3 fds with timeout in 60000ms
[ 0.126345] [00001212] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 0.126373] [00001212] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=16
[ 0.126382] [00001212] libusb: debug [handle_control_completion] handling completion status 0
[ 0.126388] [00001212] libusb: debug [arm_timer_for_next_timeout] no timeouts, disarming timer
[ 0.126398] [00001212] libusb: debug [usbi_handle_transfer_completion] transfer 0x55f913ef05f0 has callback 0x7f397860d250
[ 0.126407] [00001212] libusb: debug [sync_transfer_cb] actual_length=16
[ 0.126417] [00001212] libusb: debug [libusb_free_transfer] transfer 0x55f913ef05f0
[ 0.126431] [00001212] libusb: debug [libusb_submit_transfer] transfer 0x55f913ef5bf0
[ 0.126438] [00001212] libusb: debug [add_to_flying_list] arm timer for timeout in 1000ms (first in line)
[ 0.126475] [00001212] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.126482] [00001212] libusb: debug [usbi_wait_for_events] poll() 3 fds with timeout in 60000ms
[ 0.126982] [00001212] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 0.126995] [00001212] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=4
[ 0.127003] [00001212] libusb: debug [handle_control_completion] handling completion status 0
[ 0.127012] [00001212] libusb: debug [arm_timer_for_next_timeout] no timeouts, disarming timer
[ 0.127021] [00001212] libusb: debug [usbi_handle_transfer_completion] transfer 0x55f913ef5bf0 has callback 0x7f397860d250
[ 0.127028] [00001212] libusb: debug [sync_transfer_cb] actual_length=4
[ 0.127038] [00001212] libusb: debug [libusb_free_transfer] transfer 0x55f913ef5bf0
[ 0.127046] [00001212] libusb: debug [libusb_submit_transfer] transfer 0x55f913ef5ce0
[ 0.127053] [00001212] libusb: debug [add_to_flying_list] arm timer for timeout in 1000ms (first in line)
[ 0.127083] [00001212] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.127089] [00001212] libusb: debug [usbi_wait_for_events] poll() 3 fds with timeout in 60000ms
[ 0.127595] [00001212] libusb: debug [usbi_wait_for_events] poll() returned 1
[ 0.127607] [00001212] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=28
[ 0.127615] [00001212] libusb: debug [handle_control_completion] handling completion status 0
[ 0.127623] [00001212] libusb: debug [arm_timer_for_next_timeout] no timeouts, disarming timer
[ 0.127632] [00001212] libusb: debug [usbi_handle_transfer_completion] transfer 0x55f913ef5ce0 has callback 0x7f397860d250
[ 0.127640] [00001212] libusb: debug [sync_transfer_cb] actual_length=28
[ 0.127648] [00001212] libusb: debug [libusb_free_transfer] transfer 0x55f913ef5ce0
Dev #4: EgisTec - EgisTec EH575
[ 0.127669] [00001212] libusb: debug [libusb_close]  
[ 0.127680] [00001212] libusb: debug [usbi_remove_event_source] remove fd 7
[ 0.127697] [00001212] libusb: debug [libusb_open] open 3.3
[ 0.127723] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/003/003, errno=13
[ 0.127730] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.127738] [00001212] libusb: debug [libusb_open] open 3.3 returns -3
Dev #3: 04F2 - B6DD
[ 0.127755] [00001212] libusb: debug [libusb_open] open 3.2
[ 0.127769] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/003/002, errno=13
[ 0.127775] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.127784] [00001212] libusb: debug [libusb_open] open 3.2 returns -3
Dev #2: 046D - C52B
[ 0.127798] [00001212] libusb: debug [libusb_open] open 3.5
[ 0.127810] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/003/005, errno=13
[ 0.127818] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.127824] [00001212] libusb: debug [libusb_open] open 3.5 returns -3
Dev #5: 8087 - 0026
[ 0.127835] [00001212] libusb: debug [libusb_open] open 3.1
[ 0.127849] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/003/001, errno=13
[ 0.127856] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.127863] [00001212] libusb: debug [libusb_open] open 3.1 returns -3
Dev #1: 1D6B - 0002
[ 0.127879] [00001212] libusb: debug [libusb_open] open 2.1
[ 0.127890] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/001, errno=13
[ 0.127895] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.127898] [00001212] libusb: debug [libusb_open] open 2.1 returns -3
Dev #1: 1D6B - 0003
[ 0.127909] [00001212] libusb: debug [libusb_open] open 1.1
[ 0.127919] [00001212] libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/001, errno=13
[ 0.127925] [00001212] libusb: error [get_usbfs_fd] libusb requires write access to USB device nodes
[ 0.127931] [00001212] libusb: debug [libusb_open] open 1.1 returns -3
Dev #1: 1D6B - 0002
[ 0.127953] [00001212] libusb: debug [libusb_exit]  
[ 0.128011] [00001220] libusb: debug [linux_udev_event_thread_main] udev event thread exiting
[ 0.128117] [00001212] libusb: debug [usbi_remove_event_source] remove fd 4
[ 0.128126] [00001212] libusb: debug [usbi_remove_event_source] remove fd 3
[ 0.128138] [00001212] libusb: warning [libusb_exit] device 4.1 still referenced
[ 0.128144] [00001212] libusb: warning [libusb_exit] device 3.4 still referenced
[ 0.128147] [00001212] libusb: warning [libusb_exit] device 3.3 still referenced
[ 0.128153] [00001212] libusb: warning [libusb_exit] device 3.2 still referenced
[ 0.128160] [00001212] libusb: warning [libusb_exit] device 3.5 still referenced
[ 0.128166] [00001212] libusb: warning [libusb_exit] device 3.1 still referenced
[ 0.128173] [00001212] libusb: warning [libusb_exit] device 2.1 still referenced
[ 0.128180] [00001212] libusb: warning [libusb_exit] device 1.1 still referenced

@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2022

I have closed #974 as it seems to be okay. So I tend to think there is an issue with libusb-compat-0.1 or at least its usage of libusb-1.0 APIs.

@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2022

Same under my WIndows 11 machine.

click for debug log
$ ./examples/lsusb.exe
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000957] [0000327c] libusb: debug [libusb_init] libusb v1.0.26.11717-rc1
[ 0.001257] [0000327c] libusb: debug [usbi_add_event_source] add HANDLE 00000000000000a0 events 0
[ 0.001555] [0000327c] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.001852] [0000327c] libusb: debug [usbi_add_event_source] add HANDLE 00000000000000a4 events 0
[ 0.002151] [0000327c] libusb: debug [get_windows_version] Windows 11 64-bit
[ 0.002294] [0000327c] libusb: debug [htab_create] using 1021 entries hash table
[ 0.003945] [0000327c] libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
[ 0.005638] [0000327c] libusb: debug [winusbx_init] libusbK DLL found, version: 3.1.0.0
[ 0.007307] [0000327c] libusb: info [windows_init] UsbDk backend is not available
[ 0.007412] [0000327c] libusb: warning [libusb_init] installing new context as implicit default
[ 0.007477] [0000327c] libusb: debug [libusb_get_device_list]
[ 0.007505] [00001c14] libusb: debug [windows_iocp_thread] I/O completion thread started
[ 0.013539] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [5]
[ 0.013782] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [6]
[ 0.014267] [0000327c] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.014462] [0000327c] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.014582] [0000327c] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.014676] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [1F]
[ 0.014960] [0000327c] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.015055] [0000327c] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.015183] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [34]
[ 0.015484] [0000327c] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.015557] [0000327c] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.015601] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [62]
[ 0.015717] [0000327c] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.015775] [0000327c] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.015817] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [63]
[ 0.016006] [0000327c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A0ED&SUBSYS_15451025&REV_20\3&11583659&0&A0' bus number 1
[ 0.016081] [0000327c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_9A13&SUBSYS_72708086&REV_01\3&11583659&0&68' bus number 2
[ 0.016761] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [34]
[ 0.016895] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.016953] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.017028] [0000327c] libusb: debug [init_device] (bus: 1, addr: 4, depth: 1, port: 10): 'USB\VID_8087&PID_0026\5&586B51A&0&10'
[ 0.017133] [0000327c] libusb: debug [winusb_get_device_list] extra GUID: {16126A05-3179-4589-9DB8-952AFFD297D5}
[ 0.017195] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [62]
[ 0.017284] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.017347] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 512 bytes)
[ 0.017409] [0000327c] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 5): 'USB\VID_04F2&PID_B6DD\0001'
[ 0.017509] [0000327c] libusb: debug [winusb_get_device_list] extra GUID: {20348E47-A897-468E-9D0E-56307802FC2A}
[ 0.017557] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [1F]
[ 0.017633] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.017680] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 46 bytes)
[ 0.017729] [0000327c] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 7): 'USB\VID_1C7A&PID_0575\077E2F9A'
[ 0.017956] [0000327c] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&12C539F&0&0' reports 16 ports
[ 0.018036] [0000327c] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&12C539F&0&0'
[ 0.018158] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [63]
[ 0.018227] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.018274] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 84 bytes)
[ 0.018322] [0000327c] libusb: debug [init_device] (bus: 1, addr: 1, depth: 1, port: 3): 'USB\VID_046D&PID_C52B\5&586B51A&0&3'
[ 0.018503] [0000327c] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&1A63DC7C&0&0' reports 5 ports
[ 0.018572] [0000327c] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&1A63DC7C&0&0'
[ 0.018779] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL01\5&2F64DFEA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.018842] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.018884] [0000327c] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C52B&MI_01&COL01#7&1119BFB4&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.018986] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816\3&D2322F2&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.019049] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL02\5&2F64DFEA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.019113] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL03\5&2F64DFEA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.019176] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL04\5&2F64DFEA&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.019241] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&32CF90E6&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.019299] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.019343] [0000327c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL02\7&1119BFB4&0&0001
[ 0.019423] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&32CF90E6&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.019488] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.019532] [0000327c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL03\7&1119BFB4&0&0002
[ 0.019596] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\10251229\3&9D5D338&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.019665] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&32CF90E6&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.019723] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.019764] [0000327c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL04\7&1119BFB4&0&0003
[ 0.019822] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.019863] [0000327c] libusb: debug [set_composite_interface] interface[2] = \\?\HID#VID_046D&PID_C52B&MI_02&COL01#7&12BD7E0E&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.019920] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.019962] [0000327c] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL02\7&12BD7E0E&0&0001
[ 0.020018] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.020059] [0000327c] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL03\7&12BD7E0E&0&0002
[ 0.020116] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.020157] [0000327c] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C52B&MI_00#7&34F0FD76&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.020626] [0000327c] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.020719] [0000327c] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.020762] [0000327c] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.021139] [0000327c] libusb: debug [libusb_unref_device] destroy device 1.4
[ 0.021222] [0000327c] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.021280] [0000327c] libusb: debug [libusb_unref_device] destroy device 1.3
[ 0.021333] [0000327c] libusb: debug [libusb_unref_device] destroy device 1.1
[ 0.021378] [0000327c] libusb: debug [libusb_unref_device] destroy device 1.0
[ 0.021423] [0000327c] libusb: debug [libusb_unref_device] destroy device 2.0
[ 0.021479] [0000327c] libusb: debug [libusb_get_device_list]
[ 0.028130] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [5]
[ 0.028257] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [6]
[ 0.028644] [0000327c] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.028737] [0000327c] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.028780] [0000327c] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.028830] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [1F]
[ 0.028992] [0000327c] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.029062] [0000327c] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.029107] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [34]
[ 0.029317] [0000327c] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.029383] [0000327c] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.029427] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [62]
[ 0.029536] [0000327c] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.029604] [0000327c] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.029650] [0000327c] libusb: debug [winusb_get_device_list] allocating new device for session [63]
[ 0.029851] [0000327c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A0ED&SUBSYS_15451025&REV_20\3&11583659&0&A0' bus number 1
[ 0.029917] [0000327c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_9A13&SUBSYS_72708086&REV_01\3&11583659&0&68' bus number 2
[ 0.030491] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [34]
[ 0.030612] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.030664] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.030717] [0000327c] libusb: debug [init_device] (bus: 1, addr: 4, depth: 1, port: 10): 'USB\VID_8087&PID_0026\5&586B51A&0&10'
[ 0.030804] [0000327c] libusb: debug [winusb_get_device_list] extra GUID: {16126A05-3179-4589-9DB8-952AFFD297D5}
[ 0.030850] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [62]
[ 0.030920] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.030969] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 512 bytes)
[ 0.031018] [0000327c] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 5): 'USB\VID_04F2&PID_B6DD\0001'
[ 0.031104] [0000327c] libusb: debug [winusb_get_device_list] extra GUID: {20348E47-A897-468E-9D0E-56307802FC2A}
[ 0.031149] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [1F]
[ 0.031220] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.031268] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 46 bytes)
[ 0.031316] [0000327c] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 7): 'USB\VID_1C7A&PID_0575\077E2F9A'
[ 0.031533] [0000327c] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&12C539F&0&0' reports 16 ports
[ 0.031623] [0000327c] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&12C539F&0&0'
[ 0.031761] [0000327c] libusb: debug [winusb_get_device_list] found existing device for session [63]
[ 0.031842] [0000327c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.031891] [0000327c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 84 bytes)
[ 0.031940] [0000327c] libusb: debug [init_device] (bus: 1, addr: 1, depth: 1, port: 3): 'USB\VID_046D&PID_C52B\5&586B51A&0&3'
[ 0.032123] [0000327c] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&1A63DC7C&0&0' reports 5 ports
[ 0.032179] [0000327c] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&1A63DC7C&0&0'
[ 0.032353] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL01\5&2F64DFEA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.032412] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.032455] [0000327c] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C52B&MI_01&COL01#7&1119BFB4&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.032553] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816\3&D2322F2&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.032615] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL02\5&2F64DFEA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.032678] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL03\5&2F64DFEA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.032741] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL04\5&2F64DFEA&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.032806] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&32CF90E6&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.032864] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.032906] [0000327c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL02\7&1119BFB4&0&0001
[ 0.032969] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&32CF90E6&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.033029] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.033070] [0000327c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL03\7&1119BFB4&0&0002
[ 0.033131] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\10251229\3&9D5D338&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.033194] [0000327c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&32CF90E6&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.033251] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.033293] [0000327c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL04\7&1119BFB4&0&0003
[ 0.033349] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.033391] [0000327c] libusb: debug [set_composite_interface] interface[2] = \\?\HID#VID_046D&PID_C52B&MI_02&COL01#7&12BD7E0E&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.033447] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.033489] [0000327c] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL02\7&12BD7E0E&0&0001
[ 0.033545] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.033586] [0000327c] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL03\7&12BD7E0E&0&0002
[ 0.033652] [0000327c] libusb: debug [winusb_get_device_list] setting composite interface for [63]:
[ 0.033698] [0000327c] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C52B&MI_00#7&34F0FD76&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.034198] [0000327c] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.034292] [0000327c] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.034336] [0000327c] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.034711] [0000327c] libusb: debug [libusb_get_device_descriptor]
[ 0.034783] [0000327c] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.034829] [0000327c] libusb: debug [libusb_get_device_descriptor]
[ 0.034869] [0000327c] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.034910] [0000327c] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.034952] [0000327c] libusb: debug [libusb_get_device_descriptor]
[ 0.034992] [0000327c] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.035035] [0000327c] libusb: debug [libusb_get_device_descriptor]
[ 0.035075] [0000327c] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.035121] [0000327c] libusb: debug [parse_configuration] skipping descriptor 0xb
[ 0.035163] [0000327c] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.035208] [0000327c] libusb: debug [libusb_get_device_descriptor]
[ 0.035249] [0000327c] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.035300] [0000327c] libusb: debug [libusb_get_device_descriptor]
[ 0.035340] [0000327c] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.035381] [0000327c] libusb: debug [parse_endpoint] skipping descriptor 0x30
8087:0026
04f2:b6dd
1c7a:0575
8086:a0ed
046d:c52b
8086:9a13
[ 0.037396] [0000327c] libusb: debug [libusb_exit]
[ 0.037613] [0000327c] libusb: debug [usbi_remove_event_source] remove HANDLE 00000000000000a4
[ 0.037722] [0000327c] libusb: debug [usbi_remove_event_source] remove HANDLE 00000000000000a0
[ 0.037783] [0000327c] libusb: warning [libusb_exit] device 1.1 still referenced
[ 0.037836] [0000327c] libusb: warning [libusb_exit] device 1.2 still referenced
[ 0.037915] [0000327c] libusb: warning [libusb_exit] device 1.4 still referenced
[ 0.037967] [0000327c] libusb: warning [libusb_exit] device 1.3 still referenced
[ 0.038030] [0000327c] libusb: warning [libusb_exit] device 2.0 still referenced
[ 0.038081] [0000327c] libusb: warning [libusb_exit] device 1.0 still referenced

@mcuee mcuee removed the bug label Apr 1, 2022
@mcuee
Copy link
Member Author

mcuee commented Jan 24, 2023

Just want to mention that the issue is still present with latest version of libusb git HEAD and libusb-compat-0.1.

@tormodvolden
Copy link
Contributor

Does libusb-compat-0.1 use libusb_free_device_list() with unref_devices = true?

I guess it references all devices by running libusb_get_device_list() and then it must unref them all before calling libusb_exit().

@mcuee
Copy link
Member Author

mcuee commented Mar 31, 2023

Does libusb-compat-0.1 use libusb_free_device_list() with unref_devices = true?

I guess it references all devices by running libusb_get_device_list() and then it must unref them all before calling libusb_exit().

Yes libusb-compat-0.1 uses libusb_get_device_list(ctx, &dev_list) and then uses the matching libusb_free_device_list(dev_list, 1).

Code here: I do not see anything obviously wrong myself.
https://github.com/libusb/libusb-compat-0.1/blob/master/libusb/core.c

The only thing I am thinking of is to do more clean up in usb_close in case the reference count is not zero.

@mcuee
Copy link
Member Author

mcuee commented Mar 31, 2023

The following simple addition to libusb debug log seems to help a bit. We can see device reference count is not zero in the end.

diff --git a/libusb/core.c b/libusb/core.c
index 17e61172..5a7680e8 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -1272,6 +1272,7 @@ libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev)
        long refcnt;

        refcnt = usbi_atomic_inc(&dev->refcnt);
+       usbi_dbg(DEVICE_CTX(dev), "Device %d.%d reference count increased to %ld", dev->bus_number, dev->device_address, refcnt);
        assert(refcnt >= 2);

        return dev;
@@ -1290,6 +1291,7 @@ void API_EXPORTED libusb_unref_device(libusb_device *dev)
                return;

        refcnt = usbi_atomic_dec(&dev->refcnt);
+       usbi_dbg(DEVICE_CTX(dev), "Device %d.%d reference count decreased to %ld", dev->bus_number, dev->device_address, refcnt);
        assert(refcnt >= 0);

        if (refcnt == 0) {
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 34620df0..08af623b 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11791
+#define LIBUSB_NANO 22791

You can refer to the following debug log, under Windows.

click for debug log
MINGW64 /c/work/libusb/libusb_test/libusb_issue1165
$ ./examples/listdevs.exe
8087:0026 (bus 1, device 2) path: 10
04f2:b6dd (bus 1, device 5) path: 5
1c7a:0575 (bus 1, device 3) path: 7
8086:a0ed (bus 1, device 0)
046d:c52b (bus 1, device 1) path: 3
8086:9a13 (bus 2, device 0)

MINGW64 /c/work/libusb/libusb-compat
$ export LIBUSB_DEBUG=4
MINGW64 /c/work/libusb/libusb-compat
$ ./examples/lsusb.exe
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.001253] [000042c4] libusb: debug [libusb_init_context] libusb v1.0.26.22791
[ 0.001575] [000042c4] libusb: debug [usbi_add_event_source] add HANDLE 0000000000000058 events 0
[ 0.001786] [000042c4] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.001979] [000042c4] libusb: debug [usbi_add_event_source] add HANDLE 00000000000000b4 events 0
[ 0.002320] [000042c4] libusb: debug [get_windows_version] Windows 11 64-bit
[ 0.002544] [000042c4] libusb: debug [htab_create] using 1021 entries hash table
[ 0.004222] [000042c4] libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
[ 0.006071] [000042c4] libusb: debug [winusbx_init] libusbK DLL found, version: 3.1.0.0
[ 0.008052] [000042c4] libusb: info [windows_init] UsbDk backend is not available
[ 0.008179] [000042c4] libusb: debug [libusb_init_context] installing new context as implicit default
[ 0.008248] [000042c4] libusb: debug [libusb_get_device_list]
[ 0.008277] [00001d70] libusb: debug [windows_iocp_thread] I/O completion thread started
[ 0.016356] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [5]
[ 0.016500] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [6]
[ 0.016960] [000042c4] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.017055] [000042c4] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.017122] [000042c4] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.017178] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [1C]
[ 0.017368] [000042c4] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.017445] [000042c4] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.017497] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [3C]
[ 0.017711] [000042c4] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.017778] [000042c4] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.017827] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [6C]
[ 0.017950] [000042c4] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.018017] [000042c4] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.018066] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [6D]
[ 0.018309] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.018375] [000042c4] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A0ED&SUBSYS_15451025&REV_20\3&11583659&0&A0' bus number 1
[ 0.018457] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 1
[ 0.018541] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.018599] [000042c4] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_9A13&SUBSYS_72708086&REV_01\3&11583659&0&68' bus number 2
[ 0.018667] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.019416] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 2
[ 0.019514] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.019567] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [3C]
[ 0.019729] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.019796] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.019874] [000042c4] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 10): 'USB\VID_8087&PID_0026\5&586B51A&0&10'
[ 0.019926] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 3
[ 0.020039] [000042c4] libusb: debug [winusb_get_device_list] extra GUID: {16126A05-3179-4589-9DB8-952AFFD297D5}
[ 0.020095] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 3
[ 0.020146] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.020194] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [6C]
[ 0.020281] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.020338] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 512 bytes)
[ 0.020392] [000042c4] libusb: debug [init_device] (bus: 1, addr: 5, depth: 1, port: 5): 'USB\VID_04F2&PID_B6DD\0001'
[ 0.020442] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 3
[ 0.020539] [000042c4] libusb: debug [winusb_get_device_list] extra GUID: {20348E47-A897-468E-9D0E-56307802FC2A}
[ 0.020592] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 4
[ 0.020640] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.020688] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [1C]
[ 0.020768] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.020822] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 46 bytes)
[ 0.020876] [000042c4] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 7): 'USB\VID_1C7A&PID_0575\077E2F9A'
[ 0.020931] [000042c4] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 3
[ 0.021051] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.021108] [000042c4] libusb: debug [libusb_unref_device] Device 0.0 reference count decreased to 1
[ 0.021220] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.021272] [000042c4] libusb: debug [libusb_unref_device] Device 0.0 reference count decreased to 1
[ 0.021375] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 5
[ 0.021502] [000042c4] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&12C539F&0&0' reports 16 ports
[ 0.021592] [000042c4] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&12C539F&0&0'
[ 0.021643] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 6
[ 0.021738] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 4
[ 0.021790] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 3
[ 0.021885] [000042c4] libusb: debug [winusb_get_device_list] extra GUID: {E421D5D8-BD56-AA84-7553-28C83FC89083}
[ 0.021937] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 7
[ 0.021986] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.022034] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [6D]
[ 0.022113] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.022167] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 84 bytes)
[ 0.022226] [000042c4] libusb: debug [init_device] (bus: 1, addr: 1, depth: 1, port: 3): 'USB\VID_046D&PID_C52B\5&586B51A&0&3'
[ 0.022286] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 3
[ 0.022402] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.022458] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.022567] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 2
[ 0.022684] [000042c4] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&1A63DC7C&0&0' reports 5 ports
[ 0.022762] [000042c4] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&1A63DC7C&0&0'
[ 0.022812] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 3
[ 0.023066] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL01\5&2F64DFEA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.023147] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.023196] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.023243] [000042c4] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C52B&MI_01&COL01#7&1119BFB4&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.023301] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.023373] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.023421] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.023527] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.023576] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.023657] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.023714] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.023789] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816\3&D2322F2&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.023873] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL02\5&2F64DFEA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.023950] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL03\5&2F64DFEA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.024026] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL04\5&2F64DFEA&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.024104] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&32CF90E6&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.024177] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.024225] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.024273] [000042c4] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL02\7&1119BFB4&0&0001
[ 0.024330] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.024397] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&32CF90E6&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.024468] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.024516] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.024563] [000042c4] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL03\7&1119BFB4&0&0002
[ 0.024620] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.024686] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\10251229\3&9D5D338&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.024763] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&32CF90E6&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.024839] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.024933] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.025003] [000042c4] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL04\7&1119BFB4&0&0003
[ 0.025071] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025141] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025186] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.025230] [000042c4] libusb: debug [set_composite_interface] interface[2] = \\?\HID#VID_046D&PID_C52B&MI_02&COL01#7&12BD7E0E&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.025283] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025341] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025415] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.025466] [000042c4] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL02\7&12BD7E0E&0&0001
[ 0.025524] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025589] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025634] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.025678] [000042c4] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL03\7&12BD7E0E&0&0002
[ 0.025756] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025819] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025864] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.025911] [000042c4] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C52B&MI_00#7&34F0FD76&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.025967] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.026495] [000042c4] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.026583] [000042c4] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.026636] [000042c4] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.026690] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 8
[ 0.026740] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 7
[ 0.027471] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 6
[ 0.027527] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 2
[ 0.027576] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 2
[ 0.027624] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 2
[ 0.027671] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 2
[ 0.027718] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 2
[ 0.027770] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.027823] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.027872] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.027920] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 5
[ 0.027969] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.028017] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.028066] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 2
[ 0.028114] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 2
[ 0.028161] [000042c4] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 2
[ 0.028208] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 6
[ 0.028255] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 2
[ 0.028303] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 2
[ 0.028350] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.028398] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.028445] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.028493] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 5
[ 0.028540] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.028587] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.028646] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 0
[ 0.028694] [000042c4] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.028741] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 4
[ 0.028794] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 0
[ 0.028842] [000042c4] libusb: debug [libusb_unref_device] destroy device 1.5
[ 0.028889] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 3
[ 0.028938] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 0
[ 0.028986] [000042c4] libusb: debug [libusb_unref_device] destroy device 1.3
[ 0.029032] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 2
[ 0.029083] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 1
[ 0.029132] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 0
[ 0.029180] [000042c4] libusb: debug [libusb_unref_device] destroy device 1.1
[ 0.029228] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 0
[ 0.029284] [000042c4] libusb: debug [libusb_unref_device] destroy device 1.0
[ 0.029336] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 0
[ 0.029386] [000042c4] libusb: debug [libusb_unref_device] destroy device 2.0
[ 0.029436] [000042c4] libusb: debug [libusb_get_device_list]
[ 0.035961] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [5]
[ 0.036250] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [6]
[ 0.036698] [000042c4] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.036826] [000042c4] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.036878] [000042c4] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.036927] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [1C]
[ 0.037163] [000042c4] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.037241] [000042c4] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.037294] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [3C]
[ 0.037530] [000042c4] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.037606] [000042c4] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.037660] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [6C]
[ 0.037783] [000042c4] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.037849] [000042c4] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.037897] [000042c4] libusb: debug [winusb_get_device_list] allocating new device for session [6D]
[ 0.038107] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.038156] [000042c4] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A0ED&SUBSYS_15451025&REV_20\3&11583659&0&A0' bus number 1
[ 0.038211] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 1
[ 0.038274] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.038322] [000042c4] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_9A13&SUBSYS_72708086&REV_01\3&11583659&0&68' bus number 2
[ 0.038372] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.039057] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 2
[ 0.039161] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.039210] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [3C]
[ 0.039314] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.039372] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.039429] [000042c4] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 10): 'USB\VID_8087&PID_0026\5&586B51A&0&10'
[ 0.039479] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 3
[ 0.039576] [000042c4] libusb: debug [winusb_get_device_list] extra GUID: {16126A05-3179-4589-9DB8-952AFFD297D5}
[ 0.039629] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 3
[ 0.039677] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.039724] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [6C]
[ 0.039805] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.039859] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 512 bytes)
[ 0.039929] [000042c4] libusb: debug [init_device] (bus: 1, addr: 5, depth: 1, port: 5): 'USB\VID_04F2&PID_B6DD\0001'
[ 0.039989] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 3
[ 0.040100] [000042c4] libusb: debug [winusb_get_device_list] extra GUID: {20348E47-A897-468E-9D0E-56307802FC2A}
[ 0.040160] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 4
[ 0.040216] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.040264] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [1C]
[ 0.040347] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.040402] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 46 bytes)
[ 0.040456] [000042c4] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 7): 'USB\VID_1C7A&PID_0575\077E2F9A'
[ 0.040506] [000042c4] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 3
[ 0.040601] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.040650] [000042c4] libusb: debug [libusb_unref_device] Device 0.0 reference count decreased to 1
[ 0.040739] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.040788] [000042c4] libusb: debug [libusb_unref_device] Device 0.0 reference count decreased to 1
[ 0.040887] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 5
[ 0.040994] [000042c4] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&12C539F&0&0' reports 16 ports
[ 0.041082] [000042c4] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&12C539F&0&0'
[ 0.041134] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 6
[ 0.041228] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 4
[ 0.041277] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 3
[ 0.041376] [000042c4] libusb: debug [winusb_get_device_list] extra GUID: {E421D5D8-BD56-AA84-7553-28C83FC89083}
[ 0.041436] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 7
[ 0.041486] [000042c4] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.041534] [000042c4] libusb: debug [winusb_get_device_list] found existing device for session [6D]
[ 0.041616] [000042c4] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.041674] [000042c4] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 84 bytes)
[ 0.041728] [000042c4] libusb: debug [init_device] (bus: 1, addr: 1, depth: 1, port: 3): 'USB\VID_046D&PID_C52B\5&586B51A&0&3'
[ 0.041777] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 3
[ 0.041867] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.041917] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.042012] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 2
[ 0.042116] [000042c4] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&1A63DC7C&0&0' reports 5 ports
[ 0.042178] [000042c4] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&1A63DC7C&0&0'
[ 0.042227] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 3
[ 0.042427] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL01\5&2F64DFEA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.042504] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.042555] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.042605] [000042c4] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C52B&MI_01&COL01#7&1119BFB4&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.042665] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.042737] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.042785] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.042890] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.042938] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.043006] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.043054] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.043119] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816\3&D2322F2&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.043197] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL02\5&2F64DFEA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.043273] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL03\5&2F64DFEA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.043350] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL04\5&2F64DFEA&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.043427] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&32CF90E6&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.043498] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.043546] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.043593] [000042c4] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL02\7&1119BFB4&0&0001
[ 0.043650] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.043721] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&32CF90E6&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.043792] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.043840] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.043887] [000042c4] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL03\7&1119BFB4&0&0002
[ 0.043946] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.044021] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\10251229\3&9D5D338&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.044116] [000042c4] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&32CF90E6&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.044191] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.044239] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.044287] [000042c4] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL04\7&1119BFB4&0&0003
[ 0.044345] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.044409] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.044457] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.044504] [000042c4] libusb: debug [set_composite_interface] interface[2] = \\?\HID#VID_046D&PID_C52B&MI_02&COL01#7&12BD7E0E&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.044561] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.044621] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.044669] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.044716] [000042c4] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL02\7&12BD7E0E&0&0001
[ 0.044773] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.044833] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.044881] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.044929] [000042c4] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL03\7&12BD7E0E&0&0002
[ 0.045008] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.045117] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.045173] [000042c4] libusb: debug [winusb_get_device_list] setting composite interface for [6D]:
[ 0.045221] [000042c4] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C52B&MI_00#7&34F0FD76&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.045277] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.045779] [000042c4] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.045857] [000042c4] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.045904] [000042c4] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.045953] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 8
[ 0.046001] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 7
[ 0.046729] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 6
[ 0.046788] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 2
[ 0.046852] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 2
[ 0.046912] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 2
[ 0.046961] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 2
[ 0.047011] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 2
[ 0.047059] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.047107] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.047155] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.047203] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 5
[ 0.047251] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.047299] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.047348] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 2
[ 0.047396] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 2
[ 0.047443] [000042c4] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 2
[ 0.047491] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 6
[ 0.047538] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 2
[ 0.047585] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 2
[ 0.047633] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.047680] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.047728] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.047775] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 5
[ 0.047822] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.047870] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.047930] [000042c4] libusb: debug [libusb_get_device_descriptor]
[ 0.047983] [000042c4] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.048042] [000042c4] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 2
[ 0.048094] [000042c4] libusb: debug [libusb_get_device_descriptor]
[ 0.048147] [000042c4] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.048197] [000042c4] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.048246] [000042c4] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 6
[ 0.048294] [000042c4] libusb: debug [libusb_get_device_descriptor]
[ 0.048342] [000042c4] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.048391] [000042c4] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 2
[ 0.048439] [000042c4] libusb: debug [libusb_get_device_descriptor]
[ 0.048486] [000042c4] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.048534] [000042c4] libusb: debug [parse_configuration] skipping descriptor 0xb
[ 0.048582] [000042c4] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.048642] [000042c4] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 2
[ 0.048691] [000042c4] libusb: debug [libusb_get_device_descriptor]
[ 0.048738] [000042c4] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.048795] [000042c4] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 2
[ 0.048844] [000042c4] libusb: debug [libusb_get_device_descriptor]
[ 0.048891] [000042c4] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.048939] [000042c4] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.048988] [000042c4] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 2
[ 0.049036] [000042c4] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.049083] [000042c4] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.049130] [000042c4] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.049177] [000042c4] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 5
[ 0.049225] [000042c4] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.049272] [000042c4] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
8087:0026
04f2:b6dd
1c7a:0575
8086:a0ed
046d:c52b
8086:9a13
[ 0.051910] [000042c4] libusb: debug [libusb_exit]
[ 0.052005] [000042c4] libusb: debug [usbi_remove_event_source] remove HANDLE 00000000000000b4
[ 0.052069] [000042c4] libusb: debug [usbi_remove_event_source] remove HANDLE 0000000000000058
[ 0.052123] [000042c4] libusb: warning [libusb_exit] device 1.1 still referenced
[ 0.052174] [000042c4] libusb: warning [libusb_exit] device 1.5 still referenced
[ 0.052223] [000042c4] libusb: warning [libusb_exit] device 1.2 still referenced
[ 0.052277] [000042c4] libusb: warning [libusb_exit] device 1.3 still referenced
[ 0.052339] [000042c4] libusb: warning [libusb_exit] device 2.0 still referenced
[ 0.052398] [000042c4] libusb: warning [libusb_exit] device 1.0 still referenced

@mcuee
Copy link
Member Author

mcuee commented Mar 31, 2023

As a comparison, the debug log for libusb's listdevs exmple is here (for Windows). We can see the device reference count is zero in the end. But the cleanup is towards the end.

click for debug log
MINGW64 /c/work/libusb/libusb_test/libusb_issue1165
$ ./examples/listdevs.exe
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.001054] [0000284c] libusb: debug [libusb_init_context] created default context
[ 0.001283] [0000284c] libusb: debug [libusb_init_context] libusb v1.0.26.22791
[ 0.001526] [0000284c] libusb: debug [usbi_add_event_source] add HANDLE 00000000000000b0 events 0
[ 0.001745] [0000284c] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.001881] [0000284c] libusb: debug [usbi_add_event_source] add HANDLE 00000000000000b4 events 0
[ 0.001931] [0000284c] libusb: debug [get_windows_version] Windows 11 64-bit
[ 0.001967] [0000284c] libusb: debug [htab_create] using 1021 entries hash table
[ 0.003504] [0000284c] libusb: info [winusbx_init] WinUSB DLL available (with isoch support)
[ 0.005170] [0000284c] libusb: debug [winusbx_init] libusbK DLL found, version: 3.1.0.0
[ 0.006927] [0000284c] libusb: info [windows_init] UsbDk backend is not available
[ 0.007030] [0000284c] libusb: debug [libusb_get_device_list]
[ 0.007107] [00001df8] libusb: debug [windows_iocp_thread] I/O completion thread started
[ 0.014435] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [5]
[ 0.014712] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [6]
[ 0.014855] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [7]
[ 0.014997] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [8]
[ 0.015497] [0000284c] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.015762] [0000284c] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.015902] [0000284c] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.016039] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [1E]
[ 0.016324] [0000284c] libusb: debug [get_api_type] driver(s): BTHUSB
[ 0.016488] [0000284c] libusb: debug [get_api_type] lower filter driver(s): ibtusb
[ 0.016628] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [3E]
[ 0.016931] [0000284c] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.017083] [0000284c] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.017202] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [70]
[ 0.017428] [0000284c] libusb: debug [get_api_type] driver(s): usbccgp
[ 0.017503] [0000284c] libusb: debug [get_api_type] matched driver name against Composite API
[ 0.017552] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [71]
[ 0.017728] [0000284c] libusb: debug [get_api_type] driver(s): USBSTOR
[ 0.017807] [0000284c] libusb: debug [winusb_get_device_list] allocating new device for session [72]
[ 0.018043] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.018088] [0000284c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_A0ED&SUBSYS_15451025&REV_20\3&11583659&0&A0' bus number 1
[ 0.018162] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 1
[ 0.018225] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.018276] [0000284c] libusb: debug [enumerate_hcd_root_hub] assigning HCD 'PCI\VEN_8086&DEV_9A13&SUBSYS_72708086&REV_01\3&11583659&0&68' bus number 2
[ 0.018328] [0000284c] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.018998] [0000284c] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 2
[ 0.019080] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.019127] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [5]
[ 0.019253] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.019309] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 31 bytes)
[ 0.019368] [0000284c] libusb: debug [init_device] (bus: 2, addr: 2, depth: 1, port: 2): 'USB\VID_05E3&PID_0612\5&1A00B1C&0&2'
[ 0.019418] [0000284c] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 3
[ 0.019522] [0000284c] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 4
[ 0.019572] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.019620] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [72]
[ 0.019709] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.019765] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 44 bytes)
[ 0.019820] [0000284c] libusb: debug [init_device] (bus: 2, addr: 3, depth: 2, port: 2): 'USB\VID_0781&PID_5591\0401D5032AFA44996ADA6E7FB56B51153C7D26AC8C49311D73C10CF96B01E67412E700000000000000000000DE646461000810189155810714AA1A5B'
[ 0.019883] [0000284c] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 3
[ 0.019974] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 2
[ 0.020024] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.020073] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [3E]
[ 0.020157] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.020217] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 200 bytes)
[ 0.020273] [0000284c] libusb: debug [init_device] (bus: 1, addr: 2, depth: 1, port: 10): 'USB\VID_8087&PID_0026\5&586B51A&0&10'
[ 0.020323] [0000284c] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 3
[ 0.020414] [0000284c] libusb: debug [winusb_get_device_list] extra GUID: {16126A05-3179-4589-9DB8-952AFFD297D5}
[ 0.020468] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 3
[ 0.020517] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.020660] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [70]
[ 0.020795] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.020867] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 512 bytes)
[ 0.020921] [0000284c] libusb: debug [init_device] (bus: 1, addr: 5, depth: 1, port: 5): 'USB\VID_04F2&PID_B6DD\0001'
[ 0.021039] [0000284c] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 3
[ 0.021149] [0000284c] libusb: debug [winusb_get_device_list] extra GUID: {20348E47-A897-468E-9D0E-56307802FC2A}
[ 0.021202] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 4
[ 0.021247] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.021291] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [1E]
[ 0.021370] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.021422] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 46 bytes)
[ 0.021472] [0000284c] libusb: debug [init_device] (bus: 1, addr: 3, depth: 1, port: 7): 'USB\VID_1C7A&PID_0575\077E2F9A'
[ 0.021517] [0000284c] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 3
[ 0.021610] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.021656] [0000284c] libusb: debug [libusb_unref_device] Device 0.0 reference count decreased to 1
[ 0.021744] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.021790] [0000284c] libusb: debug [libusb_unref_device] Device 0.0 reference count decreased to 1
[ 0.021889] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 5
[ 0.022041] [0000284c] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&12C539F&0&0' reports 16 ports
[ 0.022144] [0000284c] libusb: debug [init_device] (bus: 1, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&12C539F&0&0'
[ 0.022199] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 6
[ 0.022296] [0000284c] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 4
[ 0.022344] [0000284c] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 3
[ 0.022433] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 7
[ 0.022480] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.022526] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [8]
[ 0.022604] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.022657] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 41 bytes)
[ 0.022710] [0000284c] libusb: debug [init_device] (bus: 1, addr: 7, depth: 1, port: 2): 'USB\VID_05E3&PID_0610\5&586B51A&0&2'
[ 0.022757] [0000284c] libusb: debug [libusb_ref_device] Device 1.7 reference count increased to 3
[ 0.022845] [0000284c] libusb: debug [winusb_get_device_list] extra GUID: {E421D5D8-BD56-AA84-7553-28C83FC89083}
[ 0.022895] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 8
[ 0.022944] [0000284c] libusb: debug [libusb_ref_device] Device 0.0 reference count increased to 2
[ 0.022994] [0000284c] libusb: debug [winusb_get_device_list] found existing device for session [71]
[ 0.023084] [0000284c] libusb: debug [init_device] found 1 configurations (current config: 1)
[ 0.023149] [0000284c] libusb: debug [cache_config_descriptors] cached config descriptor 0 (bConfigurationValue=1, 84 bytes)
[ 0.023218] [0000284c] libusb: debug [init_device] (bus: 1, addr: 1, depth: 1, port: 3): 'USB\VID_046D&PID_C52B\5&586B51A&0&3'
[ 0.023265] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 3
[ 0.023376] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.023424] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.023523] [0000284c] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 3
[ 0.023650] [0000284c] libusb: debug [init_root_hub] root hub 'USB\ROOT_HUB30\4&1A63DC7C&0&0' reports 5 ports
[ 0.023722] [0000284c] libusb: debug [init_device] (bus: 2, addr: 0, depth: 0, port: 0): 'USB\ROOT_HUB30\4&1A63DC7C&0&0'
[ 0.023770] [0000284c] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 4
[ 0.024039] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL01\5&2F64DFEA&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.024118] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.024165] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.024212] [0000284c] libusb: debug [set_composite_interface] interface[1] = \\?\HID#VID_046D&PID_C52B&MI_01&COL01#7&1119BFB4&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.024268] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.024338] [0000284c] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.024383] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.024489] [0000284c] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.024534] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.024596] [0000284c] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 4
[ 0.024641] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 3
[ 0.024702] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\INTC816\3&D2322F2&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.024778] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL02\5&2F64DFEA&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.024855] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL03\5&2F64DFEA&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.024928] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\SYNA7DAB&COL04\5&2F64DFEA&0&0003' (non USB HID, newly connected, etc.) - ignoring
[ 0.025005] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL02\5&32CF90E6&0&0001' (non USB HID, newly connected, etc.) - ignoring
[ 0.025073] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025117] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.025162] [0000284c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL02\7&1119BFB4&0&0001
[ 0.025215] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025281] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL03\5&32CF90E6&0&0002' (non USB HID, newly connected, etc.) - ignoring
[ 0.025350] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025395] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.025439] [0000284c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL03\7&1119BFB4&0&0002
[ 0.025492] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025554] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\10251229\3&9D5D338&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.025642] [0000284c] libusb: debug [winusb_get_device_list] unlisted ancestor for 'HID\CONVERTEDDEVICE&COL01\5&32CF90E6&0&0000' (non USB HID, newly connected, etc.) - ignoring
[ 0.025709] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025754] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.025798] [0000284c] libusb: debug [set_composite_interface] interface[1] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_01&COL04\7&1119BFB4&0&0003
[ 0.025851] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.025909] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.025953] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.025998] [0000284c] libusb: debug [set_composite_interface] interface[2] = \\?\HID#VID_046D&PID_C52B&MI_02&COL01#7&12BD7E0E&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}
[ 0.026051] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.026108] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.026152] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.026196] [0000284c] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL02\7&12BD7E0E&0&0001
[ 0.026249] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.026308] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.026352] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.026396] [0000284c] libusb: debug [set_composite_interface] interface[2] already set - ignoring HID collection: HID\VID_046D&PID_C52B&MI_02&COL03\7&12BD7E0E&0&0002
[ 0.026449] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.026506] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 4
[ 0.026551] [0000284c] libusb: debug [winusb_get_device_list] setting composite interface for [71]:
[ 0.026595] [0000284c] libusb: debug [set_composite_interface] interface[0] = \\?\HID#VID_046D&PID_C52B&MI_00#7&34F0FD76&0&0000#{4D1E55B2-F16F-11CF-88CB-001111000030}\KBD
[ 0.026648] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 3
[ 0.027169] [0000284c] libusb: debug [get_api_type] driver(s): WUDFRd
[ 0.027266] [0000284c] libusb: debug [get_api_type] lower filter driver(s): WinUsb
[ 0.027311] [0000284c] libusb: debug [get_api_type] matched lower filter driver name against WinUSB
[ 0.027360] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 9
[ 0.027404] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 8
[ 0.028090] [0000284c] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 3
[ 0.028171] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 7
[ 0.028216] [0000284c] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 3
[ 0.028260] [0000284c] libusb: debug [libusb_unref_device] Device 1.7 reference count decreased to 2
[ 0.028304] [0000284c] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 2
[ 0.028349] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 2
[ 0.028394] [0000284c] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 2
[ 0.028438] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 2
[ 0.028482] [0000284c] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 2
[ 0.028529] [0000284c] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 2
[ 0.028573] [0000284c] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 1
[ 0.028617] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.028661] [0000284c] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.028705] [0000284c] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.028749] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 6
[ 0.028793] [0000284c] libusb: debug [libusb_unref_device] Device 1.7 reference count decreased to 1
[ 0.028837] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.028881] [0000284c] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 2
[ 0.028926] [0000284c] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 3
[ 0.028970] [0000284c] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 2
[ 0.029014] [0000284c] libusb: debug [libusb_ref_device] Device 1.2 reference count increased to 2
[ 0.029059] [0000284c] libusb: debug [libusb_ref_device] Device 1.5 reference count increased to 2
[ 0.029103] [0000284c] libusb: debug [libusb_ref_device] Device 1.3 reference count increased to 2
[ 0.029147] [0000284c] libusb: debug [libusb_ref_device] Device 1.0 reference count increased to 7
[ 0.029190] [0000284c] libusb: debug [libusb_ref_device] Device 1.7 reference count increased to 2
[ 0.029235] [0000284c] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 2
[ 0.029278] [0000284c] libusb: debug [libusb_ref_device] Device 2.0 reference count increased to 3
[ 0.029322] [0000284c] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 2
[ 0.029366] [0000284c] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 1
[ 0.029410] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 1
[ 0.029454] [0000284c] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 1
[ 0.029498] [0000284c] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 1
[ 0.029542] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 6
[ 0.029586] [0000284c] libusb: debug [libusb_unref_device] Device 1.7 reference count decreased to 1
[ 0.029630] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.029673] [0000284c] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 2
[ 0.029721] [0000284c] libusb: debug [libusb_get_device_descriptor]
05e3:0612 (bus 2, device 2) path: 2
[ 0.031390] [0000284c] libusb: debug [libusb_get_device_descriptor]
0781:5591 (bus 2, device 3) path: 2.2
[ 0.033482] [0000284c] libusb: debug [libusb_get_device_descriptor]
8087:0026 (bus 1, device 2) path: 10
[ 0.034821] [0000284c] libusb: debug [libusb_get_device_descriptor]
04f2:b6dd (bus 1, device 5) path: 5
[ 0.036091] [0000284c] libusb: debug [libusb_get_device_descriptor]
1c7a:0575 (bus 1, device 3) path: 7
[ 0.037359] [0000284c] libusb: debug [libusb_get_device_descriptor]
8086:a0ed (bus 1, device 0)
[ 0.038348] [0000284c] libusb: debug [libusb_get_device_descriptor]
05e3:0610 (bus 1, device 7) path: 2
[ 0.039594] [0000284c] libusb: debug [libusb_get_device_descriptor]
046d:c52b (bus 1, device 1) path: 3
[ 0.041059] [0000284c] libusb: debug [libusb_get_device_descriptor]
8086:9a13 (bus 2, device 0)
[ 0.042152] [0000284c] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 1
[ 0.042204] [0000284c] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 0
[ 0.042249] [0000284c] libusb: debug [libusb_unref_device] destroy device 2.3
[ 0.042308] [0000284c] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 0
[ 0.042449] [0000284c] libusb: debug [libusb_unref_device] destroy device 2.2
[ 0.042515] [0000284c] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 1
[ 0.042574] [0000284c] libusb: debug [libusb_unref_device] Device 1.2 reference count decreased to 0
[ 0.042621] [0000284c] libusb: debug [libusb_unref_device] destroy device 1.2
[ 0.042665] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 5
[ 0.042713] [0000284c] libusb: debug [libusb_unref_device] Device 1.5 reference count decreased to 0
[ 0.042757] [0000284c] libusb: debug [libusb_unref_device] destroy device 1.5
[ 0.042801] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 4
[ 0.042847] [0000284c] libusb: debug [libusb_unref_device] Device 1.3 reference count decreased to 0
[ 0.042891] [0000284c] libusb: debug [libusb_unref_device] destroy device 1.3
[ 0.042936] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 3
[ 0.042982] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 2
[ 0.043027] [0000284c] libusb: debug [libusb_unref_device] Device 1.7 reference count decreased to 0
[ 0.043072] [0000284c] libusb: debug [libusb_unref_device] destroy device 1.7
[ 0.043116] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 1
[ 0.043163] [0000284c] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 0
[ 0.043208] [0000284c] libusb: debug [libusb_unref_device] destroy device 1.1
[ 0.043252] [0000284c] libusb: debug [libusb_unref_device] Device 1.0 reference count decreased to 0
[ 0.043298] [0000284c] libusb: debug [libusb_unref_device] destroy device 1.0
[ 0.043346] [0000284c] libusb: debug [libusb_unref_device] Device 2.0 reference count decreased to 0
[ 0.043391] [0000284c] libusb: debug [libusb_unref_device] destroy device 2.0
[ 0.043437] [0000284c] libusb: debug [libusb_exit] destroying default context
[ 0.043489] [00001df8] libusb: debug [windows_iocp_thread] I/O completion thread exiting
[ 0.043876] [0000284c] libusb: debug [usbi_remove_event_source] remove HANDLE 00000000000000b4
[ 0.043949] [0000284c] libusb: debug [usbi_remove_event_source] remove HANDLE 00000000000000b0

@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2023

@tormodvolden and @hjelmn

Is this because libusb-compat-0.1 only does the clean up when libusb-1.0 dynamic library is unloaded as there is no usb_exit in libusb-0.1 API?

@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2023

Debug log for libusb-compat-0.1 lsusb example, under latest macOS Ventura 13.3, using my Mac Mini M1.

Again we can see there is no issue for libusb listdevs example but there is an issue for libusb-compat-0.1 lsusb example. But again the cleanup for libusb is towards the end.

click for debug log
mcuee@mcuees-Mac-mini test_issue1165 % ./lsusb
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000029] [000131cd] libusb: debug [libusb_init_context] libusb v1.0.26.11791
[ 0.000052] [000131cd] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000112] [000131d0] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000381] [000131d0] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000535] [000131cd] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf326c5572
[ 0.000582] [000131cd] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf326c5572
[ 0.003010] [000131cd] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003019] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003022] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003025] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003028] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003030] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003033] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003035] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003038] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003040] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003043] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003045] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003048] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003050] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003076] [000131cd] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003080] [000131cd] libusb: debug [process_new_device] allocating new device in context 0x14ef04420 for with session 0xf326c5572
[ 0.003085] [000131cd] libusb: debug [process_new_device] found device with address 11 port = 6 parent = 0x0 at 0x6000020c48ba
[ 0.003168] [000131cd] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf326d622f
[ 0.003201] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf326d622f/0x2200000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.003206] [000131cd] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf326d622f
[ 0.003457] [000131cd] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003463] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003466] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.003469] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003471] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003473] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003476] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003478] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003481] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.003484] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003486] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003489] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003491] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003494] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003510] [000131cd] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003514] [000131cd] libusb: debug [process_new_device] allocating new device in context 0x14ef04420 for with session 0xf326d622f
[ 0.003517] [000131cd] libusb: debug [process_new_device] found device with address 10 port = 2 parent = 0x0 at 0x6000020c4aba
[ 0.003595] [000131cd] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf328a0add
[ 0.003620] [000131cd] libusb: debug [darwin_get_cached_device] parent sessionID: 0xf326c5572
[ 0.003624] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf328a0add/0x2610000 against cached device with sessionID/locationID 0xf326d622f/0x2200000
[ 0.003627] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf328a0add/0x2610000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.003630] [000131cd] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf328a0add
[ 0.003850] [000131cd] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003855] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003858] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003860] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003863] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003865] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003868] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003870] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003873] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003875] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003878] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003880] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003883] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003885] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003902] [000131cd] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003905] [000131cd] libusb: debug [process_new_device] allocating new device in context 0x14ef04420 for with session 0xf328a0add
[ 0.003908] [000131cd] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 2
[ 0.003911] [000131cd] libusb: debug [process_new_device] found device with address 12 port = 1 parent = 0x600002ac4240 at 0x6000020c4bba
[ 0.003987] [000131cd] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf329dee3d
[ 0.004010] [000131cd] libusb: debug [darwin_get_cached_device] parent sessionID: 0xf328a0add
[ 0.004013] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf329dee3d/0x2611000 against cached device with sessionID/locationID 0xf328a0add/0x2610000
[ 0.004016] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf329dee3d/0x2611000 against cached device with sessionID/locationID 0xf326d622f/0x2200000
[ 0.004019] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf329dee3d/0x2611000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.004022] [000131cd] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf329dee3d
[ 0.004251] [000131cd] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004256] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004259] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.004261] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004264] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004266] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004269] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.004271] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.004274] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.004276] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.004279] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.004281] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.004284] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.004286] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004301] [000131cd] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004304] [000131cd] libusb: debug [process_new_device] allocating new device in context 0x14ef04420 for with session 0xf329dee3d
[ 0.004308] [000131cd] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 2
[ 0.004310] [000131cd] libusb: debug [process_new_device] found device with address 13 port = 1 parent = 0x600002ac4360 at 0x6000020c4cba
[ 0.004377] [000131cd] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf32b3f686
[ 0.004405] [000131cd] libusb: debug [darwin_get_cached_device] parent sessionID: 0xf326d622f
[ 0.004408] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf329dee3d/0x2611000
[ 0.004412] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf328a0add/0x2610000
[ 0.004415] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf326d622f/0x2200000
[ 0.004418] [000131cd] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.004421] [000131cd] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf32b3f686
[ 0.004627] [000131cd] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004631] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004633] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.004635] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004637] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004639] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.004641] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004644] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.004646] [000131cd] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.004648] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.004650] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004652] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004654] [000131cd] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004656] [000131cd] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004668] [000131cd] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004670] [000131cd] libusb: debug [process_new_device] allocating new device in context 0x14ef04420 for with session 0xf32b3f686
[ 0.004673] [000131cd] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 2
[ 0.004675] [000131cd] libusb: debug [process_new_device] found device with address 14 port = 1 parent = 0x600002ac4300 at 0x6000020c4dba
[ 0.004683] [000131cd] libusb: debug [libusb_init_context] installing new context as implicit default
[ 0.004687] [000131cd] libusb: debug [libusb_get_device_list]  
[ 0.004710] [000131cd] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 2
[ 0.004713] [000131cd] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 2
[ 0.004715] [000131cd] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 3
[ 0.004718] [000131cd] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 3
[ 0.004720] [000131cd] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 3
[ 0.004722] [000131cd] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 3
[ 0.004724] [000131cd] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 3
[ 0.004726] [000131cd] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 4
[ 0.004728] [000131cd] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 4
[ 0.004731] [000131cd] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 4
[ 0.004733] [000131cd] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 2
[ 0.004735] [000131cd] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 2
[ 0.004737] [000131cd] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 3
[ 0.004740] [000131cd] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 3
[ 0.004742] [000131cd] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 3
[ 0.004746] [000131cd] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 1
[ 0.004748] [000131cd] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 1
[ 0.004751] [000131cd] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 2
[ 0.004753] [000131cd] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 2
[ 0.004755] [000131cd] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 2
[ 0.004757] [000131cd] libusb: debug [libusb_get_device_list]  
[ 0.004768] [000131cd] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 2
[ 0.004770] [000131cd] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 2
[ 0.004773] [000131cd] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 3
[ 0.004775] [000131cd] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 3
[ 0.004896] [000131cd] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 3
[ 0.004904] [000131cd] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 3
[ 0.004907] [000131cd] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 3
[ 0.004910] [000131cd] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 4
[ 0.004912] [000131cd] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 4
[ 0.004914] [000131cd] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 4
[ 0.004916] [000131cd] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 2
[ 0.004919] [000131cd] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 2
[ 0.004922] [000131cd] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 3
[ 0.004924] [000131cd] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 3
[ 0.004927] [000131cd] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 3
[ 0.004938] [000131cd] libusb: debug [libusb_get_device_descriptor]  
[ 0.004940] [000131cd] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004945] [000131cd] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.004950] [000131cd] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 4
[ 0.004952] [000131cd] libusb: debug [libusb_get_device_descriptor]  
[ 0.004954] [000131cd] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004958] [000131cd] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 4
[ 0.004961] [000131cd] libusb: debug [libusb_get_device_descriptor]  
[ 0.004963] [000131cd] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004965] [000131cd] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.004967] [000131cd] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 4
[ 0.004970] [000131cd] libusb: debug [libusb_get_device_descriptor]  
[ 0.004972] [000131cd] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004974] [000131cd] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.004976] [000131cd] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.004979] [000131cd] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 3
[ 0.004981] [000131cd] libusb: debug [libusb_get_device_descriptor]  
[ 0.004983] [000131cd] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004987] [000131cd] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 3
[ 0.004989] [000131cd] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 2
[ 0.004992] [000131cd] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 2
[ 0.004994] [000131cd] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 3
[ 0.004997] [000131cd] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 3
[ 0.004999] [000131cd] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 3
0bda:5411
05e3:0749
0bda:0411
0bda:5411
0bda:0411
[ 0.005023] [000131cd] libusb: debug [libusb_exit]  
[ 0.005026] [000131cd] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 1
[ 0.005028] [000131cd] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 1
[ 0.005031] [000131cd] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 2
[ 0.005033] [000131cd] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 2
[ 0.005035] [000131cd] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 2
[ 0.005053] [000131d0] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 0.005161] [000131cd] libusb: error [darwin_cleanup_devices] device still referenced at libusb_exit
[ 0.005170] [000131cd] libusb: error [darwin_cleanup_devices] device still referenced at libusb_exit
[ 0.005172] [000131cd] libusb: error [darwin_cleanup_devices] device still referenced at libusb_exit
[ 0.005175] [000131cd] libusb: error [darwin_cleanup_devices] device still referenced at libusb_exit
[ 0.005177] [000131cd] libusb: error [darwin_cleanup_devices] device still referenced at libusb_exit
[ 0.005179] [000131cd] libusb: debug [usbi_remove_event_source] remove fd 3
[ 0.005189] [000131cd] libusb: warning [libusb_exit] device 2.14 still referenced
[ 0.005191] [000131cd] libusb: warning [libusb_exit] device 2.13 still referenced
[ 0.005193] [000131cd] libusb: warning [libusb_exit] device 2.12 still referenced
[ 0.005195] [000131cd] libusb: warning [libusb_exit] device 2.10 still referenced
[ 0.005197] [000131cd] libusb: warning [libusb_exit] device 2.11 still referenced

Comparison with the debug log for libusb-1.0 listdevs.

click for the debug log

mcuee@mcuees-Mac-mini libusb_issue1165 % ./examples/listdevs 
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000052] [00013f29] libusb: debug [libusb_init_context] created default context
[ 0.000059] [00013f29] libusb: debug [libusb_init_context] libusb v1.0.26.11791
[ 0.000078] [00013f29] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000156] [00013f2b] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000421] [00013f2b] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000622] [00013f29] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf326c5572
[ 0.000676] [00013f29] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf326c5572
[ 0.003218] [00013f29] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003227] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003230] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.003233] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003235] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003238] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.003240] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.003243] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003246] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.003248] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003250] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003253] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003255] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003258] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003280] [00013f29] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003284] [00013f29] libusb: debug [process_new_device] allocating new device in context 0x159e04bd0 for with session 0xf326c5572
[ 0.003289] [00013f29] libusb: debug [process_new_device] found device with address 11 port = 6 parent = 0x0 at 0x600003cc4e3a
[ 0.003364] [00013f29] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf326d622f
[ 0.003400] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf326d622f/0x2200000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.003404] [00013f29] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf326d622f
[ 0.003648] [00013f29] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.003655] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.003658] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.003660] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.003664] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.003666] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.003669] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.003671] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.003674] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.003676] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.003679] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.003681] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.003684] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.003686] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.003703] [00013f29] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.003706] [00013f29] libusb: debug [process_new_device] allocating new device in context 0x159e04bd0 for with session 0xf326d622f
[ 0.003710] [00013f29] libusb: debug [process_new_device] found device with address 10 port = 2 parent = 0x0 at 0x600003cc503a
[ 0.003775] [00013f29] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf328a0add
[ 0.003800] [00013f29] libusb: debug [darwin_get_cached_device] parent sessionID: 0xf326c5572
[ 0.003803] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf328a0add/0x2610000 against cached device with sessionID/locationID 0xf326d622f/0x2200000
[ 0.003806] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf328a0add/0x2610000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.003810] [00013f29] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf328a0add
[ 0.004020] [00013f29] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004026] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004028] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.004031] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004034] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004036] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.004039] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.004041] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.004044] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.004046] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.004049] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004051] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004054] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004056] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004072] [00013f29] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004075] [00013f29] libusb: debug [process_new_device] allocating new device in context 0x159e04bd0 for with session 0xf328a0add
[ 0.004078] [00013f29] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 2
[ 0.004081] [00013f29] libusb: debug [process_new_device] found device with address 12 port = 1 parent = 0x6000036c4240 at 0x600003cc513a
[ 0.004143] [00013f29] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf329dee3d
[ 0.004167] [00013f29] libusb: debug [darwin_get_cached_device] parent sessionID: 0xf328a0add
[ 0.004171] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf329dee3d/0x2611000 against cached device with sessionID/locationID 0xf328a0add/0x2610000
[ 0.004174] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf329dee3d/0x2611000 against cached device with sessionID/locationID 0xf326d622f/0x2200000
[ 0.004177] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf329dee3d/0x2611000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.004180] [00013f29] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf329dee3d
[ 0.004391] [00013f29] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004397] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004399] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.004402] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.004405] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004407] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.004410] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.004412] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.004415] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.004417] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.004420] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.004423] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.004425] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.004427] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004442] [00013f29] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004445] [00013f29] libusb: debug [process_new_device] allocating new device in context 0x159e04bd0 for with session 0xf329dee3d
[ 0.004448] [00013f29] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 2
[ 0.004452] [00013f29] libusb: debug [process_new_device] found device with address 13 port = 1 parent = 0x6000036c4300 at 0x600003cc523a
[ 0.004517] [00013f29] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0xf32b3f686
[ 0.004540] [00013f29] libusb: debug [darwin_get_cached_device] parent sessionID: 0xf326d622f
[ 0.004544] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf329dee3d/0x2611000
[ 0.004547] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf328a0add/0x2610000
[ 0.004550] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf326d622f/0x2200000
[ 0.004553] [00013f29] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0xf32b3f686/0x2210000 against cached device with sessionID/locationID 0xf326c5572/0x2600000
[ 0.004556] [00013f29] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0xf32b3f686
[ 0.004756] [00013f29] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.004761] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.004764] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.004767] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.004769] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.004772] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.004774] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.004777] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.004779] [00013f29] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.004782] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.004784] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.004787] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.004790] [00013f29] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.004792] [00013f29] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.004807] [00013f29] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.004810] [00013f29] libusb: debug [process_new_device] allocating new device in context 0x159e04bd0 for with session 0xf32b3f686
[ 0.004813] [00013f29] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 2
[ 0.004816] [00013f29] libusb: debug [process_new_device] found device with address 14 port = 1 parent = 0x6000036c42a0 at 0x600003cc533a
[ 0.004826] [00013f29] libusb: debug [libusb_get_device_list]  
[ 0.004855] [00013f29] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 2
[ 0.004858] [00013f29] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 2
[ 0.004861] [00013f29] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 3
[ 0.004863] [00013f29] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 3
[ 0.004866] [00013f29] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 3
[ 0.004869] [00013f29] libusb: debug [libusb_ref_device] Device 2.14 reference count increased to 3
[ 0.004871] [00013f29] libusb: debug [libusb_ref_device] Device 2.13 reference count increased to 3
[ 0.004874] [00013f29] libusb: debug [libusb_ref_device] Device 2.12 reference count increased to 4
[ 0.004877] [00013f29] libusb: debug [libusb_ref_device] Device 2.10 reference count increased to 4
[ 0.004879] [00013f29] libusb: debug [libusb_ref_device] Device 2.11 reference count increased to 4
[ 0.004882] [00013f29] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 2
[ 0.004885] [00013f29] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 2
[ 0.004888] [00013f29] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 3
[ 0.004890] [00013f29] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 3
[ 0.004893] [00013f29] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 3
[ 0.004896] [00013f29] libusb: debug [libusb_get_device_descriptor]  
0bda:5411 (bus 2, device 14) path: 2.1
[ 0.004910] [00013f29] libusb: debug [libusb_get_device_descriptor]  
05e3:0749 (bus 2, device 13) path: 6.1.1
[ 0.004916] [00013f29] libusb: debug [libusb_get_device_descriptor]  
0bda:0411 (bus 2, device 12) path: 6.1
[ 0.004921] [00013f29] libusb: debug [libusb_get_device_descriptor]  
0bda:5411 (bus 2, device 10) path: 2
[ 0.005029] [00013f29] libusb: debug [libusb_get_device_descriptor]  
0bda:0411 (bus 2, device 11) path: 6
[ 0.005041] [00013f29] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 1
[ 0.005045] [00013f29] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 1
[ 0.005049] [00013f29] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 2
[ 0.005052] [00013f29] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 2
[ 0.005055] [00013f29] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 2
[ 0.005058] [00013f29] libusb: debug [libusb_exit] destroying default context
[ 0.005061] [00013f29] libusb: debug [libusb_unref_device] Device 2.14 reference count decreased to 0
[ 0.005064] [00013f29] libusb: debug [libusb_unref_device] destroy device 2.14
[ 0.005067] [00013f29] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 1
[ 0.005070] [00013f29] libusb: debug [libusb_unref_device] Device 2.13 reference count decreased to 0
[ 0.005073] [00013f29] libusb: debug [libusb_unref_device] destroy device 2.13
[ 0.005076] [00013f29] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 1
[ 0.005078] [00013f29] libusb: debug [libusb_unref_device] Device 2.12 reference count decreased to 0
[ 0.005081] [00013f29] libusb: debug [libusb_unref_device] destroy device 2.12
[ 0.005084] [00013f29] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 1
[ 0.005088] [00013f29] libusb: debug [libusb_unref_device] Device 2.10 reference count decreased to 0
[ 0.005091] [00013f29] libusb: debug [libusb_unref_device] destroy device 2.10
[ 0.005093] [00013f29] libusb: debug [libusb_unref_device] Device 2.11 reference count decreased to 0
[ 0.005096] [00013f29] libusb: debug [libusb_unref_device] destroy device 2.11
[ 0.005117] [00013f2b] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 0.005849] [00013f29] libusb: debug [usbi_remove_event_source] remove fd 3

@mcuee
Copy link
Member Author

mcuee commented Apr 1, 2023

The following patch to libusb-compat-0.1 seems to fix the issue. My thought is that libusb will handle the device ref and unref so there should not be handling required by libusb-compat-0.1. But I am not so sure if this is the right fix.

I have only tested under Linux as of now.
Edit: the patch also works under Windows.

But the code has been there since the initial commit of libusb-compat-0.1 back one May 4, 2008.
libusb/libusb-compat-0.1@7d7cb91#diff-c1f9bc250077d41456a3e580fca0ddf5d8c25b741bff6d9b9505990a8b70b254

mcuee@UbuntuSwift3:~/build/libusb-compat-0.1$ git diff
diff --git a/libusb/core.c b/libusb/core.c
index 3bc9c25..09068f3 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -584,14 +584,12 @@ static int initialize_device(struct usb_device *dev)
        dev->num_children = 0;
        dev->children = NULL;
 
-       libusb_ref_device(newlib_dev);
        return 0;
 }
 
 static void free_device(struct usb_device *dev)
 {
        clear_device(dev);
-       libusb_unref_device(dev->dev);
        free(dev);
 }

Debug log under Linux for reference. We can see now the bahavior of libusb-compat-0.1 is similar to libusb.

click for the debug log
mcuee@UbuntuSwift3:~/build/libusb-compat-0.1$ export LIBUSB_DEBUG=4
mcuee@UbuntuSwift3:~/build/libusb-compat-0.1$ ./examples/lsusb 
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000028] [0000820a] libusb: debug [libusb_init_context] libusb v1.0.26.11791
[ 0.000056] [0000820a] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000064] [0000820a] libusb: debug [usbi_io_init] using timer for timeouts
[ 0.000068] [0000820a] libusb: debug [usbi_add_event_source] add fd 4 events 1
[ 0.000090] [0000820a] libusb: debug [get_kernel_version] reported kernel version is 5.15.10-051510-generic
[ 0.000123] [0000820a] libusb: debug [op_init] found usbfs at /dev/bus/usb
[ 0.000129] [0000820a] libusb: debug [op_init] max iso packet length is (likely) 98304 bytes
[ 0.000138] [0000820a] libusb: debug [op_init] sysfs is available
[ 0.000585] [00008218] libusb: debug [linux_udev_event_thread_main] udev event thread entering
[ 0.004205] [0000820a] libusb: debug [linux_get_device_address] getting address for device: usb1 detached: 0
[ 0.004209] [0000820a] libusb: debug [linux_get_device_address] scan usb1
[ 0.004222] [0000820a] libusb: debug [linux_get_device_address] bus=1 dev=1
[ 0.004224] [0000820a] libusb: debug [linux_enumerate_device] busnum 1 devaddr 1 session_id 257
[ 0.004226] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 1/1 (session 257)
[ 0.004290] [0000820a] libusb: debug [linux_get_device_address] getting address for device: usb2 detached: 0
[ 0.004292] [0000820a] libusb: debug [linux_get_device_address] scan usb2
[ 0.004300] [0000820a] libusb: debug [linux_get_device_address] bus=2 dev=1
[ 0.004301] [0000820a] libusb: debug [linux_enumerate_device] busnum 2 devaddr 1 session_id 513
[ 0.004303] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 2/1 (session 513)
[ 0.004343] [0000820a] libusb: debug [linux_get_device_address] getting address for device: 2-1 detached: 0
[ 0.004345] [0000820a] libusb: debug [linux_get_device_address] scan 2-1
[ 0.004354] [0000820a] libusb: debug [linux_get_device_address] bus=2 dev=2
[ 0.004356] [0000820a] libusb: debug [linux_enumerate_device] busnum 2 devaddr 2 session_id 514
[ 0.004357] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 2/2 (session 514)
[ 0.004367] [0000820a] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 2
[ 0.004368] [0000820a] libusb: debug [linux_get_parent_info] dev 0x561311e23ab0 (2-1) has parent 0x561311e235a0 (usb2) port 1
[ 0.004408] [0000820a] libusb: debug [linux_get_device_address] getting address for device: usb3 detached: 0
[ 0.004409] [0000820a] libusb: debug [linux_get_device_address] scan usb3
[ 0.004432] [0000820a] libusb: debug [linux_get_device_address] bus=3 dev=1
[ 0.004433] [0000820a] libusb: debug [linux_enumerate_device] busnum 3 devaddr 1 session_id 769
[ 0.004434] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 3/1 (session 769)
[ 0.004475] [0000820a] libusb: debug [linux_get_device_address] getting address for device: 3-10 detached: 0
[ 0.004478] [0000820a] libusb: debug [linux_get_device_address] scan 3-10
[ 0.004488] [0000820a] libusb: debug [linux_get_device_address] bus=3 dev=6
[ 0.004490] [0000820a] libusb: debug [linux_enumerate_device] busnum 3 devaddr 6 session_id 774
[ 0.004492] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 3/6 (session 774)
[ 0.004503] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 2
[ 0.004506] [0000820a] libusb: debug [linux_get_parent_info] dev 0x561311e23890 (3-10) has parent 0x561311e22e30 (usb3) port 10
[ 0.004542] [0000820a] libusb: debug [linux_get_device_address] getting address for device: 3-2 detached: 0
[ 0.004544] [0000820a] libusb: debug [linux_get_device_address] scan 3-2
[ 0.004553] [0000820a] libusb: debug [linux_get_device_address] bus=3 dev=2
[ 0.004555] [0000820a] libusb: debug [linux_enumerate_device] busnum 3 devaddr 2 session_id 770
[ 0.004557] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 3/2 (session 770)
[ 0.004566] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 3
[ 0.004567] [0000820a] libusb: debug [linux_get_parent_info] dev 0x561311e02200 (3-2) has parent 0x561311e22e30 (usb3) port 2
[ 0.004601] [0000820a] libusb: debug [linux_get_device_address] getting address for device: 3-3 detached: 0
[ 0.004603] [0000820a] libusb: debug [linux_get_device_address] scan 3-3
[ 0.004612] [0000820a] libusb: debug [linux_get_device_address] bus=3 dev=3
[ 0.004614] [0000820a] libusb: debug [linux_enumerate_device] busnum 3 devaddr 3 session_id 771
[ 0.004615] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 3/3 (session 771)
[ 0.004625] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 4
[ 0.004627] [0000820a] libusb: debug [linux_get_parent_info] dev 0x561311e02620 (3-3) has parent 0x561311e22e30 (usb3) port 3
[ 0.004661] [0000820a] libusb: debug [linux_get_device_address] getting address for device: 3-5 detached: 0
[ 0.004663] [0000820a] libusb: debug [linux_get_device_address] scan 3-5
[ 0.004671] [0000820a] libusb: debug [linux_get_device_address] bus=3 dev=4
[ 0.004673] [0000820a] libusb: debug [linux_enumerate_device] busnum 3 devaddr 4 session_id 772
[ 0.004675] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 3/4 (session 772)
[ 0.004685] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 5
[ 0.004687] [0000820a] libusb: debug [linux_get_parent_info] dev 0x561311e02a40 (3-5) has parent 0x561311e22e30 (usb3) port 5
[ 0.004729] [0000820a] libusb: debug [linux_get_device_address] getting address for device: 3-7 detached: 0
[ 0.004731] [0000820a] libusb: debug [linux_get_device_address] scan 3-7
[ 0.004742] [0000820a] libusb: debug [linux_get_device_address] bus=3 dev=5
[ 0.004743] [0000820a] libusb: debug [linux_enumerate_device] busnum 3 devaddr 5 session_id 773
[ 0.004746] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 3/5 (session 773)
[ 0.004756] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 6
[ 0.004758] [0000820a] libusb: debug [linux_get_parent_info] dev 0x561311e02e40 (3-7) has parent 0x561311e22e30 (usb3) port 7
[ 0.004792] [0000820a] libusb: debug [linux_get_device_address] getting address for device: usb4 detached: 0
[ 0.004794] [0000820a] libusb: debug [linux_get_device_address] scan usb4
[ 0.004804] [0000820a] libusb: debug [linux_get_device_address] bus=4 dev=1
[ 0.004806] [0000820a] libusb: debug [linux_enumerate_device] busnum 4 devaddr 1 session_id 1025
[ 0.004809] [0000820a] libusb: debug [linux_enumerate_device] allocating new device for 4/1 (session 1025)
[ 0.004846] [0000820a] libusb: debug [libusb_init_context] installing new context as implicit default
[ 0.004849] [0000820a] libusb: debug [libusb_get_device_list]  
[ 0.004855] [0000820a] libusb: debug [libusb_ref_device] Device 4.1 reference count increased to 2
[ 0.004857] [0000820a] libusb: debug [libusb_ref_device] Device 3.5 reference count increased to 2
[ 0.004859] [0000820a] libusb: debug [libusb_ref_device] Device 3.4 reference count increased to 2
[ 0.004862] [0000820a] libusb: debug [libusb_ref_device] Device 3.3 reference count increased to 2
[ 0.004864] [0000820a] libusb: debug [libusb_ref_device] Device 3.2 reference count increased to 2
[ 0.004867] [0000820a] libusb: debug [libusb_ref_device] Device 3.6 reference count increased to 2
[ 0.004869] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 7
[ 0.004872] [0000820a] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 2
[ 0.004874] [0000820a] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 3
[ 0.004876] [0000820a] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 2
[ 0.004878] [0000820a] libusb: debug [libusb_ref_device] Device 4.1 reference count increased to 3
[ 0.004880] [0000820a] libusb: debug [libusb_ref_device] Device 3.5 reference count increased to 3
[ 0.004882] [0000820a] libusb: debug [libusb_ref_device] Device 3.4 reference count increased to 3
[ 0.004884] [0000820a] libusb: debug [libusb_ref_device] Device 3.3 reference count increased to 3
[ 0.004886] [0000820a] libusb: debug [libusb_ref_device] Device 3.2 reference count increased to 3
[ 0.004888] [0000820a] libusb: debug [libusb_ref_device] Device 3.6 reference count increased to 3
[ 0.004890] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 8
[ 0.004892] [0000820a] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 3
[ 0.004894] [0000820a] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 4
[ 0.004895] [0000820a] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 3
[ 0.004897] [0000820a] libusb: debug [libusb_unref_device] Device 4.1 reference count decreased to 2
[ 0.004900] [0000820a] libusb: debug [libusb_unref_device] Device 3.5 reference count decreased to 2
[ 0.004902] [0000820a] libusb: debug [libusb_unref_device] Device 3.4 reference count decreased to 2
[ 0.004904] [0000820a] libusb: debug [libusb_unref_device] Device 3.3 reference count decreased to 2
[ 0.004906] [0000820a] libusb: debug [libusb_unref_device] Device 3.2 reference count decreased to 2
[ 0.004908] [0000820a] libusb: debug [libusb_unref_device] Device 3.6 reference count decreased to 2
[ 0.004910] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 7
[ 0.004912] [0000820a] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 2
[ 0.004914] [0000820a] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 3
[ 0.004915] [0000820a] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 2
[ 0.004934] [0000820a] libusb: debug [libusb_unref_device] Device 4.1 reference count decreased to 1
[ 0.004936] [0000820a] libusb: debug [libusb_unref_device] Device 3.5 reference count decreased to 1
[ 0.004938] [0000820a] libusb: debug [libusb_unref_device] Device 3.4 reference count decreased to 1
[ 0.004941] [0000820a] libusb: debug [libusb_unref_device] Device 3.3 reference count decreased to 1
[ 0.004943] [0000820a] libusb: debug [libusb_unref_device] Device 3.2 reference count decreased to 1
[ 0.004946] [0000820a] libusb: debug [libusb_unref_device] Device 3.6 reference count decreased to 1
[ 0.004948] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 6
[ 0.004950] [0000820a] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 1
[ 0.004953] [0000820a] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 2
[ 0.004955] [0000820a] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
[ 0.004957] [0000820a] libusb: debug [libusb_get_device_list]  
[ 0.004960] [0000820a] libusb: debug [libusb_ref_device] Device 4.1 reference count increased to 2
[ 0.004962] [0000820a] libusb: debug [libusb_ref_device] Device 3.5 reference count increased to 2
[ 0.004964] [0000820a] libusb: debug [libusb_ref_device] Device 3.4 reference count increased to 2
[ 0.004966] [0000820a] libusb: debug [libusb_ref_device] Device 3.3 reference count increased to 2
[ 0.004968] [0000820a] libusb: debug [libusb_ref_device] Device 3.2 reference count increased to 2
[ 0.004970] [0000820a] libusb: debug [libusb_ref_device] Device 3.6 reference count increased to 2
[ 0.004972] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 7
[ 0.004974] [0000820a] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 2
[ 0.004976] [0000820a] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 3
[ 0.004978] [0000820a] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 2
[ 0.004980] [0000820a] libusb: debug [libusb_ref_device] Device 4.1 reference count increased to 3
[ 0.004982] [0000820a] libusb: debug [libusb_ref_device] Device 3.5 reference count increased to 3
[ 0.004984] [0000820a] libusb: debug [libusb_ref_device] Device 3.4 reference count increased to 3
[ 0.004986] [0000820a] libusb: debug [libusb_ref_device] Device 3.3 reference count increased to 3
[ 0.004988] [0000820a] libusb: debug [libusb_ref_device] Device 3.2 reference count increased to 3
[ 0.004990] [0000820a] libusb: debug [libusb_ref_device] Device 3.6 reference count increased to 3
[ 0.004992] [0000820a] libusb: debug [libusb_ref_device] Device 3.1 reference count increased to 8
[ 0.004994] [0000820a] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 3
[ 0.004996] [0000820a] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 4
[ 0.004998] [0000820a] libusb: debug [libusb_ref_device] Device 1.1 reference count increased to 3
[ 0.005000] [0000820a] libusb: debug [libusb_unref_device] Device 4.1 reference count decreased to 2
[ 0.005002] [0000820a] libusb: debug [libusb_unref_device] Device 3.5 reference count decreased to 2
[ 0.005004] [0000820a] libusb: debug [libusb_unref_device] Device 3.4 reference count decreased to 2
[ 0.005006] [0000820a] libusb: debug [libusb_unref_device] Device 3.3 reference count decreased to 2
[ 0.005008] [0000820a] libusb: debug [libusb_unref_device] Device 3.2 reference count decreased to 2
[ 0.005010] [0000820a] libusb: debug [libusb_unref_device] Device 3.6 reference count decreased to 2
[ 0.005012] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 7
[ 0.005014] [0000820a] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 2
[ 0.005016] [0000820a] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 3
[ 0.005018] [0000820a] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 2
[ 0.005022] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005024] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005028] [0000820a] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.005037] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005038] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005042] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005044] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005049] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005051] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005054] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005056] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005060] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005062] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005064] [0000820a] libusb: debug [parse_configuration] skipping descriptor 0xb
[ 0.005066] [0000820a] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.005071] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005073] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005078] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005080] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005082] [0000820a] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.005084] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005086] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005088] [0000820a] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.005092] [0000820a] libusb: debug [libusb_get_device_descriptor]  
[ 0.005094] [0000820a] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.005097] [0000820a] libusb: debug [libusb_unref_device] Device 4.1 reference count decreased to 1
[ 0.005099] [0000820a] libusb: debug [libusb_unref_device] Device 3.5 reference count decreased to 1
[ 0.005101] [0000820a] libusb: debug [libusb_unref_device] Device 3.4 reference count decreased to 1
[ 0.005103] [0000820a] libusb: debug [libusb_unref_device] Device 3.3 reference count decreased to 1
[ 0.005104] [0000820a] libusb: debug [libusb_unref_device] Device 3.2 reference count decreased to 1
[ 0.005107] [0000820a] libusb: debug [libusb_unref_device] Device 3.6 reference count decreased to 1
[ 0.005109] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 6
[ 0.005111] [0000820a] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 1
[ 0.005113] [0000820a] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 2
[ 0.005114] [0000820a] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 1
1d6b:0003
1c7a:0575
04f2:b6dd
046d:c52b
05e3:0610
8087:0026
1d6b:0002
05e3:0612
1d6b:0003
1d6b:0002
[ 0.005135] [0000820a] libusb: debug [libusb_exit]  
[ 0.005137] [0000820a] libusb: debug [libusb_unref_device] Device 4.1 reference count decreased to 0
[ 0.005140] [0000820a] libusb: debug [libusb_unref_device] destroy device 4.1
[ 0.005142] [0000820a] libusb: debug [libusb_unref_device] Device 3.5 reference count decreased to 0
[ 0.005144] [0000820a] libusb: debug [libusb_unref_device] destroy device 3.5
[ 0.005146] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 5
[ 0.005148] [0000820a] libusb: debug [libusb_unref_device] Device 3.4 reference count decreased to 0
[ 0.005150] [0000820a] libusb: debug [libusb_unref_device] destroy device 3.4
[ 0.005152] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 4
[ 0.005154] [0000820a] libusb: debug [libusb_unref_device] Device 3.3 reference count decreased to 0
[ 0.005156] [0000820a] libusb: debug [libusb_unref_device] destroy device 3.3
[ 0.005158] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 3
[ 0.005160] [0000820a] libusb: debug [libusb_unref_device] Device 3.2 reference count decreased to 0
[ 0.005162] [0000820a] libusb: debug [libusb_unref_device] destroy device 3.2
[ 0.005164] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 2
[ 0.005166] [0000820a] libusb: debug [libusb_unref_device] Device 3.6 reference count decreased to 0
[ 0.005168] [0000820a] libusb: debug [libusb_unref_device] destroy device 3.6
[ 0.005170] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 1
[ 0.005173] [0000820a] libusb: debug [libusb_unref_device] Device 3.1 reference count decreased to 0
[ 0.005175] [0000820a] libusb: debug [libusb_unref_device] destroy device 3.1
[ 0.005177] [0000820a] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 0
[ 0.005179] [0000820a] libusb: debug [libusb_unref_device] destroy device 2.2
[ 0.005181] [0000820a] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 1
[ 0.005183] [0000820a] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 0
[ 0.005185] [0000820a] libusb: debug [libusb_unref_device] destroy device 2.1
[ 0.005187] [0000820a] libusb: debug [libusb_unref_device] Device 1.1 reference count decreased to 0
[ 0.005189] [0000820a] libusb: debug [libusb_unref_device] destroy device 1.1
[ 0.005196] [00008218] libusb: debug [linux_udev_event_thread_main] udev event thread exiting
[ 0.005228] [0000820a] libusb: debug [usbi_remove_event_source] remove fd 4
[ 0.005232] [0000820a] libusb: debug [usbi_remove_event_source] remove fd 3

@mcuee
Copy link
Member Author

mcuee commented Apr 2, 2023

Same for macOS, once I have the patched version of libusb-compat-0.1, it seems to work as expected. I have also tested libusb-compat-0.1 testlibusb example and it is also okay.

Modified version of libusb (just to add the debug print for the reference count) and modified version of libusb-compat-0.1 are installed to ~/bin. Please also take note that I am using static build for the example lsusb to avoid linking to Homebrew installed libusb and libusb-compat-0.1.

click for debug log under macOS
mcuee@mcuees-Mac-mini test_issue1165 % gcc -o lsusb lsusb.c ~/bin/lib/libusb.a ~/bin/lib/libusb-1.0.a -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security

mcuee@mcuees-Mac-mini test_issue1165 % ./lsusb 
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000051] [00006efc] libusb: debug [libusb_init_context] libusb v1.0.26.11791
[ 0.000081] [00006efc] libusb: debug [usbi_add_event_source] add fd 3 events 1
[ 0.000184] [00006f0a] libusb: debug [darwin_event_thread_main] creating hotplug event source
[ 0.000594] [00006f0a] libusb: debug [darwin_event_thread_main] darwin event thread ready to receive events
[ 0.000829] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8c3b602
[ 0.000888] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8c3b602
[ 0.005893] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.005907] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.005911] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.005914] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.005917] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.005919] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.005921] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.005924] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.005927] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.005930] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.005933] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.005935] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.005938] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.005940] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.005965] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.005969] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x8c3b602
[ 0.005974] [00006efc] libusb: debug [process_new_device] found device with address 1 port = 2 parent = 0x0 at 0x60000225c0ba
[ 0.006054] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8c93ad8
[ 0.006092] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8c93ad8/0x2600000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.006096] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8c93ad8
[ 0.006342] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.006350] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.006352] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.006355] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.006358] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.006360] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.006363] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.006365] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.006368] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.006370] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.006373] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.006376] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.006378] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.006381] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.006397] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.006401] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x8c93ad8
[ 0.006405] [00006efc] libusb: debug [process_new_device] found device with address 2 port = 6 parent = 0x0 at 0x60000225c2ba
[ 0.006469] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8e092a9
[ 0.006496] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8c93ad8
[ 0.006499] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8e092a9/0x2610000 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.006503] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8e092a9/0x2610000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.006506] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8e092a9
[ 0.006709] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.006715] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.006718] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0300
[ 0.006721] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.006723] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.006726] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x03
[ 0.006728] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.006731] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.006733] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0411
[ 0.006736] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.006739] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.006741] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.006743] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.006746] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.006762] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.006765] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x8e092a9
[ 0.006768] [00006efc] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 2
[ 0.006772] [00006efc] libusb: debug [process_new_device] found device with address 3 port = 1 parent = 0x60000285c120 at 0x60000225c3ba
[ 0.006830] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x8f03079
[ 0.006853] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8e092a9
[ 0.006856] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8f03079/0x2611000 against cached device with sessionID/locationID 0x8e092a9/0x2610000
[ 0.006859] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8f03079/0x2611000 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.006862] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x8f03079/0x2611000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.006865] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x8f03079
[ 0.007070] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.007077] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.007079] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0310
[ 0.007082] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.007085] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.007087] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.007089] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x09
[ 0.007092] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x05e3
[ 0.007094] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0749
[ 0.007097] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x1535
[ 0.007100] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x03
[ 0.007103] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x04
[ 0.007105] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x02
[ 0.007108] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.007122] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.007125] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x8f03079
[ 0.007128] [00006efc] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 2
[ 0.007131] [00006efc] libusb: debug [process_new_device] found device with address 4 port = 1 parent = 0x60000285c180 at 0x60000225c4ba
[ 0.007194] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x907ded2
[ 0.007218] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8c3b602
[ 0.007221] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x907ded2/0x2210000 against cached device with sessionID/locationID 0x8f03079/0x2611000
[ 0.007224] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x907ded2/0x2210000 against cached device with sessionID/locationID 0x8e092a9/0x2610000
[ 0.007228] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x907ded2/0x2210000 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.007230] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x907ded2/0x2210000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.007233] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x907ded2
[ 0.007422] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.007428] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.007430] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0210
[ 0.007433] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.007435] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.007438] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.007440] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.007443] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0bda
[ 0.007445] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x5411
[ 0.007448] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0117
[ 0.007451] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.007454] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.007456] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.007459] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.007473] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.007476] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x907ded2
[ 0.007479] [00006efc] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 2
[ 0.007482] [00006efc] libusb: debug [process_new_device] found device with address 5 port = 1 parent = 0x60000285c0c0 at 0x60000225c5ba
[ 0.007543] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x91409d1
[ 0.007566] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x8c3b602
[ 0.007569] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x91409d1/0x2240000 against cached device with sessionID/locationID 0x907ded2/0x2210000
[ 0.007572] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x91409d1/0x2240000 against cached device with sessionID/locationID 0x8f03079/0x2611000
[ 0.007575] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x91409d1/0x2240000 against cached device with sessionID/locationID 0x8e092a9/0x2610000
[ 0.007578] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x91409d1/0x2240000 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.007581] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x91409d1/0x2240000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.007584] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x91409d1
[ 0.008036] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.008047] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.008051] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.008053] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.008056] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.008058] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.008061] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.008064] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.008066] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.008069] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.008072] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.008074] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.008077] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.008079] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.008100] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.008104] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x91409d1
[ 0.008108] [00006efc] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 3
[ 0.008112] [00006efc] libusb: debug [process_new_device] found device with address 6 port = 4 parent = 0x60000285c0c0 at 0x6000022400ba
[ 0.008185] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x96c5dc7
[ 0.008211] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x91409d1
[ 0.008215] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x96c5dc7/0x2245000 against cached device with sessionID/locationID 0x91409d1/0x2240000
[ 0.008219] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x96c5dc7/0x2245000 against cached device with sessionID/locationID 0x907ded2/0x2210000
[ 0.008222] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x96c5dc7/0x2245000 against cached device with sessionID/locationID 0x8f03079/0x2611000
[ 0.008225] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x96c5dc7/0x2245000 against cached device with sessionID/locationID 0x8e092a9/0x2610000
[ 0.008228] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x96c5dc7/0x2245000 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.008246] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x96c5dc7/0x2245000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.008254] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x96c5dc7
[ 0.008638] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.008646] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.008649] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.008652] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x09
[ 0.008655] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.008658] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x02
[ 0.008660] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.008663] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1a40
[ 0.008665] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x0201
[ 0.008668] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.008671] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x00
[ 0.008673] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x01
[ 0.008675] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.008678] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.008700] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.008704] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x96c5dc7
[ 0.008708] [00006efc] libusb: debug [libusb_ref_device] Device 2.6 reference count increased to 2
[ 0.008712] [00006efc] libusb: debug [process_new_device] found device with address 7 port = 5 parent = 0x600002840000 at 0x6000022440ba
[ 0.008787] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x984bac4
[ 0.008814] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x91409d1
[ 0.008818] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x96c5dc7/0x2245000
[ 0.008821] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x91409d1/0x2240000
[ 0.008824] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x907ded2/0x2210000
[ 0.008827] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x8f03079/0x2611000
[ 0.008830] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x8e092a9/0x2610000
[ 0.008877] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.008883] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x984bac4/0x2247000 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.008886] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x984bac4
[ 0.009141] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.009148] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.009150] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0200
[ 0.009153] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0xef
[ 0.009156] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x02
[ 0.009158] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x01
[ 0.009161] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x40
[ 0.009163] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x0ac8
[ 0.009166] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x3420
[ 0.009169] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0100
[ 0.009171] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.009174] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.009176] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.009179] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.009196] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.009200] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x984bac4
[ 0.009203] [00006efc] libusb: debug [libusb_ref_device] Device 2.6 reference count increased to 3
[ 0.009206] [00006efc] libusb: debug [process_new_device] found device with address 8 port = 7 parent = 0x600002840000 at 0x6000022401ba
[ 0.009271] [00006efc] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x9c79b3a
[ 0.009296] [00006efc] libusb: debug [darwin_get_cached_device] parent sessionID: 0x96c5dc7
[ 0.009299] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x984bac4/0x2247000
[ 0.009302] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x96c5dc7/0x2245000
[ 0.009305] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x91409d1/0x2240000
[ 0.009309] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x907ded2/0x2210000
[ 0.009313] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x8f03079/0x2611000
[ 0.009316] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x8e092a9/0x2610000
[ 0.009319] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x8c93ad8/0x2600000
[ 0.009322] [00006efc] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x9c79b3a/0x2245700 against cached device with sessionID/locationID 0x8c3b602/0x2200000
[ 0.009325] [00006efc] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x9c79b3a
[ 0.009545] [00006efc] libusb: debug [darwin_cache_device_descriptor] cached device descriptor:
[ 0.009551] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDescriptorType:    0x01
[ 0.009554] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdUSB:             0x0110
[ 0.009556] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceClass:       0x00
[ 0.009559] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceSubClass:    0x00
[ 0.009562] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bDeviceProtocol:    0x00
[ 0.009564] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bMaxPacketSize0:    0x20
[ 0.009566] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idVendor:           0x1915
[ 0.009569] [00006efc] libusb: debug [darwin_cache_device_descriptor]   idProduct:          0x1025
[ 0.009572] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bcdDevice:          0x0173
[ 0.009574] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iManufacturer:      0x01
[ 0.009577] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iProduct:           0x02
[ 0.009579] [00006efc] libusb: debug [darwin_cache_device_descriptor]   iSerialNumber:      0x00
[ 0.009582] [00006efc] libusb: debug [darwin_cache_device_descriptor]   bNumConfigurations: 0x01
[ 0.009599] [00006efc] libusb: debug [darwin_check_configuration] active config: 1, first config: 1
[ 0.009602] [00006efc] libusb: debug [process_new_device] allocating new device in context 0x124f043b0 for with session 0x9c79b3a
[ 0.009605] [00006efc] libusb: debug [libusb_ref_device] Device 2.7 reference count increased to 2
[ 0.009608] [00006efc] libusb: debug [process_new_device] found device with address 9 port = 7 parent = 0x600002844000 at 0x6000022402ba
[ 0.009619] [00006efc] libusb: debug [libusb_init_context] installing new context as implicit default
[ 0.009622] [00006efc] libusb: debug [libusb_get_device_list]  
[ 0.009651] [00006efc] libusb: debug [libusb_ref_device] Device 2.9 reference count increased to 2
[ 0.009655] [00006efc] libusb: debug [libusb_ref_device] Device 2.8 reference count increased to 2
[ 0.009657] [00006efc] libusb: debug [libusb_ref_device] Device 2.7 reference count increased to 3
[ 0.009660] [00006efc] libusb: debug [libusb_ref_device] Device 2.6 reference count increased to 4
[ 0.009663] [00006efc] libusb: debug [libusb_ref_device] Device 2.5 reference count increased to 2
[ 0.009665] [00006efc] libusb: debug [libusb_ref_device] Device 2.4 reference count increased to 2
[ 0.009668] [00006efc] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 3
[ 0.009671] [00006efc] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 3
[ 0.009673] [00006efc] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 4
[ 0.009676] [00006efc] libusb: debug [libusb_ref_device] Device 2.9 reference count increased to 3
[ 0.009679] [00006efc] libusb: debug [libusb_ref_device] Device 2.8 reference count increased to 3
[ 0.009681] [00006efc] libusb: debug [libusb_ref_device] Device 2.7 reference count increased to 4
[ 0.009684] [00006efc] libusb: debug [libusb_ref_device] Device 2.6 reference count increased to 5
[ 0.009686] [00006efc] libusb: debug [libusb_ref_device] Device 2.5 reference count increased to 3
[ 0.009689] [00006efc] libusb: debug [libusb_ref_device] Device 2.4 reference count increased to 3
[ 0.009692] [00006efc] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 4
[ 0.009788] [00006efc] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 4
[ 0.009792] [00006efc] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 5
[ 0.009795] [00006efc] libusb: debug [libusb_unref_device] Device 2.9 reference count decreased to 2
[ 0.009798] [00006efc] libusb: debug [libusb_unref_device] Device 2.8 reference count decreased to 2
[ 0.009801] [00006efc] libusb: debug [libusb_unref_device] Device 2.7 reference count decreased to 3
[ 0.009804] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 4
[ 0.009807] [00006efc] libusb: debug [libusb_unref_device] Device 2.5 reference count decreased to 2
[ 0.009810] [00006efc] libusb: debug [libusb_unref_device] Device 2.4 reference count decreased to 2
[ 0.009813] [00006efc] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 3
[ 0.009816] [00006efc] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 3
[ 0.009819] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 4
[ 0.009823] [00006efc] libusb: debug [libusb_unref_device] Device 2.9 reference count decreased to 1
[ 0.009825] [00006efc] libusb: debug [libusb_unref_device] Device 2.8 reference count decreased to 1
[ 0.009828] [00006efc] libusb: debug [libusb_unref_device] Device 2.7 reference count decreased to 2
[ 0.009831] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 3
[ 0.009834] [00006efc] libusb: debug [libusb_unref_device] Device 2.5 reference count decreased to 1
[ 0.009837] [00006efc] libusb: debug [libusb_unref_device] Device 2.4 reference count decreased to 1
[ 0.009839] [00006efc] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 2
[ 0.009843] [00006efc] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 2
[ 0.009845] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 3
[ 0.009848] [00006efc] libusb: debug [libusb_get_device_list]  
[ 0.009871] [00006efc] libusb: debug [libusb_ref_device] Device 2.9 reference count increased to 2
[ 0.009875] [00006efc] libusb: debug [libusb_ref_device] Device 2.8 reference count increased to 2
[ 0.009877] [00006efc] libusb: debug [libusb_ref_device] Device 2.7 reference count increased to 3
[ 0.009880] [00006efc] libusb: debug [libusb_ref_device] Device 2.6 reference count increased to 4
[ 0.009883] [00006efc] libusb: debug [libusb_ref_device] Device 2.5 reference count increased to 2
[ 0.009885] [00006efc] libusb: debug [libusb_ref_device] Device 2.4 reference count increased to 2
[ 0.009888] [00006efc] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 3
[ 0.009891] [00006efc] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 3
[ 0.009893] [00006efc] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 4
[ 0.009896] [00006efc] libusb: debug [libusb_ref_device] Device 2.9 reference count increased to 3
[ 0.009898] [00006efc] libusb: debug [libusb_ref_device] Device 2.8 reference count increased to 3
[ 0.009901] [00006efc] libusb: debug [libusb_ref_device] Device 2.7 reference count increased to 4
[ 0.009904] [00006efc] libusb: debug [libusb_ref_device] Device 2.6 reference count increased to 5
[ 0.009906] [00006efc] libusb: debug [libusb_ref_device] Device 2.5 reference count increased to 3
[ 0.009909] [00006efc] libusb: debug [libusb_ref_device] Device 2.4 reference count increased to 3
[ 0.009911] [00006efc] libusb: debug [libusb_ref_device] Device 2.3 reference count increased to 4
[ 0.009914] [00006efc] libusb: debug [libusb_ref_device] Device 2.2 reference count increased to 4
[ 0.010091] [00006efc] libusb: debug [libusb_ref_device] Device 2.1 reference count increased to 5
[ 0.010094] [00006efc] libusb: debug [libusb_unref_device] Device 2.9 reference count decreased to 2
[ 0.010097] [00006efc] libusb: debug [libusb_unref_device] Device 2.8 reference count decreased to 2
[ 0.010100] [00006efc] libusb: debug [libusb_unref_device] Device 2.7 reference count decreased to 3
[ 0.010103] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 4
[ 0.010106] [00006efc] libusb: debug [libusb_unref_device] Device 2.5 reference count decreased to 2
[ 0.010108] [00006efc] libusb: debug [libusb_unref_device] Device 2.4 reference count decreased to 2
[ 0.010111] [00006efc] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 3
[ 0.010114] [00006efc] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 3
[ 0.010117] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 4
[ 0.010127] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010130] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010137] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010139] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010142] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.010146] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010149] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010152] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.010155] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010157] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010160] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.010163] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x30
[ 0.010166] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010168] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010172] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010174] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010179] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010181] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010184] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010187] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010190] [00006efc] libusb: debug [parse_configuration] skipping descriptor 0xb
[ 0.010193] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.010208] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0xb
[ 0.010211] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.010218] [00006efc] libusb: debug [libusb_get_device_descriptor]  
[ 0.010221] [00006efc] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.010224] [00006efc] libusb: debug [parse_endpoint] skipping descriptor 0x25
[ 0.010229] [00006efc] libusb: debug [libusb_unref_device] Device 2.9 reference count decreased to 1
[ 0.010232] [00006efc] libusb: debug [libusb_unref_device] Device 2.8 reference count decreased to 1
[ 0.010236] [00006efc] libusb: debug [libusb_unref_device] Device 2.7 reference count decreased to 2
[ 0.010239] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 3
[ 0.010241] [00006efc] libusb: debug [libusb_unref_device] Device 2.5 reference count decreased to 1
[ 0.010244] [00006efc] libusb: debug [libusb_unref_device] Device 2.4 reference count decreased to 1
[ 0.010247] [00006efc] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 2
[ 0.010250] [00006efc] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 2
[ 0.010253] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 3
1915:1025
0ac8:3420
1a40:0201
1a40:0201
0bda:5411
05e3:0749
0bda:0411
0bda:0411
0bda:5411
[ 0.010284] [00006efc] libusb: debug [libusb_exit]  
[ 0.010287] [00006efc] libusb: debug [libusb_unref_device] Device 2.9 reference count decreased to 0
[ 0.010290] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.9
[ 0.010294] [00006efc] libusb: debug [libusb_unref_device] Device 2.7 reference count decreased to 1
[ 0.010297] [00006efc] libusb: debug [libusb_unref_device] Device 2.8 reference count decreased to 0
[ 0.010300] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.8
[ 0.010302] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 2
[ 0.010305] [00006efc] libusb: debug [libusb_unref_device] Device 2.7 reference count decreased to 0
[ 0.010308] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.7
[ 0.010311] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 1
[ 0.010313] [00006efc] libusb: debug [libusb_unref_device] Device 2.6 reference count decreased to 0
[ 0.010316] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.6
[ 0.010319] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 2
[ 0.010322] [00006efc] libusb: debug [libusb_unref_device] Device 2.5 reference count decreased to 0
[ 0.010325] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.5
[ 0.010327] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 1
[ 0.010330] [00006efc] libusb: debug [libusb_unref_device] Device 2.4 reference count decreased to 0
[ 0.010333] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.4
[ 0.010335] [00006efc] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 1
[ 0.010338] [00006efc] libusb: debug [libusb_unref_device] Device 2.3 reference count decreased to 0
[ 0.010341] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.3
[ 0.010344] [00006efc] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 1
[ 0.010346] [00006efc] libusb: debug [libusb_unref_device] Device 2.2 reference count decreased to 0
[ 0.010349] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.2
[ 0.010352] [00006efc] libusb: debug [libusb_unref_device] Device 2.1 reference count decreased to 0
[ 0.010355] [00006efc] libusb: debug [libusb_unref_device] destroy device 2.1
[ 0.010383] [00006f0a] libusb: debug [darwin_event_thread_main] darwin event thread exiting
[ 0.011480] [00006efc] libusb: debug [usbi_remove_event_source] remove fd 3

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

2 participants