从Python中读取USB条形码扫描仪的数据
我正在使用以下代码从Windows中的USB条形码扫描仪读取。 但是,它返回此错误:
提高Usberror(_strerror(ret),ret,_libusb_errno [ret]) usb.core.usberror:[errno 5]输入/输出错误
如何纠正该代码以读取从条形码扫描仪发送的数据?
import usb.core
dev = usb.core.find(idVendor=0x05f9,idProduct=0x4005)
data = []
endpoint = dev[0][(0,0)][0]
while 1:
data += dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize)
print(data)
I am using the following code to read from a usb barcode scanner in Windows.
However, it returns this error :
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error
How can I correct this code to read sent data from barcode scanner?
import usb.core
dev = usb.core.find(idVendor=0x05f9,idProduct=0x4005)
data = []
endpoint = dev[0][(0,0)][0]
while 1:
data += dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize)
print(data)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论