Learning About Python and USB


There's a number of different ways of integrating Python and USB. For the Learning About Atmel RZRAVEN project I used one of the 0.x series of pyusb. For some reason (I think it was the appeal of a nicer API) when I started to work on integrating Learning About Arduino and Python and Project Log Arduino USB I decided to use version 1.x of pyusb.

The version 1.x series isn't feature complete but I'm going to see how far I can get with it.

You'll need to pull from the source repository:

svn co https://pyusb.svn.sourceforge.net/svnroot/pyusb pyusb 

There's a pyusb 1.0 tutorial available.

The 1.x series of the Python binding didn't seem to work with the 0.x series of libusb for me on Mac OS X 10.5.x so I installed the 1.0.3 of libusb as well. (By "not working" I mean that a scan for busses/devices returned nothing.)

One of the features that appears to be missing currently (2009-10-19) is the ability to retrieve string descriptors easily. I wrote an example lsusb.py that incorporates that functionality: lsusb.py

The code is very much in a "works for me" state at the moment and doesn't—in fact—always work for me but it's a starting point. :)