reading joystick data

Ronn Ross ronn.ross at gmail.com
Thu Oct 15 08:47:00 EDT 2009


Hello,

I'm using PyUSB 0.4.2 to interact with a Microsoft Sindwinder joystick. I'm
using python 2.6 on windows XP. With the code snippet below I'm able to find
usb device currently plugged into my computer. Now I would like to actually
tap into the data that to joystick is providing to the system. For now I
just want to watch the data and see what it looks like as I move the
joystick around. Does anyone know a good tutorial, or can point me in the
right direction?

Script:
import usb
for bus in usb.busses():
    for dev in bus.devices:
        print "Bus %s Device %s: ID %04x:%04x %s" % (bus.dirname,
dev.filename, dev.idVendor, dev.idProduct, dev.open().getString(1,30))




Result:
Bus bus-0 Device \\.\libusb0-0005--0x04f2-0xb071: ID 04f2:b071 CNF7129
Bus bus-0 Device \\.\libusb0-0006--0x045e-0x0038: ID 045e:0038 Microsoft
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091015/5edabc8b/attachment.html>


More information about the Python-list mailing list