1

The goal of my rule is having the network interface renamed from "eth0" (or whatever) to "gsm0" and to create a symlink /dev/ATCMD to /dev/ttyUSBX depending on the device we use to issue the AT commands.

I made this rule :

SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="02", GOTO="symlink_huaweiME909_end"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", SYMLINK+="ATCMD"
LABEL="symlink_huaweiME909_end"
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", NAME="gsm0"

The renaming of the interface works great but for the symlink part, it's only working at boot. If I manually bring down the gsm0 interface and bring it up again, the symlink is not redirected to /dev/ttyUSBX anymore. It goes from :

lrwxrwxrwx  1 root root           7 Jan  1  1970 ATCMD -> ttyUSB0

to :

lrwxrwxrwx  1 root root          15 Aug 14 11:03 ATCMD -> bus/usb/001/006

The command udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0) gives me :

  looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1:2.2/ttyUSB0/tty/ttyUSB0':
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1:2.2/ttyUSB0':
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="option1"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1:2.2':
    KERNELS=="1-1:2.2"
    SUBSYSTEMS=="usb"
    DRIVERS=="option"
    ATTRS{interface}=="Huawei Mobile Connect - Modem"
    ATTRS{bInterfaceProtocol}=="10"
    ATTRS{bInterfaceNumber}=="02"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{authorized}=="1"
    ATTRS{bNumEndpoints}=="03"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1':
    KERNELS=="1-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceClass}=="00"
    ATTRS{rx_lanes}=="1"
    ATTRS{manufacturer}=="Huawei Technologies Co., Ltd."
    ATTRS{bmAttributes}=="a0"
    ATTRS{bConfigurationValue}=="2"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="2"
    ATTRS{bMaxPower}=="2mA"
    ATTRS{idProduct}=="15c1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{urbnum}=="953"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{maxchild}=="0"
    ATTRS{bcdDevice}=="0102"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{idVendor}=="12d1"
    ATTRS{product}=="HUAWEI Mobile V7R11"
    ATTRS{speed}=="480"
    ATTRS{removable}=="unknown"
    ATTRS{ltm_capable}=="no"
    ATTRS{serial}=="0123456789ABCDEF"
    ATTRS{bNumConfigurations}=="3"
    ATTRS{busnum}=="1"
    ATTRS{authorized}=="1"
    ATTRS{tx_lanes}=="1"
    ATTRS{quirks}=="0x0"
    ATTRS{configuration}==""
    ATTRS{devpath}=="1"
    ATTRS{bDeviceProtocol}=="ff"
    ATTRS{bNumInterfaces}==" 7"

  looking at parent device '/devices/platform/soc/3f980000.usb/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceClass}=="09"
    ATTRS{rx_lanes}=="1"
    ATTRS{manufacturer}=="Linux 4.19.57 dwc_otg_hcd"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="1"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{idProduct}=="0002"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{urbnum}=="25"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{maxchild}=="1"
    ATTRS{bcdDevice}=="0419"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{idVendor}=="1d6b"
    ATTRS{product}=="DWC OTG Controller"
    ATTRS{speed}=="480"
    ATTRS{authorized_default}=="1"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{ltm_capable}=="no"
    ATTRS{serial}=="3f980000.usb"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{busnum}=="1"
    ATTRS{authorized}=="1"
    ATTRS{tx_lanes}=="1"
    ATTRS{quirks}=="0x0"
    ATTRS{configuration}==""
    ATTRS{devpath}=="0"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bNumInterfaces}==" 1"

and some more things after this.

Thank you for your help!

EDIT1: This rule works perfectly on kernel 4.1 but has this issue on 4.19

2
  • You can answer your own questions (and this Q&A style is encouraged by this site). You can also accept your own answer (after a wait).
    – dirkt
    Aug 16, 2019 at 6:17
  • Thanks ! I didn't know
    – Carton_
    Aug 16, 2019 at 7:51

1 Answer 1

0

I reworked my rule as follow and it's now working. So I use the above one for kernel 4.1 and the rule below for my machines on 4.19 :

SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="02", GOTO="symlink_huaweiME909_end"
SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", SYMLINK+="ATCMD"
LABEL="symlink_huaweiME909_end"
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="15c1", NAME="gsm0"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .