USBError: [Errno 13] 拒绝访问(权限不足) [英] USBError: [Errno 13] Access denied (insufficient permissions)

查看:31
本文介绍了USBError: [Errno 13] 拒绝访问(权限不足)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题和世界一样古老.有可用的讨论和解决方案.这一切都归结为更新规则文件并授予权限.所以我遵循了食谱.但我仍然有同样的问题.这是显示我按照说明操作的屏幕截图.

This problem is old as the world. There are discussions and solutions available. It all boils down to update the rules file and give permissions. So I have followed the recipe. But I still have the same problem. here are screenshots showing I follow instructions.

版本:

Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
usb.__version__ '1.0.2'

错误:

    Traceback (most recent call last):
  File "/media/psf/Home/All-Projects-on-femto/LaserLab/Software/usb_4108.py", line 19, in <module>
    dev.set_configuration()
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 869, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 102, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 147, in managed_set_configuration
    self.managed_open()
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 102, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 120, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 786, in open_device
    return _DeviceHandle(dev)
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 643, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
USBError: [Errno 13] Access denied (insufficient permissions)

规则.文件(位置/etc/udev/rules.d/99-usbftdi.rules)

Rules. file (location /etc/udev/rules.d/99-usbftdi.rules)

# For FTDI FT232 & FT245 USB devices with Vendor ID = 0x0403, Product ID = 0xabc
SYSFS{idProduct}=="4108", SYSFS{idVendor}=="0683", RUN+="/sbin/modprobe -q ftdi-sio product=0x4108 vendor=0x0683"
#SYSFS{idProduct}=="2450", SYSFS{idVendor}=="0683", RUN+="/sbin/modprobe -q ftdi-sio product=0x2450 vendor=0x0683"
SYSFS{idVendor}=="0683", SYSFS{idProduct}=="4108", MODE="0666"

并精简代码:

import usb.core
import usb.util
dev = usb.core.find(idVendor=0x0683, idProduct=0x4108)
dev.reset() 

但是,它没有给我必要的权限.我的精简代码仍然产生错误:

However, it doesn't give me necessary permissions. My stripped down code that still produces the error:

import usb.core
import usb.util
dev = usb.core.find(idVendor=0x0683, idProduct=0x4108)
dev.reset()

奇怪的是,如果我以超级用户身份从终端启动 IDLE,我会获得权限(终端:sudo idle).

The strange thing that if I start IDLE from the terminal as superuser I get permissions (terminal: sudo idle).

推荐答案

你的规则看起来有点奇怪.你能把它们全部去掉然后试试这个吗?

Your rules look a little bit odd. Can you remove all of them and try this instead?

SUBSYSTEM=="usb", ATTRS{idVendor}=="0683", MODE="0666"

这篇关于USBError: [Errno 13] 拒绝访问(权限不足)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