summaryrefslogtreecommitdiff
path: root/src/etc
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2026-04-16 14:38:04 +0100
committerGitHub <noreply@github.com>2026-04-16 14:38:04 +0100
commitb7288119c09c8ea68501972ab8cc10091e6cc211 (patch)
tree102b8a652e3fa4b1a24a837086cf19c90c719843 /src/etc
parent62884420d0671ef9595d88dca57af4f4bc146b45 (diff)
parent8f5934e9a7f75a18b7399b163fe8e898a63ce77c (diff)
downloadvyos-1x-b7288119c09c8ea68501972ab8cc10091e6cc211.tar.gz
vyos-1x-b7288119c09c8ea68501972ab8cc10091e6cc211.zip
Merge pull request #5113 from srnoth/T8211-multiport-serial-symlinks
serial: T8211: fix symlink collisions for multi-port USB serial adapters
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/udev/rules.d/90-vyos-serial.rules6
1 files changed, 4 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..3fb34d16a 100644
--- a/src/etc/udev/rules.d/90-vyos-serial.rules
+++ b/src/etc/udev/rules.d/90-vyos-serial.rules
@@ -22,7 +22,9 @@ 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}=="?*", PROGRAM="/bin/sh -c 'echo $env{ID_PATH} | cut -d- -f3- | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", ENV{.BY_BUS}="%c"
+ENV{.BY_BUS}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-bus/%E{.BY_BUS}"
+ENV{.BY_BUS}=="?*", ENV{.ID_PORT}=="0", SYMLINK+="serial/by-bus/%E{.BY_BUS}"
+ENV{.BY_BUS}=="?*", ENV{.ID_PORT}=="?*", ENV{.ID_PORT}!="0", SYMLINK+="serial/by-bus/%E{.BY_BUS}p%E{.ID_PORT}"
LABEL="serial_end"