[time-nuts] LTE-Lite

Bob Stewart bob at evoria.net
Sat Nov 29 06:04:54 UTC 2014


For Linux, I worked this up and posted to linuxquestions.org.  I don't guarantee it, but it's been working for the PL-2303 devices for me.  It just creates a link to the "real" driver.  There are probably better ways to do it.

File: /etc/udev/rules.d/70-persistent-usb.rulesACTION=="add", KERNEL=="ttyUSB[0-9]*", PROGRAM="/etc/udev/rules.d/usb-parse-devpath.pm %p", SYMLINK+="ttyUSB%c"
File: /etc/udev/rules.d/usb-parse-devpath.pm#!/usr/bin/perl -w

@items = split("/", $ARGV[0]);
for ($i = 0; $i < @items; $i++) {
    if ($items[$i] =~ m/^usb[0-9]+$/) {

        if ($items[$i + 2] =~ m/:/) {
            print $items[$i + 1] . "\n";
        } else {
            print $items[$i + 2] . "\n";
        }

        last;
    }
}

Example:
crw-rw---- 1 root dialout 188, 0 Nov 28 20:59 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Nov 28 23:43 /dev/ttyUSB1
lrwxrwxrwx 1 root root         7 Nov 17 23:39 /dev/ttyUSB1-2 -> ttyUSB0
lrwxrwxrwx 1 root root         7 Nov 22 21:17 /dev/ttyUSB4-2 -> ttyUSB1
If the two code boxes don't make it through the list forwarder, the code can be found here.  Read the whole thread as I didn't put it all in the final post:
www.linuxquestions.org/questions/linux-hardware-18/usb-pl2303-reliable-device-names-4175506134/

Bob
     From: Orin Eman <orin.eman at gmail.com>
 To: Discussion of precise time and frequency measurement <time-nuts at febo.com> 
 Sent: Friday, November 28, 2014 11:41 PM
 Subject: Re: [time-nuts] LTE-Lite
   
On Fri, Nov 28, 2014 at 3:42 PM, Hal Murray <hmurray at megapathdsl.net> wrote:

>
> kb8tq at n1k.org said:
> > The “new chip ID, new com port” thing is pretty typical for the FTDI
> > drivers. If you plug the old LTE back in there’s a good chance it will
> come
> > back up as COMM 5. Usually they are pretty good about only adding ports
> for
> > devices they have not seen before.
>
> Most/some of the FTDI usb to serial chips have a serial number.  I don't
> know
> how it works on Windows, but on Linux, you can use the udev rules to make
> an
> alias so your software can refer to something with a filename like
> /dev/LITE
> rather than /dev/ttyUSB2.  It works no matter which slot you plug it into
> and/or still works after it gets unplugged and reconnected.
>


It's really a limitation of USB.  You have the vendor ID, product ID, and
for some devices, a serial number.

IF the device has a serial number, next time it's plugged in, the OS can be
pretty certain it's the same device and can use the same COM port or device
assignment as last time.  If not, all bets are off.

If a USB device has no serial number, Windows choses to use the physical
USB port the device is plugged into.  I.e. if you plug such a device with
the same vendor ID/product ID into the same USB port, you get the same COM
port assignment.  I really don't know of a better way.  It's unfortunate
that for a device with no serial number, if you plug the same device into a
different USB port, you get a different COM port, but it is the best
solution for the case where you have more than one USB device with the same
vendor ID/product ID... it works just the same as traditional RS232 ports:
the COM port assignment depends on which socket you plug the device in.

It is also unfortunate that the USB specs allowed this to happen and didn't
require devices to have a serial number.


_______________________________________________
time-nuts mailing list -- time-nuts at febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


  


More information about the Time-nuts_lists.febo.com mailing list