summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-12-04 01:43:33 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-12-04 01:43:33 +0100
commitbc4c751802147f1ff21bf52a57a2976754949453 (patch)
tree7368395b739bb9289da74600d6cd964858b2d48a /rules
parent43f7e87f549c9b0630f27c05b0bf15102f1ed8cc (diff)
rules: add persistent /dev/serial/{by-id,by-path} rules
$ tree /dev/serial/ /dev/serial/ |-- by-id | |-- usb-067b_2303-if00-port0 -> ../../ttyUSB0 | |-- usb-FTDI_FT232R_USB_UART_A7005uBP-if00-port0 -> ../../ttyUSB3 | |-- usb-HUAWEI_Technology_HUAWEI_Mobile-if00-port0 -> ../../ttyUSB1 | `-- usb-HUAWEI_Technology_HUAWEI_Mobile-if01-port0 -> ../../ttyUSB2 `-- by-path |-- pci-0000:00:1d.0-usb-0:1:1.0-port0 -> ../../ttyUSB3 |-- pci-0000:00:1d.7-usb-0:2.2.2:1.0-port0 -> ../../ttyUSB0 |-- pci-0000:00:1d.7-usb-0:2.3:1.0-port0 -> ../../ttyUSB1 `-- pci-0000:00:1d.7-usb-0:2.3:1.1-port0 -> ../../ttyUSB2 $ tree /dev/serial/ /dev/serial/ |-- by-id | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port0 -> ../../ttyUSB0 | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port1 -> ../../ttyUSB1 | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port2 -> ../../ttyUSB2 | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port3 -> ../../ttyUSB3 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port0 -> ../../ttyUSB8 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port1 -> ../../ttyUSB9 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port2 -> ../../ttyUSB10 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port3 -> ../../ttyUSB11 | `-- usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0 -> ../../ttyUSB7 `-- by-path |-- pci-0000:00:1d.2-usb-0:1.3:1.0-port0 -> ../../ttyUSB7 |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port0 -> ../../ttyUSB4 |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port1 -> ../../ttyUSB5 |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port2 -> ../../ttyUSB6 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port0 -> ../../ttyUSB0 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port1 -> ../../ttyUSB1 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port2 -> ../../ttyUSB2 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port3 -> ../../ttyUSB3 |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port0 -> ../../ttyUSB8 |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port1 -> ../../ttyUSB9 |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port2 -> ../../ttyUSB10 `-- pci-0000:00:1d.7-usb-0:6.3:1.0-port3 -> ../../ttyUSB11
Diffstat (limited to 'rules')
-rw-r--r--rules/rules.d/60-persistent-serial.rules19
1 files changed, 19 insertions, 0 deletions
diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules
new file mode 100644
index 0000000000..df10606e07
--- /dev/null
+++ b/rules/rules.d/60-persistent-serial.rules
@@ -0,0 +1,19 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add|change", GOTO="persistent_serial_end"
+SUBSYSTEM!="tty", GOTO="persistent_serial_end"
+KERNEL!="ttyUSB[0-9]*", GOTO="persistent_serial_end"
+
+SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}"
+ENV{ID_PORT}=="", GOTO="persistent_serial_end"
+
+IMPORT="path_id"
+ENV{ID_PATH}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}"
+
+IMPORT="usb_id --export"
+ENV{ID_SERIAL}=="", GOTO="persistent_serial_end"
+SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}"
+ENV{ID_IFACE}=="", GOTO="persistent_serial_end"
+SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}"
+
+LABEL="persistent_serial_end"