我正试图在Raspberry Pi上读取带有一些基本python代码的USB HID设备中的一些数据,但不断收到以下错误:
Traceback (most recent call last):
File "gnome1.py", line 2, in <module>
fd = open("/dev/hidraw0", os.O_RDWR|os.O_NONBLOCK)
TypeError: file() argument 2 must be string, not int
这是Python代码:
import os, sys
fd = open("/dev/hidraw0", os.O_RDWR|os.O_NONBLOCK)
os.write(fd, "QPI\xBE\xAC\r")
os.read(fd, 512)
有人可以帮忙吗?
答案 0 :(得分:0)
fd = os.open(“/ dev / hidraw0”,os.O_RDWR | os.O_NONBLOCK)