抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

拯救中区寝室网络!

又是一篇流水文,全文基本参照 https://iedon.com/2020/11/11/809.html,但是不想把 usb-modeswitch 包删掉,会对其他应用有影响。不过我不太需要 IPv6,我只要能上网就好了(

购入了一块 me909s 后在电脑上工作良好,不过我想放 OpenWRT 上开热点。

和官方教程「失去同步」

装好基础的包之后(参照官方教程:https://openwrt.org/docs/guide-user/network/wan/wwan/ethernetoverusb_ncm),我出现了五个 USB 串口,但是一直没有 /dev/cdc-wdm0,在 Troubleshooting 也没找到对应的解决办法(当然我最后成功使用的时候也没看到这个设备):

1
2
3
4
5
6
7
8
$ l /dev
...
crw-rw---- 1 root dialout 188, 0 Oct 11 16:46 ttyUSB0
crw-rw---- 1 root dialout 188, 1 Oct 11 16:46 ttyUSB1
crw-rw---- 1 root dialout 188, 2 Oct 11 16:46 ttyUSB2
crw-rw---- 1 root dialout 188, 3 Oct 11 16:46 ttyUSB3
crw-rw---- 1 root dialout 188, 4 Oct 11 16:46 ttyUSB4
...

lsusb 能看到设备:

1
2
3
4
5
6
$ lsusb
Bus 001 Device 004: ID 0424:7800
Bus 001 Device 006: ID 12d1:15c1 Huawei Technologies Co., Ltd. HUAWEI Mobile V7R11
Bus 001 Device 003: ID 0424:2514
Bus 001 Device 002: ID 0424:2514
Bus 001 Device 001: ID 1d6b:0002 Linux 5.4.143 dwc_otg_hcd DWC OTG Controller

既然把 usb-modeswitch 包删掉可以解决,那是不是改下 usbmode 识别就好了?

改 usbmode

参照 https://forum.openwrt.org/t/me909s-120-problem-with-usb-modeswitch-and-huawei-cdc-ncm/38639,把 /etc/usb-mode.json 按以下 patch 修改:

1
2
3
4
5
6
7
8
9
                "12d1:15c1": {
"*": {
< "msg": [ ],
< "config": 0
---
> "mode": "Huawei",
> "msg": [ ]
}
},

dmesg 里可以看到,之前试图加载 usb_fs,现在是 GSM modem:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$ dmesg
[ 281.012775] cdc_ether 1-1.1.3:2.0 wwan0: register 'cdc_ether' at usb-3f980000.usb-1.1.3, Mobile Broadband Network Device, **:**:**:**:00:00
[ 281.028942] option 1-1.1.3:2.2: GSM modem (1-port) converter detected
[ 281.037278] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 281.046865] option 1-1.1.3:2.3: GSM modem (1-port) converter detected
[ 281.055155] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 281.064489] option 1-1.1.3:2.4: GSM modem (1-port) converter detected
[ 281.072621] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 281.081761] option 1-1.1.3:2.5: GSM modem (1-port) converter detected
[ 281.089952] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 281.099293] option 1-1.1.3:2.6: GSM modem (1-port) converter detected
[ 281.107380] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB4
[ 281.146071] cdc_ether 1-1.1.3:2.0 wwan0: unregister 'cdc_ether' usb-3f980000.usb-1.1.3, Mobile Broadband Network Device
[ 281.279324] usb 1-1.1.3: usbfs: process 12612 (usbmode) did not claim interface 1 before use
[ 281.492212] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 281.553347] usb 1-1.1.3: usbfs: process 12936 (usbmode) did not claim interface 1 before use
[ 281.766858] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 281.835814] usb 1-1.1.3: usbfs: process 13103 (usbmode) did not claim interface 1 before use
[ 282.048076] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 282.126266] usb 1-1.1.3: usbfs: process 13270 (usbmode) did not claim interface 1 before use
[ 282.338888] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 282.406846] usb 1-1.1.3: usbfs: process 13438 (usbmode) did not claim interface 1 before use
[ 282.620191] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 282.699833] usb 1-1.1.3: usbfs: process 13605 (usbmode) did not claim interface 1 before use
[ 282.912531] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 282.981760] usb 1-1.1.3: usbfs: process 13772 (usbmode) did not claim interface 1 before use
[ 283.193891] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 835.765729] usb 1-1.1.3: usbfs: process 20913 (usbmode) did not claim interface 1 before use
[ 835.978790] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 873.162684] usb 1-1.1.3: usbfs: process 21391 (usbmode) did not claim interface 1 before use
[ 873.375786] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 1401.420537] usb 1-1.1.3: usbfs: process 27594 (usbmode) did not claim interface 1 before use
[ 1401.633710] usb 1-1.1.3: usbfs: interface 1 claimed by usbfs while 'usbmode' sets config #0
[ 1763.028676] usb 1-1.1.3: USB disconnect, device number 5
[ 1763.038490] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 1763.053528] option 1-1.1.3:2.2: device disconnected
[ 1763.061609] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 1763.073199] option 1-1.1.3:2.3: device disconnected
[ 1763.080179] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 1763.091212] option 1-1.1.3:2.4: device disconnected
[ 1763.097960] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
[ 1763.109018] option 1-1.1.3:2.5: device disconnected
[ 1763.115648] option1 ttyUSB4: GSM modem (1-port) converter now disconnected from ttyUSB4
[ 1763.126611] option 1-1.1.3:2.6: device disconnected
[ 1771.769050] usb 1-1.1.3: new high-speed USB device number 6 using dwc_otg
[ 1771.910715] usb 1-1.1.3: New USB device found, idVendor=12d1, idProduct=15c1, bcdDevice= 1.02
[ 1771.925254] usb 1-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1771.936957] usb 1-1.1.3: Product: HUAWEI Mobile V7R11
[ 1771.943591] usb 1-1.1.3: Manufacturer: Huawei Technologies Co., Ltd.
[ 1771.951524] usb 1-1.1.3: SerialNumber: 0123456789ABCDEF
[ 1771.962003] cdc_ether 1-1.1.3:2.0 wwan0: register 'cdc_ether' at usb-3f980000.usb-1.1.3, Mobile Broadband Network Device, **:**:**:**:00:00
[ 1771.978389] option 1-1.1.3:2.2: GSM modem (1-port) converter detected
[ 1771.986666] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 1771.996179] option 1-1.1.3:2.3: GSM modem (1-port) converter detected
[ 1772.004302] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 1772.013839] option 1-1.1.3:2.4: GSM modem (1-port) converter detected
[ 1772.022058] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 1772.031549] option 1-1.1.3:2.5: GSM modem (1-port) converter detected
[ 1772.039785] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 1772.049279] option 1-1.1.3:2.6: GSM modem (1-port) converter detected
[ 1772.057528] usb 1-1.1.3: GSM modem (1-port) converter now attached to ttyUSB4

