[lug] USB-to-Serial port assignment

Kevin B solelist at skyshadows.net
Wed Jan 12 14:19:08 MST 2011


You should be able to create custom udev rules based on which USB port
they're plugged into.  If you run "udevinfo -a -p /sys/class/tty/ttyUSB0' it
will spit out a ton of information about it.  What you're looking for is
something like ID=="1-4.2:1.0" .  You can then create a custom udev rule for
this, doing something like this:

BUS="usb", ID=="1-4.2:1.0", SYMLINK+="ttyUSBport2"

You can add this to a udev rule (such as creating a separate udev rule file
for this /etc/udev/rules.d/60-ttyusb.rules)

You'll end up creating a new /dev symlink for it, however there is a way to
get it to give the normal ttyUSB#.

I found this thread helpful for this:
http://www.linuxquestions.org/questions/linux-general-1/udev-rules-to-differentiate-between-multiple-identical-devices-822879/

On Wed, Jan 12, 2011 at 1:56 PM, Michael J. Hammel <
mjhammel at graphics-muse.org> wrote:

> We've got a bunch of target boards that we connect to a host system via
> USB-to-Serial connections.  USB on the host side, serial on the target
> side.  The USB connections are through an external hub connected to a
> host hub.  We use screen to connect to the USB ports on the host.  This
> works fine until a reboot, when the USB port assignments may change.
> ttyUSB0 might point to board A and ttyUSB1 to board B before a reboot,
> but after the reboot they might be switched.
>
> Is there a way to force the assignments to remain the same?  If not,
> anyone have any clever ways of figuring out how to identify the target
> side of the USB/Serial connection short of running screen and testing
> them manually?
>
> My guess here is "no" - but I thought I'd ask anyway.
>
> Maybe there is a way to connect multiple external hubs that we can
> identify or the system will identify with different device file names?
> Any mechanism of allowing use of lots of USB ports on the host to
> connect to lots of external boards and being able to know which board
> we're talking to when we connect to the USB device file.
>
> --
> Michael J. Hammel                                    Principal Software
> Engineer
> mjhammel at graphics-muse.org
> http://graphics-muse.org
>
> ------------------------------------------------------------------------------
> When C++ is your hammer, everything looks like a thumb.
>              -- Steven M. Haflich
>
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20110112/152e989f/attachment.html>


More information about the LUG mailing list