我有一个连接到 Sierra Wireless WP7610 的嵌入式 Linux 设备。 WP7610 具有三个 USB 串行端口,分别为 0、1 和 2。在 WP7610 重置之前(例如通过向其发送 AT+RESET 命令),这一切都很好。当它重新出现时,USB 端口被枚举为 1、2 和 3。我的假设是 /dev/ttyUSB0 被某个东西占用,但我不知道是什么。
重置之前设备显示为:
# ls -al /dev/ttyUSB*
crw-rw---- 1 root root 188, 0 Feb 15 13:05 /dev/ttyUSB0
crw-rw---- 1 root root 188, 1 Feb 15 13:05 /dev/ttyUSB1
crw-rw---- 1 root root 188, 2 Feb 15 13:05 /dev/ttyUSB2
# cat /proc/devices | grep -i “ttyUSB”
188 ttyUSB
# cat /proc/tty/driver/usbserial
usbserinfo:1.0 driver:2.0
0: module:GobiSerial name:"GobiSerial" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
1: module:GobiSerial name:"GobiSerial" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
2: module:GobiSerial name:"GobiSerial" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
# lsmod
Module Size Used by Tainted: G
GobiNet 460334 0
GobiSerial 18134 3
usbserial 41154 7 GobiSerial
rndis_host 9899 0
cdc_ether 9675 1 rndis_host
usbnet 34161 3 GobiNet,rndis_host,cdc_ether
mii 4994 1 usbnet
cdc_acm 24834 0
ehci_ambarella 3615 0
ehci_hcd 77691 1 ehci_ambarella
usbcore 244473 9 GobiNet,GobiSerial,usbserial,rndis_host,cdc_ether,usbnet,cdc_acm,ehci_ambarella,ehci_hcd
cfg80211 337122 0
rfkill 13990 1 cfg80211
# cat /proc/tty/drivers
/dev/tty /dev/tty 5 0 system:/dev/tty
/dev/console /dev/console 5 1 system:console
/dev/ptmx /dev/ptmx 5 2 system
/dev/vc/0 /dev/vc/0 4 0 system:vtmaster
usbserial /dev/ttyUSB 188 0-511 serial
acm /dev/ttyACM 166 0-255 serial
ambarella-uart /dev/ttyS 4 64-66 serial
pty_slave /dev/pts 136 0-1048575 pty:slave
pty_master /dev/ptm 128 0-1048575 pty:master
unknown /dev/tty 4 1-63 console
重置后:
# ls -al /dev/ttyUSB*
crw-rw---- 1 root root 188, 1 Feb 19 14:55 /dev/ttyUSB1
crw-rw---- 1 root root 188, 2 Feb 19 14:55 /dev/ttyUSB2
crw-rw---- 1 root root 188, 3 Feb 19 14:55 /dev/ttyUSB3
# cat /proc/tty/drivers
/dev/tty /dev/tty 5 0 system:/dev/tty
/dev/console /dev/console 5 1 system:console
/dev/ptmx /dev/ptmx 5 2 system
/dev/vc/0 /dev/vc/0 4 0 system:vtmaster
usbserial /dev/ttyUSB 188 0-511 serial
acm /dev/ttyACM 166 0-255 serial
ambarella-uart /dev/ttyS 4 64-66 serial
pty_slave /dev/pts 136 0-1048575 pty:slave
pty_master /dev/ptm 128 0-1048575 pty:master
unknown /dev/tty 4 1-63 console
# cat /proc/tty/driver/usbserial
usbserinfo:1.0 driver:2.0
1: module:GobiSerial name:"GobiSerial" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
2: module:GobiSerial name:"GobiSerial" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
3: module:GobiSerial name:"GobiSerial" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
我要么想阻止这种情况发生,要么能够解决它。我尝试删除新的 USB 端口,然后重新定义它们:
rm /dev/ttyUSB1
rm /dev/ttyUSB2
rm /dev/ttyUSB3
mknod /dev/ttyUSB0 c 188 0
mknod /dev/ttyUSB1 c 188 1
mknod /dev/ttyUSB2 c 188 2
但这并没有改变cat /proc/tty/driver/usbserial
。我尝试卸载驱动程序:
rmmod /lib/modules/GobiSerial.ko
modprobe -r usbserial
但失败并出现错误:
modprobe: can't unload module 'usbserial': Resource temporarily unavailable
我尝试用 qcserial 替换 GobiSerial 但我看到了同样的问题:
cat /proc/tty/driver/usbserial
usbserinfo:1.0 driver:2.0
1: module:qcserial name:"Qualcomm USB modem" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
2: module:qcserial name:"Qualcomm USB modem" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1
3: module:qcserial name:"Qualcomm USB modem" vendor:1199 product:68c0 num_ports:1 port:0 path:usb-AmbUSB-1