summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Nothnagel <srnoth@users.noreply.github.com>2026-04-06 14:54:35 -0400
committerStephen Nothnagel <srnoth@users.noreply.github.com>2026-04-06 14:57:41 -0400
commit2509879017df77a0a7478df63d3e30c193c5ed7c (patch)
treeaf22b100ef19d860666cd1dd29b84763dab55704 /src
parent0792a6b2b7ab32006ff45832a35de4536547cbd3 (diff)
downloadvyos-1x-2509879017df77a0a7478df63d3e30c193c5ed7c.tar.gz
vyos-1x-2509879017df77a0a7478df63d3e30c193c5ed7c.zip
serial: T8211: fix symlink collisions for multi-port USB serial adapters
Multi-port USB serial adapters (e.g., MosChip MCS7840) where all ports share the same USB ID_PATH create identical symlink names in /dev/serial/by-bus/, causing only the last-enumerated port to be accessible. Split the existing catch-all rule for devices with .ID_PORT into two cases: - Port 0: keeps the base symlink name (backward compatible) - Port 1+: appends pN suffix (e.g., usb0b1.4.1p1.0p1) Devices where each port has a unique ID_PATH (e.g., FTDI FT4232H) and single-port devices are unaffected.
Diffstat (limited to 'src')
-rw-r--r--src/etc/udev/rules.d/90-vyos-serial.rules5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/etc/udev/rules.d/90-vyos-serial.rules b/src/etc/udev/rules.d/90-vyos-serial.rules
index 1fe7ee5ba..41cd7b381 100644
--- a/src/etc/udev/rules.d/90-vyos-serial.rules
+++ b/src/etc/udev/rules.d/90-vyos-serial.rules
@@ -22,7 +22,8 @@ IMPORT{builtin}="path_id", IMPORT{builtin}="usb_id"
# (tr -d -) does the replacement
# - Replace the first group after ":" to represent the bus relation (sed -e 0,/:/s//b/) indicated by "b"
# - Replace the next group after ":" to represent the port relation (sed -e 0,/:/s//p/) indicated by "p"
-ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | cut -d- -f3- | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", SYMLINK+="serial/by-bus/$result"
-ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | cut -d- -f3- | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", SYMLINK+="serial/by-bus/$result"
+ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | cut -d- -f3- | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", SYMLINK+="serial/by-bus/$result"
+ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="0", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | cut -d- -f3- | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", SYMLINK+="serial/by-bus/$result"
+ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", ENV{.ID_PORT}!="0", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | cut -d- -f3- | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", SYMLINK+="serial/by-bus/%cp%E{.ID_PORT}"
LABEL="serial_end"