我试图在Mac OS上通过pyusb发送控制转移命令:
dev.ctrl_transfer(0x21,0x09,0x0200,0x0,0x1)
我得到了错误:
Traceback (most recent call last):
File "./main.py", line 21, in <module>
dev.ctrl_transfer(0x21,0x09,0x0200,0x0000,0x0001)
File "/Library/Python/2.7/site-packages/usb/core.py", line 962, in ctrl_transfer
self._ctx.managed_claim_interface(self, interface_number)
File "/Library/Python/2.7/site-packages/usb/core.py", line 146, in managed_claim_interface
self.backend.claim_interface(self.handle, i)
File "/Library/Python/2.7/site-packages/usb/backend/libusb1.py", line 747, in claim_interface
_check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
File "/Library/Python/2.7/site-packages/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)
有人可以帮我弄这个吗。我试过sudo,su我也把这个发布在pyusb github用户组中。我得到了这个(将自己添加到debian系统中的plugdev组中)作为可能的解决方案,但是我不确定如何继续使用Mac OS
https://github.com/braiden/python-ant-downloader/issues/30#issuecomment-55293142
链接以下问题:
OUT Endpoint not accessible by pyusb
PyUSB dev.set_configuration()(解决方案适用于ubuntu)
最佳答案
据看来,以下问题的答案:
python LibUsb是否可以在Mac OS X的HID设备上使用?
不对看起来libusb不能在Mac上访问HID设备,而应该使用HIDAPI库或类似的库。
我猜您正在尝试使用libusb访问Mac OS X上的HID设备,这是神圣的自然法则所禁止的。
HID Mac OS X Docs
Ticket on libusb
相似问题:Raw access to HID devices in OS X