Я использую Ubuntu 16.04.1 Server. К одному USB-порту сервера подключен модемный пул. Когда модем выключается и снова включается, номера ttyUSB
меняются. Мне нужно исправить эти порты. Итак, я поместил приведенные ниже правила в файл в /etc/udev/rules.d
и перезапустил службу udev с помощью systemctl restart udev.service
# cat /etc/udev/rules.d/86-persistent-gsm-modem.rules
KERNEL=="ttyUSB*", SUBSYSTEM=="tty", KERNELS=="1-1.5:1.0", DRIVERS=="ftdi_sio", ATTRS{product}=="Quad RS232-HS", ATTRS{manufacturer}=="FTDI", NAME="ttyUSB0"
KERNEL=="ttyUSB*", SUBSYSTEM=="tty", KERNELS=="1-1.5:1.1", DRIVERS=="ftdi_sio", ATTRS{product}=="Quad RS232-HS", ATTRS{manufacturer}=="FTDI", NAME="ttyUSB1"
KERNEL=="ttyUSB*", SUBSYSTEM=="tty", KERNELS=="1-1.5:1.2", DRIVERS=="ftdi_sio", ATTRS{product}=="Quad RS232-HS", ATTRS{manufacturer}=="FTDI", NAME="ttyUSB2"
KERNEL=="ttyUSB*", SUBSYSTEM=="tty", KERNELS=="1-1.5:1.3", DRIVERS=="ftdi_sio", ATTRS{product}=="Quad RS232-HS", ATTRS{manufacturer}=="FTDI", NAME="ttyUSB3"
При выключении и повторном включении модема все еще номера ttyUSB
меняются.
Есть ли проблема с правилами, и как я могу проверить, читаются ли правила udev и выполняются ли?
Например, добавление вывода udevadm для /dev /ttyUSB0.
udevadm info -a /dev/ttyUSB0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0/ttyUSB0/tty/ttyUSB0':
KERNEL=="ttyUSB0"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0/ttyUSB0':
KERNELS=="ttyUSB0"
SUBSYSTEMS=="usb-serial"
DRIVERS=="ftdi_sio"
ATTRS{latency_timer}=="1"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5/1-1.5:1.0':
KERNELS=="1-1.5:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="ftdi_sio"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="ff"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="ff"
ATTRS{bInterfaceSubClass}=="ff"
ATTRS{bNumEndpoints}=="02"
ATTRS{interface}=="Quad RS232-HS"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.5':
KERNELS=="1-1.5"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="500mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 4"
ATTRS{bcdDevice}=="0800"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="3"
ATTRS{devpath}=="1.5"
ATTRS{idProduct}=="6011"
ATTRS{idVendor}=="0403"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="FTDI"
ATTRS{maxchild}=="0"
ATTRS{product}=="Quad RS232-HS"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{speed}=="480"
ATTRS{urbnum}=="4960883"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1/1-1':
KERNELS=="1-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0000"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="2"
ATTRS{devpath}=="1"
ATTRS{idProduct}=="0020"
ATTRS{idVendor}=="8087"
ATTRS{ltm_capable}=="no"
ATTRS{maxchild}=="6"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="fixed"
ATTRS{speed}=="480"
ATTRS{urbnum}=="31"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb1':
KERNELS=="usb1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0404"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="1"
ATTRS{devpath}=="0"
ATTRS{idProduct}=="0002"
ATTRS{idVendor}=="1d6b"
ATTRS{interface_authorized_default}=="1"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 4.4.0-34-generic ehci_hcd"
ATTRS{maxchild}=="2"
ATTRS{product}=="EHCI Host Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{serial}=="0000:00:1a.0"
ATTRS{speed}=="480"
ATTRS{urbnum}=="24"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:1a.0':
KERNELS=="0000:00:1a.0"
SUBSYSTEMS=="pci"
DRIVERS=="ehci-pci"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0320"
ATTRS{companion}==""
ATTRS{consistent_dma_mask_bits}=="32"
ATTRS{d3cold_allowed}=="1"
ATTRS{device}=="0x3b3c"
ATTRS{dma_mask_bits}=="32"
ATTRS{driver_override}=="(null)"
ATTRS{enable}=="1"
ATTRS{irq}=="16"
ATTRS{local_cpulist}=="0-3"
ATTRS{local_cpus}=="000f"
ATTRS{msi_bus}=="1"
ATTRS{numa_node}=="-1"
ATTRS{subsystem_device}=="0x8383"
ATTRS{subsystem_vendor}=="0x1043"
ATTRS{uframe_periodic_max}=="100"
ATTRS{vendor}=="0x8086"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""