[opensuse-factory] How to fix ttyUSBn numbers?
Hi guys The situation: I use Lady Heather software (any time-nut here?) in order to monitor/control a lot of GPSDOs and other timing devices. Every instance of Lady Heather running uses a USB to serial cable ( the vast majority of GPSDOs uses DB9 connectors), so, sometimes I have 5 cables connected. The problem: Every time I reboot the computer the ID of the cables is changed (sometimes even without reboot). The doubt: How do I fix this situation? Thanks Luiz Alberto Saba -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Jan 09 2019, Luiz Alberto Saba
The problem:
Every time I reboot the computer the ID of the cables is changed (sometimes even without reboot).
The doubt:
How do I fix this situation?
Try using the links from /dev/serial/by-{id,path} instead. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Andreas Schwab wrote:
On Jan 09 2019, Luiz Alberto Saba
wrote: The problem:
Every time I reboot the computer the ID of the cables is changed (sometimes even without reboot).
The doubt:
How do I fix this situation?
Try using the links from /dev/serial/by-{id,path} instead.
Ah, I should have a look at this, too. What I use here is /etc/udev/rules.d/70-persistent-usb.rules to give them unique names. SUBSYSTEM=="tty", ACTION=="add", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", KERNEL=="ttyUSB*", SYMLINK="synscan" SUBSYSTEM=="tty", ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", KERNEL=="ttyUSB*", SYMLINK="focus" SUBSYSTEM=="tty", ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", KERNEL=="ttyUSB*", SYMLINK="eqmod" In this case it's easy because already product/vendor IDs are different. There's also other attributes available, like serial numbers, that can be used in those rules. Check maybe with lsusb for unique parameters for the units. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Wednesday, 9 January 2019 12:42 Luiz Alberto Saba wrote:
I use Lady Heather software (any time-nut here?) in order to monitor/control a lot of GPSDOs and other timing devices.
Every instance of Lady Heather running uses a USB to serial cable ( the vast majority of GPSDOs uses DB9 connectors), so, sometimes I have 5 cables connected.
The problem:
Every time I reboot the computer the ID of the cables is changed (sometimes even without reboot).
The doubt:
How do I fix this situation?
If you are able to distinguish the tty to USB devices, you can add udev rules to enforce persistent names for them (or create persistent symlinks). I tried mine and I get unicorn:~ # udevadm info -a -n /dev/ttyUSB1 ... ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403" ... ATTRS{serial}=="FT92IO3D" but I only have one so that I cannot say if the "serial" attribute is guaranteed to be unique among devices with the same vendor and product id (and if it's provided by other tty to USB adapters). Michal Kubeček -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Jan 09 2019, Michal Kubecek
I tried mine and I get
unicorn:~ # udevadm info -a -n /dev/ttyUSB1 ... ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403" ... ATTRS{serial}=="FT92IO3D"
but I only have one so that I cannot say if the "serial" attribute is guaranteed to be unique among devices with the same vendor and product id (and if it's provided by other tty to USB adapters).
Definitely not, here it is just the pci number. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Mittwoch, 9. Januar 2019 13:10:52 CET Andreas Schwab wrote:
On Jan 09 2019, Michal Kubecek
wrote: I tried mine and I get
unicorn:~ # udevadm info -a -n /dev/ttyUSB1 ...
ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403"
...
ATTRS{serial}=="FT92IO3D"
but I only have one so that I cannot say if the "serial" attribute is guaranteed to be unique among devices with the same vendor and product id (and if it's provided by other tty to USB adapters).
Definitely not, here it is just the pci number.
ATTRS in udev walks up the sysfs tree until it finds a matching attribute (contrary to ATTR). The USB root hubs have a fake serial, which uses the PCI bus path. E.g. XHCI exposes both a USB 2.0 and USB 3.0 root hub, and you end up with the same serial attribute value although devices are on different logical busses (although likely same physical bus, as the logical busses share the same physical connectors). Kind regards, Stefan -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
We used to use these because they had unique serial numbers, allowing
fixed port assignment to a device:
https://www.digi.com/products/networking/usb-connectivity/usb-over-serial/ed...
On Wed, Jan 9, 2019 at 9:17 AM Brüns, Stefan
On Mittwoch, 9. Januar 2019 13:10:52 CET Andreas Schwab wrote:
On Jan 09 2019, Michal Kubecek
wrote: I tried mine and I get
unicorn:~ # udevadm info -a -n /dev/ttyUSB1 ...
ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403"
...
ATTRS{serial}=="FT92IO3D"
but I only have one so that I cannot say if the "serial" attribute is guaranteed to be unique among devices with the same vendor and product id (and if it's provided by other tty to USB adapters).
Definitely not, here it is just the pci number.
ATTRS in udev walks up the sysfs tree until it finds a matching attribute (contrary to ATTR). The USB root hubs have a fake serial, which uses the PCI bus path.
E.g. XHCI exposes both a USB 2.0 and USB 3.0 root hub, and you end up with the same serial attribute value although devices are on different logical busses (although likely same physical bus, as the logical busses share the same physical connectors).
Kind regards,
Stefan -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Mi, 2019-01-09 at 13:01 +0100, Michal Kubecek wrote:
I tried mine and I get
unicorn:~ # udevadm info -a -n /dev/ttyUSB1 ... ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403" ... ATTRS{serial}=="FT92IO3D"
but I only have one so that I cannot say if the "serial" attribute is guaranteed to be unique among devices with the same vendor and product id (and if it's provided by other tty to USB adapters).
USB serial numbers are guaranteed to be unique. But not to exist. Yet we are talking about udev's notion of 'serial', which is not identical. USB also has port numbers, which you can see linked to in /sys/bus/usb/devices/ The bus numbers, however, are not stable. The full path can be used it is as stable as the paths on the bus the HC sits on (on x86 usually PCI) It would recommend going by that and not vendor/product, as it sucks if your system fails just because you have replaced a faulty serial device. Regards Oliver -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Mittwoch, 9. Januar 2019 13:29:48 CET Oliver Neukum wrote:
On Mi, 2019-01-09 at 13:01 +0100, Michal Kubecek wrote:
I tried mine and I get
unicorn:~ # udevadm info -a -n /dev/ttyUSB1 ...
ATTRS{idProduct}=="6001" ATTRS{idVendor}=="0403"
...
ATTRS{serial}=="FT92IO3D"
but I only have one so that I cannot say if the "serial" attribute is guaranteed to be unique among devices with the same vendor and product id (and if it's provided by other tty to USB adapters).
USB serial numbers are guaranteed to be unique. But not to exist. Yet we are talking about udev's notion of 'serial', which is not identical.
There is no such guarantee, and it is often false for USB-serial-converters (clones). Just search for A50285BI, which is a typical serial ID of of FTDI clones. Cheap CP210x breakout boards often have a serial of "0" set, although this can be reprogrammed at will. I have a genuine CP2102N dev board here, which has a seemingly unique 32 hex digit serial, but that is a rare one. ATTRS{serial} *is* the serial ID string retrieved from the device, if it exists. Do not confuse ATTRS (retrieved from sysfs) with the env variables, e.g. env{'ID_SERIAL'} (identifier based on name and possibly serial}, or env{'ID_SERIAL_SHORT'} (just the serial number, if it exists). Regards, Stefan-- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
participants (7)
-
Andreas Schwab
-
Brüns, Stefan
-
Luiz Alberto Saba
-
Michal Kubecek
-
Oliver Neukum
-
Peter Suetterlin
-
Philip Tait