我正在使用PyUSB访问Ocean Optics Spectroscopy Unit并收集数据 . 以前,我曾经认为主要访问是通过FTDI芯片,但在使用Wireshark USB嗅探通过不同Windows计算机上的专有软件发送的命令后,它似乎是通过QE65000的0x01和0x82 endpoints .
我模仿了Wireshark捕获中发现的批量数据的发送/接收,但每次我尝试读取 endpoints 0x82时,我都会得到以下信息:
usb.core.USBError: [Errno 60] Operation timed out
此外,看起来好像在Wireshark上读取 endpoints 时,返回的数据包长度为2588字节,而为0x82 endpoints 列出的最大数据包大小为512字节 . 以下是我用来尝试读取 endpoints 的代码,传入入口和出口 endpoints 的数组,设备和超时作为参数 .
def read_endpoint(dev, ep, timeout = 7520):
endpoint = ep[1]
data = dev.read(endpoint.bEndpointAddress,endpoint.wMaxPacketSize)
return(data)
1 回答
Operation timed out
表示您在 endpoints 上没有读取任何内容 . 也许你以前必须向设备写一个命令 . 例如,对于大容量存储设备,首先在out endpoints 上编写命令:然后你读了答案 .
数据包大小定义了交换的数据包的大小,但是,设备不会通过多个数据包发送或接收命令 .