Re: [Pyusb-users] Mapping usb serial devices to device filenames

2009-06-17 Thread Sarah Messer
n(TargetSerNum)-1]     SerNumRE=re.compile(devstr+r'\s*')     Interface=TargetSerNum[len(TargetSerNum)-1] #single-character interface num     return HubSearch1Tier(SerNumRE,1,basepath,'',1,Interface,runlog)     elif TargetSerNum.startswith('COM'): #RS-232

Re: [Pyusb-users] Mapping usb serial devices to device filenames

2009-06-17 Thread Santiago Palomino Sanchez-Manjavacas
Hi, This is based on a script that I downloaded with Porus. I think it was called porustest.py: http://prdownload.berlios.de/porus/porus-0.1.1.tgz I recommend you to test it. It has a command interface that is useful for debugging. Self is the command interpreter object, def getdevs(): """R

Re: [Pyusb-users] Mapping usb serial devices to device filenames

2009-06-17 Thread Brendan Simon (eTRIX)
Thanks Santiago :) Unfortunately I'm new to usb so it's not making too much sense at the moment. What is the class object that self is referring to here ? Is getdevs() your own function or a standard os function ? Presumably getdevs calls something like usb.busses() somewhere ? I don't see how t

Re: [Pyusb-users] Mapping usb serial devices to device filenames

2009-06-16 Thread Santiago Palomino Sanchez-Manjavacas
Well, you can use the device VID and PID to select which device to open. I use something like: def do_d(self, args): if self.devh is not None: self.do_close('') #ls if self.devh is None: self.devs=getdevs() shortlist(self.devs) dn = -1; index = 0;