udev를 통한 /dev/ttyUSB*의 심볼릭 링크

udev를 통한 /dev/ttyUSB*의 심볼릭 링크

그래서 저는 PC-Engines ALIX.2D13, Huawei E220 umts 모뎀, Debian Wheezy 및 gammu-smsd를 사용하여 작고 멋진 GSM 게이트웨이를 구축했습니다. 재부팅 후에도 gammu-smsd에 대한 고정 장치 이름이 필요합니다. 다음과 같은 udev 규칙을 만들어 보았지만 왜 작동하지 않는지 모르겠습니다.

SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", ATTRS{bInterfaceNumber}=="00", SYMLINK+="gsm0"
SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", ATTRS{bInterfaceNumber}=="01", SYMLINK+="gsm1"

내 udevadm 출력은 다음과 같습니다.

root@ko-smsgw-01:~# udevadm info -a -n /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:0f.4/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1/2-1:1.0/ttyUSB0':
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="option1"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1/2-1:1.0':
    KERNELS=="2-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="option"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bNumEndpoints}=="03"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bInterfaceSubClass}=="ff"
    ATTRS{bInterfaceProtocol}=="ff"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{interface}=="Data Interface"

  looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1':
    KERNELS=="2-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 3"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="a0"
    ATTRS{bMaxPower}=="500mA"
    ATTRS{urbnum}=="1126"
    ATTRS{idVendor}=="12d1"
    ATTRS{idProduct}=="1003"
    ATTRS{bcdDevice}=="0000"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="2"
    ATTRS{devnum}=="7"
    ATTRS{devpath}=="1"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="0"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="HUAWEI Technologies"
    ATTRS{product}=="HUAWEI Mobile"

  looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2':
    KERNELS=="usb2"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{configuration}==""
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bMaxPower}=="  0mA"
    ATTRS{urbnum}=="180"
    ATTRS{idVendor}=="1d6b"
    ATTRS{idProduct}=="0001"
    ATTRS{bcdDevice}=="0302"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{speed}=="12"
    ATTRS{busnum}=="2"
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{version}==" 1.10"
    ATTRS{maxchild}=="4"
    ATTRS{quirks}=="0x0"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{authorized}=="1"
    ATTRS{manufacturer}=="Linux 3.2.0-4-486 ohci_hcd"
    ATTRS{product}=="OHCI Host Controller"
    ATTRS{serial}=="0000:00:0f.4"
    ATTRS{authorized_default}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:0f.4':
    KERNELS=="0000:00:0f.4"
    SUBSYSTEMS=="pci"
    DRIVERS=="ohci_hcd"
    ATTRS{vendor}=="0x1022"
    ATTRS{device}=="0x2094"
    ATTRS{subsystem_vendor}=="0x1022"
    ATTRS{subsystem_device}=="0x2094"
    ATTRS{class}=="0x0c0310"
    ATTRS{irq}=="12"
    ATTRS{local_cpus}=="1"
    ATTRS{local_cpulist}=="0"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

답변1

이것 좀 보세요,http://reactivated.net/writing_udev_rules.html#udevinfo

관련 장치와 단일 상위 장치의 속성을 결합하는 것은 합법적이지만 여러 상위 장치의 속성을 혼합하고 일치시킬 수는 없습니다. 규칙이 작동하지 않습니다.

귀하의 예에 따르면 각 규칙에서 2개의 상위 장치를 참조하고 있는데 이는 잘못된 것입니다.

  1. ATTRS{bInterfaceNumber}==“00”

  2. ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003"

관련 정보