|
From: 760ceb3b9c0ba4872cadf3ce35a7a494
<me...@76...> - 2026-06-16 02:32:25
|
hi everyone. this issue started with pyusb, but if i'm reading the logs correctly it seems to be a lower-level libusb issue. i thought maybe you all would have some pointers :) if this really is a libusb bug, it means this line in the FAQ.md might need to be changed: "One potential workaround is to develop a command line helper to detach/attach the kernel driver (this helper will run with sudo). Then you can run the main GUI application as a normal user." thanks!! Begin forwarded message: From: 760ceb3b9c0ba4872cadf3ce35a7a494 <me...@76...> Subject: detaching kernel driver makes device disappear on macOS Date: Jun 16, 2026 at 2:03 AM To: pyu...@li... i am trying to use pyusb to access a device that has a native kernel driver on macOS. to do this I have to first call `detach_kernel_driver`, which I must do from a privileged (root) process. but I want to spend as little time as possible as root, just detaching the kernel driver and then deescalating. unfortunately, it seems like after the kernel driver has been disconnected, the device no longer appears to pyusb *except when running as root*. so, once the kernel driver has been detached, only root can see the device. this stops happening once the kernel driver has been reattached, but then i can't use the device. the device is missing from `.list()` and can't be seen at all. i ran with `LIBUSB_DEBUG=4 PYUSB_DEBUG=debug` and instead of this (running as root): [ 0.002519] [00fec7c5] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x17289fa31f8c [ 0.002528] [00fec7c5] libusb: debug [darwin_get_cached_device] parent sessionID: 0x17289f4633fd [ 0.002530] [00fec7c5] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x17289fa31f8c/0x1110000 against cached device with sessionID/locationID 0x17289f4633fd/0x1100000 [ 0.002531] [00fec7c5] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x17289fa31f8c [ 0.002643] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] cached device descriptor: [ 0.002645] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bDescriptorType: 0x01 [ 0.002646] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bcdUSB: 0x0200 [ 0.002647] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bDeviceClass: 0x00 [ 0.002648] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bDeviceSubClass: 0x00 [ 0.002649] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bDeviceProtocol: 0x00 [ 0.002649] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bMaxPacketSize0: 0x40 [ 0.002650] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] idVendor: 0x05ac [ 0.002651] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] idProduct: 0x1266 [ 0.002651] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bcdDevice: 0x0001 [ 0.002652] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] iManufacturer: 0x01 [ 0.002653] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] iProduct: 0x02 [ 0.002654] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] iSerialNumber: 0x03 [ 0.002655] [00fec7c5] libusb: debug [darwin_cache_device_descriptor] bNumConfigurations: 0x02 [ 0.003150] [00fec7c5] libusb: debug [darwin_check_configuration] active config: 1, first config: 1 [ 0.003155] [00fec7c5] libusb: debug [process_new_device] allocating new device in context 0x11de0db40 for with session 0x17289fa31f8c [ 0.003158] [00fec7c5] libusb: debug [process_new_device] found device with address 2 port = 1 parent = 0x6000007ec600 at 0x600000decaba i get this when running as user: [ 0.002641] [00febf6c] libusb: debug [darwin_get_cached_device] finding cached device for sessionID 0x17289fa31f8c [ 0.002652] [00febf6c] libusb: debug [darwin_get_cached_device] parent sessionID: 0x17289f4633fd [ 0.002654] [00febf6c] libusb: debug [darwin_get_cached_device] matching sessionID/locationID 0x17289fa31f8c/0x1110000 against cached device with sessionID/locationID 0x17289f4633fd/0x1100000 [ 0.002655] [00febf6c] libusb: debug [darwin_get_cached_device] caching new device with sessionID 0x17289fa31f8c [ 0.002696] [00febf6c] libusb: debug [darwin_device_from_service] set up plugin for service retry: out of resources [ 0.002733] [00febf6c] libusb: debug [darwin_device_from_service] set up plugin for service retry: out of resources [ 0.002759] [00febf6c] libusb: debug [darwin_device_from_service] set up plugin for service retry: out of resources [ 0.002783] [00febf6c] libusb: debug [darwin_device_from_service] set up plugin for service retry: out of resources [ 0.002806] [00febf6c] libusb: debug [darwin_device_from_service] set up plugin for service retry: out of resources [ 0.002811] [00febf6c] libusb: debug [darwin_device_from_service] could not set up plugin for service: out of resources this is annoying because i wanted to use a privileged helper to detach the kernel driver, but this makes me have to run my entire GUI as root!! thanks :> (i also sent this in as a GitHub discussion, but i'm not sure if that forum is active? so I forwarded it here too. I hope that is not too much of a problem :) |