All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Bender <pebender@san.rr.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Multi-serial USB Device
Date: Sat, 30 Jan 2010 18:25:03 +0000	[thread overview]
Message-ID: <4B64797F.5060400@san.rr.com> (raw)
In-Reply-To: <7a09e2151001301005m29daf8c8ndad88969d63918a4@mail.gmail.com>

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}"

  reply	other threads:[~2010-01-30 18:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30 18:05 Multi-serial USB Device Paul Dugas
2010-01-30 18:25 ` Paul Bender [this message]
2010-01-30 18:27 ` David Zeuthen
2010-01-30 18:34 ` Greg KH
2010-01-30 18:50 ` Paul Dugas
2010-01-30 18:50 ` Paul Dugas
2010-01-30 18:59 ` Paul Dugas
2010-01-30 19:58 ` David Zeuthen
2010-01-30 20:36 ` Paul Dugas
2010-01-31  0:47 ` Greg KH
2010-01-31  1:27 ` Paul Dugas
2010-01-31  2:55 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B64797F.5060400@san.rr.com \
    --to=pebender@san.rr.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.