From: Joe A. <joe...@gm...> - 2009-03-18 19:41:23
|
Hello All, I hope this is the right place for a pyusb user question. If not, I apologize (and if you could direct me to an appropriate forum I'd be obliged). I am trying to control a thorlabs computer-controlled rotation stage. The device contains an FT232BM peripheral chip, and can be controlled with the pyserial package. However, to figure out which device to open with pyserial, I check dmesg and see that it's been mounted on /dev/ttyUSB0. Then I open pyserial and am about my business. I'd like to be able to search for all motion controllers connected to my computer. I *can* do that with pyusb. The following code finds all the devices, and by manufacturer and serial number I can find out exactly which device is which: for bus in usb.busses(): for dev in bus.devices: print "Bus %s Device %s: ID %04x:%04x" % (bus.dirname,dev.filename,dev.idVendor,dev.idProduct) h = dev.open() print "Manufacturer: %s" % (h.getString(dev.iManufacturer,30)) print "Product: %s" % (h.getString(dev.iProduct,30)) print "SerialNumber: %s" % (h.getString(dev.iSerialNumber,30)) My question is: once I know the usb bus and device numbers, is there a way to learn that that bus/device combination maps to /dev/ttyUSB0? Thanks, Joe |