On Tue, Mar 30, 2010 at 9:01 AM, Marc <m...@marcd.org> wrote: > Hi, > I was wondering if anyone could point me to Python modules or example code > for accessing USB connected devices. I would like to get as close to the > hardware as possible with Python. I would like to be able to monitor as > well as control USB connected devices. I've looked at the missile launcher > code by Pedram Amini at dvlabs.tippingpoint.com, but am looking to see > what else has been done in this area. > > I've used pyserial, I believe, to directly access the usb. Here's the important connection bits of my code:
import serial class pyDuin: ser = serial.Serial() def __init__(self, port="/dev/ttyUSB0", baud="115200", timeout=0): self.ser.baudrate = baud self.ser.port = port self.ser.timeout = timeout def ready(self): self.ser.write("%c" % 41) def open(self): self.ser.open() if not self.ser.isOpen(): print "Error, not able to open serial connection on %s" % \ (self.ser.port, ) ------------- I was using it to connect to my arduino. If you'd like the rest of the source, let me know. HTH, Wayne
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor