【问题标题】:PyUsb: "insufficient permissions". macOS Big SurPyUsb:“权限不足”。 macOS 大苏尔
【发布时间】:2022-06-29 02:37:26
【问题描述】:

我正在关注 pyusb 的 this 教程,但是当我深入到代码中时,我得到了错误:raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 13] Access denied (insufficient permissions)。这是我写的代码:

import usb.core
import usb.util

VID = 0x046d
PID = 0xc07e
dev = usb.core.find(idVendor=VID, idProduct=PID)
ep = dev[0].interfaces()[0].endpoints()[0]
i = dev[0].interfaces()[0].bInterfaceNumber
dev.reset()
if dev.is_kernel_driver_active(i):
    dev.detach_kernel_driver(i)

r = dev.read(eaddr, 1024)
print(len(r))

正如我在标题中所说,我使用的是 macOS Big Sur 11.4 版,我正在尝试从 Bus 020 Device 029: ID 046d:c07e Logitech Inc. Gaming Mouse G402 读取。

谢谢。

【问题讨论】:

    标签: python macos usb macos-big-sur pyusb


    【解决方案1】:

    错误提示“访问被拒绝(权限不足)”。您必须使用 sudo 运行您的代码。喜欢:“sudo python3 ”。

    【讨论】:

      猜你喜欢
      • 2020-03-18
      • 2019-07-04
      • 2021-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-24
      • 2018-12-07
      • 2020-07-22
      相关资源
      最近更新 更多