You are not logged in.

#1 2015-04-09 00:50:16

LeftyAce
Member
Registered: 2012-08-18
Posts: 162

pyusb Access Denied (insufficient permissions)

Hi all,

I'm trying to use the antfs-cli python script to read from an ant+ usb stick (https://github.com/Tigge/antfs-cli ), and it works fine if I run it as root. If I run it as a regular user, I get the following error:

Driver available: [<class 'ant.base.driver.USB2Driver'>, <class 'ant.base.driver.USB3Driver'>]
 - Using: <class 'ant.base.driver.USB3Driver'>
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/antfs_cli-0.2-py3.4.egg/antfs_cli/program.py", line 341, in main
    g = AntFSCLI(config_dir, args)
  File "/usr/lib/python3.4/site-packages/antfs_cli-0.2-py3.4.egg/antfs_cli/program.py", line 129, in __init__
    Application.__init__(self)
  File "/usr/lib/python3.4/site-packages/openant-0.2-py3.4.egg/ant/fs/manager.py", line 99, in __init__
    self._node = Node()
  File "/usr/lib/python3.4/site-packages/openant-0.2-py3.4.egg/ant/easy/node.py", line 56, in __init__
    self.ant = Ant()
  File "/usr/lib/python3.4/site-packages/openant-0.2-py3.4.egg/ant/base/ant.py", line 68, in __init__
    self._driver.open()
  File "/usr/lib/python3.4/site-packages/openant-0.2-py3.4.egg/ant/base/driver.py", line 175, in open
    if dev.is_kernel_driver_active(0):
  File "/usr/lib/python3.4/site-packages/pyusb-1.0.0b2-py3.4.egg/usb/core.py", line 989, in is_kernel_driver_active
    self._ctx.managed_open()
  File "/usr/lib/python3.4/site-packages/pyusb-1.0.0b2-py3.4.egg/usb/core.py", line 105, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "/usr/lib/python3.4/site-packages/pyusb-1.0.0b2-py3.4.egg/usb/backend/libusb1.py", line 722, in open_device
    return _DeviceHandle(dev)
  File "/usr/lib/python3.4/site-packages/pyusb-1.0.0b2-py3.4.egg/usb/backend/libusb1.py", line 600, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "/usr/lib/python3.4/site-packages/pyusb-1.0.0b2-py3.4.egg/usb/backend/libusb1.py", line 552, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)
Interrupted: [Errno 13] Access denied (insufficient permissions)

Seems simple enough, I don't have permission to access the usb stick. But according to ls -l I should have permission. When I plug in the device, dmesg tells me it is assigned to /dev/ttyUSB0.  I checked the permissions on that device:

$ ls -l /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 0 Apr  8 19:36 /dev/ttyUSB0

I checked which groups I'm in:

$ groups
lp uucp games video audio optical storage scanner power users vboxusers

Seems like I'm in the uucp group, and that uucp is allowed to do everything root can do to that device. So, what am I missing? Is there a way to confirm that the program is trying to access the correct device? Is using ls -l to check permissions adequate?

Offline

#2 2020-04-22 18:10:40

satcom886
Member
Registered: 2019-04-27
Posts: 7

Re: pyusb Access Denied (insufficient permissions)

Sorry to necrobump, but I have the same issue.

Offline

#3 2020-04-22 22:28:45

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: pyusb Access Denied (insufficient permissions)

Don't apologize for doing something you know is wrong, just don't do it.

Closing.

Offline

Board footer

Powered by FluxBB