USB_ModeSwitch for Android 7,在高通APQ8096上使用華為E8372h-155模塊驗證。 ...
USB_ModeSwitch官網: USB_ModeSwitch - Handling Mode-Switching USB Devices on Linux
USB_ModeSwitch for Android 7下載: https://download.csdn.net/download/sunrain_hjb/10573201
測試環境:APQ8096、Android 7(userdebug)、HUAWEI E8372
測試步驟:
1.插入HUAWEI E8372模塊並稍等片刻,運行lsusb命令檢測模塊狀態,12d1:1f01即為HUAWEI E8372,此時為Stroage模式。
msm8996:/sys/bus/usb/devices # lsusb
Bus 001 Device 004: ID 12d1:1f01
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003
2.運行命令 adb shell usbmodeswitch -W -v 12d1 -p 1f01 -M '55534243123456780000000000000011062000000101000100000000000000" 切換模式
adb shell usbmodeswitch -W -v 12d1 -p 1f01 -M '55534243123456780000000000000011062000000101000100000000000000' Take all parameters from the command line * usb_modeswitch: handle USB devices with multiple modes * Version 2.5.2 (C) Josua Dietze 2017 * Based on libusb1/libusbx ! PLEASE REPORT NEW CONFIGURATIONS ! DefaultVendor= 0x12d1 DefaultProduct= 0x1f01 MessageContent="55534243123456780000000000000011062000000101000100000000000000" Look for default devices ... found USB ID 12d1:1f01 vendor ID matched product ID matched found USB ID 1d6b:0002 found USB ID 1d6b:0003 Found devices in default mode (1) Access device 002 on bus 001 Get the current device configuration ... Current configuration number is 1 Use interface number 0 with class 8 Use endpoints 0x01 (out) and 0x81 (in) USB description data (for identification) ------------------------- Manufacturer: HUAWEI_MOBILE Product: HUAWEI_MOBILE Serial No.: 0123456789ABCDEF ------------------------- Looking for active drivers ... OK, driver detached Set up interface 0 Use endpoint 0x01 for message sending ... Trying to send message 1 to endpoint 0x01 ...
3.再次運行命令lsusb,檢測切換後的狀態,12d1:14db即切換為Modem模式後的HUAWEI E8372
msm8996:/sys/bus/usb/devices # lsusb
Bus 001 Device 005: ID 12d1:14db
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003
對應的dmesg信息如下:
[ 105.249217] msm-dwc3 7600000.hsusb: DWC3 exited from low power mode
[ 105.249255] dwc3_ext_event_notify():cancel HRTIMER
[ 105.490266] usb 1-1: new high-speed USB device number 2 using xhci-hcd
[ 105.631944] usb 1-1: New USB device found, idVendor=12d1, idProduct=1f01
[ 105.631965] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 105.631976] usb 1-1: Product: HUAWEI_MOBILE
[ 105.631988] usb 1-1: Manufacturer: HUAWEI_MOBILE
[ 105.631999] usb 1-1: SerialNumber: 0123456789ABCDEF
[ 105.642186] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 105.643755] transfer actual length=31, result=0
[ 105.643966] scsi host1: usb-storage 1-1:1.0
[ 105.644740] usb 1-1: USB disconnect, device number 2
[ 106.220296] usb 1-1: new high-speed USB device number 3 using xhci-hcd
[ 106.361999] usb 1-1: New USB device found, idVendor=12d1, idProduct=14db
[ 106.362039] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 106.362066] usb 1-1: Product: HUAWEI_MOBILE
[ 106.362091] usb 1-1: Manufacturer: HUAWEI_MOBILE
[ 106.376414] cdc_ether 1-1:1.0 eth0: register 'cdc_ether' at usb-xhci-hcd.0.auto-1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
[ 106.382937] cdc_ether 1-1:1.0 eth0: kevent 12 may have been dropped
[ 106.394406] cdc_ether 1-1:1.0 eth0: kevent 12 may have been dropped
[ 106.397866] cdc_ether 1-1:1.0 eth0: kevent 12 may have been dropped
[ 106.397879] cdc_ether 1-1:1.0 eth0: kevent 12 may have been dropped
[ 106.403253] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 106.744979] SELinux: initialized (dev fuse, type fuse), uses mountpoint labeling
[ 114.922234] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
4.運行ifconfig命令,查看eth0的狀態,並對比連接PC端時的狀態
5.運行route和ping等命令,檢查網路連接
msm8996:/ # route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.8.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
6.在Chrome瀏覽器中測試網路連接,具體如下圖所示。