Page MenuHomeVyOS Platform

Add serial (rs232) to ssh bridge service
Closed, ResolvedPublicFEATURE REQUEST

Description

The ser2net daemon allows telnet and tcp sessions to be established with a unit's serial ports.

how could we call this service?

Details

Difficulty level
Hard (possibly days)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Event Timeline

c-po created this task.
c-po moved this task from Need Triage to Backlog on the VyOS 1.3 Equuleus board.
c-po renamed this task from Add ser2net service to Add serial (rs232) to ssh bridge service.May 22 2020, 6:56 PM
c-po updated the task description. (Show Details)

Maybe set service serial-bridge?

A friend also thought about set service nettty for network tty (which it is infact)

During testing I've found that there is a well known problem (we had for ethernet interfaces) also in the serial ports. They can be enumerated and mapped to /dev/ttyUSBxxx differently from boot to boot. This is especially painful on my development APU4 board which also has a Sierra Wireless MC7710 LTE module installed which operates via ttyUSB2 (when no serial console cable is attached) - on subsequent boots this can become ttyUSB3 or depending on the number of FT232 dongles I attach.

I've found that there is a udev rule (/usr/lib/udev/rules.d/60-serial.rules) which partly solves this by enumerating the devices into /dev/serial/by-id folder with their name and serial number - it's a very good idea but I've found that not all of the FT232 dongles have a serial number programmed, this leads to the situation that when you plug in two cables with both having serial number 0 - only one device symlink will appear.

Proposed solution:
Derive /usr/lib/udev/rules.d/60-serial.rules and create a /dev/serial/by-bus directory and group devices by attached USB root port. The original /dev/serial/by-path directoy is not too user firendly, and a nice "abbreviation" must be found.

Also serial ports should no longer be supported by their ttyUSBxxx name (should be fixed by a migration script` and in general be referred to by the USB port they are connected to in the real world as this will only change if the user reseat the connector

vyos@vyos:~$ ls -al /dev/serial/by-path/
total 0
drwxr-xr-x 2 root root 260 May 27 22:14 .
drwxr-xr-x 4 root root  80 May 27 22:14 ..
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:1.4:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:1.4:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:1.4:1.2-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:1.4:1.3-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:2.4:1.0-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:2.4:1.1-port0 -> ../../ttyUSB5
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:2.4:1.2-port0 -> ../../ttyUSB6
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:10.0-usb-0:2.4:1.3-port0 -> ../../ttyUSB7
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:13.0-usb-0:1.3:1.0-port0 -> ../../ttyUSB8
lrwxrwxrwx 1 root root  13 May 27 22:14 pci-0000:00:13.0-usb-0:1.3:1.2-port0 -> ../../ttyUSB9
lrwxrwxrwx 1 root root  14 May 27 22:14 pci-0000:00:13.0-usb-0:1.3:1.3-port0 -> ../../ttyUSB10
vyos@vyos:~$ find /dev/serial/by-bus/ -name usb* -exec basename {} \; | sort
usb0b1.3p1.0
usb0b1.3p1.2
usb0b1.3p1.3
usb0b2.4p1.0
usb0b2.4p1.1
usb0b2.4p1.2
usb0b2.4p1.3

So we have usb root 0 with bus1.3 and port 1.0. The enumeration is constant accross reboots and only changes if you physically unplug devices

Completion helper:

vyos@vyos# set service ser2net device
Possible completions:
 > ttySxxx      Regular serial interface
 > usbxbxpx     USB based serial interface
 > ttyS0
 > ttyS1
 > ttyS2
 > ttyS3
 > usb0b1.3p1.0
 > usb0b1.3p1.2
 > usb0b1.3p1.3
 > usb0b2.4p1.0
 > usb0b2.4p1.1
 > usb0b2.4p1.2
 > usb0b2.4p1.3

In addition a show opmode command should be added to list all the USB serial stuff in a human friendly way

c-po changed the task status from Open to In progress.Jun 19 2020, 2:33 PM
c-po triaged this task as Wishlist priority.
c-po changed Difficulty level from Unknown (require assessment) to Hard (possibly days).
c-po changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
c-po moved this task from Backlog to In Progress on the VyOS 1.3 Equuleus board.
c-po moved this task from In Progress to Finished on the VyOS 1.3 Equuleus board.