我曾经在我的 Linux Ubuntu 计算机上使用 usb_modeswitch 强制我的华为 E3531 调制解调器保持串行模式。我运行的是:
usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000011062000000100000000000000000000'
其中 12d1 是 ID 供应商,1f01 是产品供应商。它以前运行良好,然后我能够发送 AT 命令...
现在我使用 bananian 更改了 banana pi 的设置。这个模式切换命令不起作用。以下是发生的情况
Taking all parameters from the command line
* usb_modeswitch: handle USB devices with multiple modes * Version
1.2.3 (C) Josua Dietze 2012 * Based on libusb0 (0.1.12 and above)
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x12d1
DefaultProduct= 0x1f01
TargetVendor= not set
TargetProduct= not set
TargetClass= not set
TargetProductList=""
DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint= not set
MessageContent="55534243123456780000000000000011060000001000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set
InquireDevice disabled
Success check disabled
System integration mode disabled
usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_devices: Found 002 on 004
usb_os_find_devices: Found 001 on 004
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 001 on 002
usb_os_find_devices: Found 018 on 001
skipped 3 class/vendor specific interface descriptors
usb_os_find_devices: Found 004 on 001
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 003 on 001
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device
Looking for default devices ... searching devices, found USB ID
0403:6001
searching devices, found USB ID 1d6b:0001
searching devices, found USB ID 1d6b:0002
searching devices, found USB ID 1d6b:0001
searching devices, found USB ID 12d1:14dc
found matching vendor ID
searching devices, found USB ID 413c:3012
searching devices, found USB ID 413c:2003
searching devices, found USB ID 05e3:0608
searching devices, found USB ID 1d6b:0002
No devices in default mode found. Nothing to do. Bye.
因此,执行 lsusb 时,你可以看到该设备不是 12dc:1f01,而是
Bus 001 Device 018: ID 12d1:14dc Huawei Technologies Co., Ltd.
所以我做了一个 dmesg 来查看发生了什么:
[ 3703.945245] cdc_ether 1-1.1:1.0: usb0: unregister 'cdc_ether'
usb-sw-ehci-1.1, CDC Ethernet Device
[ 3938.661981] usb 1-1.1: new high-speed USB device number 17 using
sw-ehci
[ 3938.783662] usb 1-1.1: New USB device found, idVendor=12d1,
idProduct=1f01
[ 3938.797418] usb 1-1.1: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[ 3938.809290] usb 1-1.1: Product: HUAWEI Mobile
[ 3938.816795] usb 1-1.1: Manufacturer: HUAWEI
[ 3938.825604] usb 1-1.1: SerialNumber: FFFFFFFFFFFFFFFF
[ 3938.891911] scsi13 : usb-storage 1-1.1:1.0
[ 3939.706889] usb 1-1.1: USB disconnect, device number 17
[ 3940.202053] usb 1-1.1: new high-speed USB device number 18 using
sw-ehci
[ 3940.323503] usb 1-1.1: New USB device found, idVendor=12d1,
idProduct=14dc
[ 3940.336703] usb 1-1.1: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[ 3940.347443] usb 1-1.1: Product: HUAWEI Mobile
[ 3940.355089] usb 1-1.1: Manufacturer: HUAWEI
[ 3940.586414] cdc_ether 1-1.1:1.0: usb0: register 'cdc_ether' at
usb-sw- ehci-1.1, CDC Ethernet Device, c2:71:b7:f9:e4:f6
[ 3940.601758] scsi14 : usb-storage 1-1.1:1.2
[ 3941.615040] scsi 14:0:0:0: Direct-Access HUAWEI TF CARD
Storage 2.31 PQ: 0 ANSI: 2
[ 3941.632411] sd 14:0:0:0: Attached scsi generic sg0 type 0
[ 3941.642327] sd 14:0:0:0: [sda] Attached SCSI removable disk
所以你可以看到调制解调器改变了它的模式(非常快),对吗?
我尝试对其他 id 产品运行相同的 usb modeswitch 命令,但是不起作用:
usb_modeswitch -v 12d1 -p 14dc -M '55534243123456780000000000000011062000000100000000000000000000'
所以我需要你们的帮助来了解发生了什么。我想更好地了解 usb_modeswitch 是如何工作的,或者找到一个使用 udev 规则的解决方案。