OpenWrt 调试华为ME909s-821

在Linux驱动

# cat /sys/kernel/debug/usb/devices


T:  Bus=01 Lev=02 Prnt=08 Port=02 Cnt=01 Dev#=  9 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=ff MxPS=64 #Cfgs=  3  (有3个配置)
P:  Vendor=12d1 ProdID=15c1 Rev= 1.02
S:  Manufacturer=Huawei Technologies Co., Ltd.
S:  Product=HUAWEI Mobile V7R11
S:  SerialNumber=0123456789ABCDEF
------

C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=06 Prot=10 Driver=
E:  Ad=82(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=13 Driver=
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=12 Driver=
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=06 Prot=16 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  16 Ivl=2ms
I:  If#= 3 Alt= 1 #EPs= 3 Cls=ff(vend.) Sub=06 Prot=16 Driver=
E:  Ad=86(I) Atr=03(Int.) MxPS=  16 Ivl=2ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=06 Driver=
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=1b Driver=
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

------------------

C:* #Ifs= 7 Cfg#= 2 Atr=a0 MxPwr=  2mA        (配置2)
I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=2ms

I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=06 Prot=00 Driver=cdc_ether
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=06 Prot=10 Driver=option     
E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=13 Driver=option
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=12 Driver=option
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=06 Driver=option
E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=06 Prot=1b Driver=option
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

---------------------

C:  #Ifs= 2 Cfg#= 3 Atr=a0 MxPwr=  2mA
A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I:  If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E:  Ad=82(I) Atr=03(Int.) MxPS=  16 Ivl=2ms
I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=
I:  If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms


居然有3种配置模式

驱动加载信息

[ 3700.269718] usb 1-3: new high-speed USB device number 8 using xhci_hcd
[ 3700.397891] usb 1-3: New USB device found, idVendor=1a40, idProduct=0101
[ 3700.397899] usb 1-3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 3700.397905] usb 1-3: Product: USB 2.0 Hub [MTT]
[ 3700.398729] hub 1-3:1.0: USB hub found
[ 3700.398764] hub 1-3:1.0: 4 ports detected
[ 3725.757647] usb 1-3.3: new high-speed USB device number 9 using xhci_hcd
[ 3725.855317] usb 1-3.3: New USB device found, idVendor=12d1, idProduct=15c1
[ 3725.855325] usb 1-3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3725.855330] usb 1-3.3: Product: HUAWEI Mobile V7R11
[ 3725.855333] usb 1-3.3: Manufacturer: Huawei Technologies Co., Ltd.
[ 3725.855336] usb 1-3.3: SerialNumber: 0123456789ABCDEF
[ 3725.909999] usbcore: registered new interface driver usbserial
[ 3725.910009] usbcore: registered new interface driver usbserial_generic
[ 3725.910016] usbserial: USB Serial support registered for generic
[ 3725.911596] cdc_ether 1-3.3:2.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-3.3, CDC Ethernet Device, 02:1e:10:1f:00:00
[ 3725.911614] usbcore: registered new interface driver cdc_ether
[ 3725.911810] usbcore: registered new interface driver option
[ 3725.911818] usbserial: USB Serial support registered for GSM modem (1-port)
[ 3725.911893] option 1-3.3:2.2: GSM modem (1-port) converter detected
[ 3725.911956] usb 1-3.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 3725.911967] option 1-3.3:2.3: GSM modem (1-port) converter detected
[ 3725.911996] usb 1-3.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 3725.912007] option 1-3.3:2.4: GSM modem (1-port) converter detected
[ 3725.912035] usb 1-3.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 3725.912046] option 1-3.3:2.5: GSM modem (1-port) converter detected
[ 3725.912072] usb 1-3.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 3725.912082] option 1-3.3:2.6: GSM modem (1-port) converter detected
[ 3725.912112] usb 1-3.3: GSM modem (1-port) converter now attached to ttyUSB4
[ 3725.914629] cdc_ether 1-3.3:2.0 enp0s20f0u3u3c2: renamed from usb0
[ 3725.940306] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u3u3c2: link is not ready
[ 3725.940368] cdc_ether 1-3.3:2.0 enp0s20f0u3u3c2: kevent 12 may have been dropped
[ 3725.940371] cdc_ether 1-3.3:2.0 enp0s20f0u3u3c2: kevent 12 may have been dropped
[ 3725.942843] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u3u3c2: link is not ready

果然多了一个usb网卡

# ifconfig
enp0s20f0u3u3c2: flags=4099  mtu 1500
        ether 02:1e:10:1f:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

static int is_rndis(struct usb_interface_descriptor *desc)
{
        return (desc->bInterfaceClass == USB_CLASS_COMM &&
                desc->bInterfaceSubClass == 2 &&
                desc->bInterfaceProtocol == 0xff);
}

是通过Class来判断加载什么驱动

static const struct usb_device_id option_ids[] = {
...
     { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x06) },
...
     { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x10) },

通过配置信息加载串口驱动

晕, 不同设备,同PID
net/usb/cdc_mbim.c: /* Some Huawei devices, ME906s-158 (12d1:15c1) and E3372

查询串口配置

/dev/ttyUSB0     AT命令+Modem
/dev/ttyUSB2     AT命令口

华为这个模块,用picocom , 模块返回的信息 显示不全
用microcom才行

 microcom -s 115200 -p /dev/ttyUSB2 -d -l /tmp/hw.log


AT+CGDCONT?
返回
+CGDCONT: 0,"IPV4V6","","",0,0,0,0,0,0
+CGDCONT: 1,"IP","3gwap","",0,0,0,0,0,0
+CGDCONT: 11,"IPV4V6","","",0,0,0,0,0,0




AT^NDISDUP?
返回
OK




AT^NDISDUP=?
返回
^NDISDUP: (1-11),(0-1)

OK


开始连接
AT^NDISDUP=1,1
返回
OK


发完 AT^NDISDUP=1,1 然后就能分配到IP了

# udhcpc -i enp0s20f0u3u3c2:
udhcpc (v1.22.1) started
Sending discover...
Sending select for 172.17.128.75...
Lease of 172.17.128.75 obtained, lease time 518400

其它AT命令

AT+CFUN?
响应
+CFUN: 1

OK
---
AT+CGATT?
响应
+CGATT: 0

OK
---
AT+CGACT?
响应

+CGACT: 1,1
+CGACT: 11,0
+CGACT: 21,0
+CGACT: 22,0
+CGACT: 23,0
+CGACT: 24,0
+CGACT: 25,0
+CGACT: 26,0
+CGACT: 27,0
+CGACT: 28,0
+CGACT: 29,0
+CGACT: 30,0
+CGACT: 31,0

OK

路由器上
先发送 AT^NDISDUP=1,1 ,让后等待 AT+CGATT? 返回1(大约20-30秒)

关闭主动信息上报

AT^CURC=0

comgt中 华为的私有命令 “AT^”都要进行转义 “AT\^”

本文章由作者:佐须之男 整理编辑,原文地址: OpenWrt 调试华为ME909s-821
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资 源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。

相关推荐