I have a dlink DW-157 3g dongle. I am trying to assign the same port to the dongle everytime it boots up by modifying the udev rules file. Since the dongle on boot boots up as a storage media, I have to enter the command below to eject and mount for modem mode and then other command below it to make use of the ttyUSB ports of the modem for running a dial up modem.
sudo eject /dev/sr0
sudo /bin/sh -c "echo 2001 7d0e > /sys/bus/usb-serial/drivers/option1/new_id
After entering these, sudo dmesg| grep ttyUSB appears as:
[ 17.581264] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1
[ 17.584470] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2
[ 17.593854] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB3
[ 17.594869] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB4
The actual port on which I can use the modem for dial up is ttyUSB1. So, I'm trying to assign ttyUSB1 to d_uart in my udev rules file:
ACTION=="add", ATTRS{idVendor}=="2001", ATTRS{idProduct}=="7d0e", SYMLINK+="d_uart"
But what happens is d_uart gets assigned to ttyUSB4. What do I do to assign it to the first port always (ttyUSB1 in this case) ?
Also, the output of the command for ttyUSB1,ttyUSB2,ttyUSB3 and ttyUSB4 for the comnand below:
udevadm info -a -n /dev/ttyUSB4 | grep '{serial}' | head -n1
is the same.
ATTRS{serial}=="3f980000.usb"
Also, output of command ls -l /dev/d_uart
lrwxrwxrwx 1 root root 7 Oct 3 13:27 /dev/d_uart -> ttyUSB4
lsusb output:
Bus 001 Device 006: ID 2001:7d0e D-Link Corp.
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root h
Output of udevadm info -n /dev/ttyUSB2:
P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.3/ttyUSB2/tty/ttyUSB2
N: ttyUSB2
S: d_uart
S: serial/by-id/usb-D-Link_Inc_D-Link_DWM-157-if03-port0
S: serial/by-path/platform-3f980000.usb-usb-0:1.4:1.3-port0
E: DEVLINKS=/dev/d_uart /dev/serial/by-id/usb-D-Link_Inc_D-Link_DWM-157-if03-port0 /dev/serial/by-path/platform-3f980000.usb-usb-0:1.4:1.3-port0
E: DEVNAME=/dev/ttyUSB2
E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.3/ttyUSB2/tty/ttyUSB2
E: ID_BUS=usb
E: ID_MODEL=D-Link_DWM-157
E: ID_MODEL_ENC=D-Link\x20DWM-157
E: ID_MODEL_ID=7d0e
E: ID_PATH=platform-3f980000.usb-usb-0:1.4:1.3
E: ID_PATH_TAG=platform-3f980000_usb-usb-0_1_4_1_3
E: ID_REVISION=0300
E: ID_SERIAL=D-Link_Inc_D-Link_DWM-157
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Miscellaneous Device
E: ID_USB_DRIVER=option
E: ID_USB_INTERFACES=:020e00:0a0002:ff0201:ff0000:080650:
E: ID_USB_INTERFACE_NUM=03
E: ID_USB_PROTOCOL_FROM_DATABASE=Interface Association
E: ID_VENDOR=D-Link_Inc
E: ID_VENDOR_ENC=D-Link\x2cInc\x20\x20
E: ID_VENDOR_FROM_DATABASE=D-Link Corp.
E: ID_VENDOR_ID=2001
E: MAJOR=188
E: MINOR=2
E: SUBSYSTEM=tty
E: TAGS=:systemd:
E: USEC_INITIALIZED=978899
lsusb
outputto your post pleaselsusb
does not help much in your case unfortunately. would you mind to add ` udevadm info -n` for all other serial ports of that device?