问题描述
我正在尝试通过https://github.com/pyusb/pyusb库从我的python脚本中读取USB条形码阅读器。
import usb.core
import usb.util
vendOR_ID = 8208
PRODUCT_ID = 30264
dev = usb.core.find(idvendor=vendOR_ID,idProduct=PRODUCT_ID)
dev.set_configuration()
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
ep = usb.util.find_descriptor(
intf,# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_IN)
data = ep.read(ep.wMaxPacketSize,8000000)
不幸的是,这导致了一个"USBError: [Errno 13] Access denied (insufficient permissions)"
问题。
我试图以sudo
的身份运行脚本,但没有帮助。该脚本可以在我的Ubuntu笔记本电脑上正常运行,但是我现在正尝试将其移至Mac OS。区别之一是我在Linux上确实有一个“ detach_kernel”,但是此功能在Mac Os上因"not implemented on this OS"
错误而失败...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)