ip l 看到了 wwan0 网卡:

1
2
3
4
5
6
7
8
$ ip l
...
9: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether **:**:**:**:df:4d brd ff:ff:ff:ff:ff:ff
16: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether **:**:**:**:7b:29 brd ff:ff:ff:ff:ff:ff
18: wwan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether **:**:**:**:00:00 brd ff:ff:ff:ff:ff:ff

用 AT 去拨号失败:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ echo "AT\$QCRMCALL=1,1" > /dev/ttyUSB2

$ udhcpc -i wwan0
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: sendto: Network is down
udhcpc: read error: Network is down, reopening socket
udhcpc: sending discover
udhcpc: sendto: Network is down
udhcpc: read error: Network is down, reopening socket
udhcpc: sending discover
udhcpc: sendto: Network is down
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: read error: Network is down, reopening socket
udhcpc: sendto: Network is down
udhcpc: read error: Network is down, reopening socket
udhcpc: sendto: Network is down
udhcpc: read error: Network is down, reopening socket
^C

但是还是没有 cdc-wdm0 设备:

1
2
$ l /dev/cdc-wdm0
ls: /dev/cdc-wdm0: No such file or directory

上网

/etc/config/network 加上 ncm,设备也直接用的 ttyUSB0(这一步也可以在 luci 里加,但是我懒得放图了):

1
2
3
4
5
6
config interface 'wwan'
option proto 'ncm'
option device '/dev/ttyUSB0'
option mode 'auto'
option apn 'ctnet'
option ipv6 'auto'

对 wwan0 dhcp,成功!

1
2
3
4
5
6
7
$ udhcpc -i wwan0
udhcpc: started, v1.33.1
udhcpc: sending discover
udhcpc: sending select for 100.118.151.172
udhcpc: lease of 100.118.151.172 obtained, lease time 518400
udhcpc: ip addr add 100.118.151.172/255.255.255.248 broadcast + dev wwan0
udhcpc: setting default routers: 100.118.151.169

能在中区上网了(