Unique Serial Number via USB #features


 

Hi,

If you have some identical devices this new feature allows to distinguish them, e.g. in udev-rules to create unique port names. After the implementation for the tinaSA - https://groups.io/g/tinysa/message/17259 - here's the source for DiSlord's NanoVNA-H and -H4:
https://github.com/Ho-Ro/NanoVNA-D/tree/UniqueSerNum
and the PR #86:
https://github.com/DiSlord/NanoVNA-D/pull/86

[ +4,291864] usb 2-1: new full-speed USB device number 9 using uhci_hcd
[ +0,186038] usb 2-1: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ +0,000009] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ +0,000003] usb 2-1: Product: NanoVNA-H
[ +0,000002] usb 2-1: Manufacturer: nanovna.com
[ +0,000002] usb 2-1: SerialNumber: 204C33765434
[ +0,005054] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

Enjoy,
Martin


 

Based on the serial number you can either create udev rules to distinguish similar devices as mentioned at https://groups.io/g/tinysa/topic/unique_serial_number_via_usb/106933651 or you just use the symlinks that Linux automatically creates from ATTRS{manufacturer}, ATTRS{product}, ATTRS{serial}

$ ls -l /dev/serial/by-id/usb-*
lrwxrwxrwx 1 root root 13 4. Jul 21:29 /dev/serial/by-id/usb-nanovna.com_NanoVNA-H_204C33765434-if00 -> ../../ttyACM0
lrwxrwxrwx 1 root root 13 4. Jul 21:29 /dev/serial/by-id/usb-tinysa.org_tinySA_206237903730-if00 -> ../../ttyACM1