[Twisted-Python] libusb-1 file descriptors

Donal McMullan donal.mcmullan at gmail.com
Sat Feb 11 23:13:29 EST 2012

I'm trying to integrate Twisted with libusb-1

The libusb-1 Python wrapper offers a USBPoller class to "allow
integration of USB event polling in a file-descriptor monitoring event
loop." The class expects to receive a 'poller' object, again quoting
from the documentation:

    poller is a polling instance implementing the following methods:
    - register(fd, event_flags)
      event_flags have the same meaning as in poll API (POLLIN & POLLOUT)
    - unregister(fd)
    - poll(timeout)
      timeout being a float in seconds, or None if there is no timeout.
      It must return a list of (descriptor, event) pairs.
    Note: USBPoller is itself a valid poller.

I feel like it should be obvious, but I can't see what would be the
correct way to integrate this with Twisted. My particular application
is to enable networking over the ANT+ protocol via a small USB key.

My approach is that I'm trying to write a transport. When that's
working I can start to build a Protocol. Is that sound?

Any pointers would be welcome. The USBPoller class can be viewed here:



More information about the Twisted-Python mailing list