diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-06-07 17:09:31 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-06-07 17:09:31 +0200 |
commit | 6179a89fd4c14acfac478c9770263fcf7f3ce246 (patch) | |
tree | 0f0d3a76682a65ef076b6fb628a312d04ffe05a5 /src/etc/udev | |
parent | 760bf1a9bcac34bd786aa62edbe9a01d03e10f99 (diff) | |
parent | b5cc8f4ae4178761d64c3e01e133c79219c2d756 (diff) | |
download | vyos-1x-6179a89fd4c14acfac478c9770263fcf7f3ce246.tar.gz vyos-1x-6179a89fd4c14acfac478c9770263fcf7f3ce246.zip |
Merge branch 'udev' of github.com:c-po/vyos-1x into current
* 'udev' of github.com:c-po/vyos-1x:
usb: op-mode: T2560: display USB interface information
pppoe: op-mode: T2488: retrieve log info from journalctl
wwan: op-mode: T2488: retrieve log info from journalctl
wwan: T2241: interface is not bond- or bridgeable
wwan: T2488: remove generation of dedicated logfile
wwan: T2529: migrate device from ttyUSB to usbXbY.YpZ.Z
udev: T2490: add persistent USB device files
Diffstat (limited to 'src/etc/udev')
-rw-r--r-- | src/etc/udev/rules.d/90-vyos-serial.rules | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/etc/udev/rules.d/90-vyos-serial.rules b/src/etc/udev/rules.d/90-vyos-serial.rules new file mode 100644 index 000000000..3f10f4924 --- /dev/null +++ b/src/etc/udev/rules.d/90-vyos-serial.rules @@ -0,0 +1,28 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="serial_end" +SUBSYSTEM!="tty", GOTO="serial_end" + +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" +SUBSYSTEMS=="pci", IMPORT{builtin}="hwdb --subsystem=pci" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb" + +# /dev/serial/by-path/, /dev/serial/by-id/ for USB devices +KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end" + +SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}" + +IMPORT{builtin}="path_id", IMPORT{builtin}="usb_id" + +# Change the name of the usb id to a "more" human redable format. +# +# - $env{ID_PATH} usually is a name like: "pci-0000:00:10.0-usb-0:2.3.3.4:1.0-port0" so we strip the "pci-*" +# portion and only use the usb part +# - Transform the USB "speach" to the tree like structure so we start with "usb0" as root-complex 0. +# (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 'D=$env{ID_PATH}; echo ${D:17} | 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 'D=$env{ID_PATH}; echo ${D:17} | tr -d - | sed -e 0,/:/s//b/ | sed -e 0,/:/s//p/'", SYMLINK+="serial/by-bus/$result" + +LABEL="serial_end" |