Skip to content

device.detach_kernel_driver(0) - ERROR Could not detach kernel driver: [Errno 13] Access denied (insufficient permissions) #83

@jonnymoshiri

Description

@jonnymoshiri

Hello,

I have an issue running the following code, in my cloned github repo.

`from blinkstick import blinkstick

bstick = blinkstick.find_first()

#Set the color red on the 12th LED of R channel
bstick.set_color(channel=0, index=12, name="red")`

Specifically it fails in the call at find_first call. here is the full traceback.

Traceback (most recent call last):
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/blinkstick/blinkstick.py", line 821, in open_device
self.device.detach_kernel_driver(0)
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/venv/lib/python3.9/site-packages/usb/core.py", line 1075, in detach_kernel_driver
self._ctx.backend.detach_kernel_driver(
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/venv/lib/python3.9/site-packages/usb/backend/libusb1.py", line 902, in detach_kernel_driver
_check(self.lib.libusb_detach_kernel_driver(dev_handle.handle, intf))
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/venv/lib/python3.9/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/trial.py", line 4, in
bstick = blinkstick.find_first()
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/blinkstick/blinkstick.py", line 1581, in find_first
return BlinkStick(device=d)
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/blinkstick/blinkstick.py", line 215, in init
self.open_device(device)
File "/Users/jmoshiri/Documents/Repos/blinkstick-python/blinkstick/blinkstick.py", line 823, in open_device
raise BlinkStickException("Could not detach kernel driver: %s" % str(e))
blinkstick.blinkstick.BlinkStickException: Could not detach kernel driver: [Errno 13] Access denied (insufficient permissions)

I have given all the correct permissions in the set up for Blinkstick, and also given read write priveleges for all dependencies (usblib and pyusb) . My machine is running Mac OSx Big Sur and I am using Python 3.9.13. The only other way I was thinking to blinkstick via sudo priveleges either from the command line or from the IDE (pycharm in my case).

I got stumped at the command line priveleges in the set up because i do not have a directory udev in /etc for mac OS Big Sur

echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"20a0\", ATTR{idProduct}==\"41e5\", MODE:=\"0666\"" | sudo tee /etc/udev/rules.d/85-blinkstick.rules

Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions