From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Bender Date: Sat, 30 Jan 2010 18:25:03 +0000 Subject: Re: Multi-serial USB Device Message-Id: <4B64797F.5060400@san.rr.com> List-Id: References: <7a09e2151001301005m29daf8c8ndad88969d63918a4@mail.gmail.com> In-Reply-To: <7a09e2151001301005m29daf8c8ndad88969d63918a4@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On 1/30/2010 10:05 AM, Paul Dugas wrote: > First, please point me where I should be asking if this is not the > place. Thanks. > > I've got a number of USB devices I need to connect to a data-logging > machine. Each device presents as 3 USB serial ports which are > properly recognized and setup as ttyUSB[0-2] once I added the right > vendor and product numbers to the module loader configs. When I > connect the second device, I get ttyUSB[3-5]. I've been able to setup > udev rules that recognize the serial numbers for each of the devices > and can setup symlinks; i.e. ttyLogger1USB[0-2] -> ttyUSB?. > Something like so... > > KERNEL="ttyUSB*", SYSFS{serial}="111", SYMLINK+="ttyLogger1USB%n" > KERNEL="ttyUSB*", SYSFS{serial}="222", SYMLINK+="ttyLogger2USB%n" > KERNEL="ttyUSB*", SYSFS{serial}="333", SYMLINK+="ttyLogger3USB%n" > > My hitch is that the %n values on the end of the SYMLINK setting > result in 0-2 for the first logger found, 3-5 for the second, etc. I > really want them to be 0-2 for all of the loggers. But, looking at > the udevinfo for the 3 ports on one logger, they're identical. > > I tried adding a PROGRAM setting to run a little script that looked to > count the /dev/ttyLogger1USB* devices had already been created and it > always returned 0. Are the device files and symlinks created in > parallel or in bulk at the end and thus this approach wouldn't work? > > I tried another PROGRAM that opened the port and polled the logger to > see what port this was (that's supported by the device's protocol) but > the device file didn't exist yet. Is there a way to trigger this > approach after the device file has been created? Is there a way to > temporarily create the device in the script instead? > > Anyone got a suggestion on how to solve this? I suspect that the device presents itself as 3 USB serial interfaces on one USB device. If so, then you should be able to use bInterfaceNumber to set the USB serial device number. For example, KERNEL="ttyUSB*", SYSFS{serial}="111", \ SYMLINK+="ttyLogger1USB$attr{bInterfaceNumber}" KERNEL="ttyUSB*", SYSFS{serial}="222", \ SYMLINK+="ttyLogger2USB$attr{bInterfaceNumber}" KERNEL="ttyUSB*", SYSFS{serial}="333", \ SYMLINK+="ttyLogger3USB$attr{bInterfaceNumber}"