我正在使用pyusb-1.0.0b2
. 我正在将一些多线程代码转换为使用select.poll()
循环,如下所示:
p = select.poll()
p.register(...)
while True:
for fd,evt in p.poll():
...
目前有一些代码在其自己的线程中运行,主要只是调用read()
pyusbusb.core.Device
对象。我想将此设备集成到poll
循环中,但不幸的是,它没有公开fileno()
(实际上,查看/proc/[pid]/fd/
没有为该设备打开的文件描述符。)
我看到 libusb 应该支持这个:libusb and poll / select
如何使用 pyusb 实现这一点?