我正在尝试将3G USB加密狗配置为WiFi的备份解决方案。 使用Raspberry 4b,最新的Raspbian,其中似乎USB加密狗自动转换为调制解调器,如我所见。 所以我跳过了USB模式开关部分并尝试通过wvdial进行连接。 连接似乎成功,但几秒钟后 - 断开连接。 非常感谢任何帮助。
我正在使用华为 E372 或华为 E397B - 相同的结果。 最初它已经作为调制解调器连接 (1506(
pi@raspberrypi:~/3g $ lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 014: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~/3g $ ls -al /dev/gsm*
-rw-r--r-- 1 root root 0 Dec 25 11:33 /dev/gsmmodem
lrwxrwxrwx 1 root root 7 Dec 25 11:48 /dev/gsmmodem2 -> ttyUSB0
WVDIAL配置:
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet",,0,0
Stupid Mode = 1
Modem Type = Analog Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/gsmmodem
Username = { }
Password = { }
New PPPD = yes
Baud = 460800
连接:
pi@raspberrypi:~/3g sudo wvdial
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","internet",,0,0
AT+CGDCONT=1,"IP","internet",,0,0
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Wed Dec 25 11:33:39 2019
--> Pid of pppd: 22588
--> Using interface ppp0
--> pppd: X[1f]�[01]X[1f]�[01]
--> pppd: X[1f]�[01]X[1f]�[01]
--> pppd: X[1f]�[01]X[1f]�[01]
--> pppd: X[1f]�[01]X[1f]�[01]
--> pppd: X[1f]�[01]X[1f]�[01]
--> pppd: X[1f]�[01]X[1f]�[01]
--> pppd: X[1f]�[01]X[1f]�[01]
--> Disconnecting at Wed Dec 25 11:33:42 2019
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 5 seconds
--> Cannot open /dev/gsmmodem: No such file or directory
--> Cannot open /dev/gsmmodem: No such file or directory
--> Cannot open /dev/gsmmodem: No such file or directory
--> Disconnecting at Wed Dec 25 11:33:43 2019
.log:
Dec 25 11:33:47 raspberrypi kernel: [58307.025422] usb 1-1.2: Product: HUAWEI Mobile
Dec 25 11:33:47 raspberrypi kernel: [58307.025435] usb 1-1.2: Manufacturer: Huawei Technologies
Dec 25 11:33:47 raspberrypi kernel: [58307.028680] usb-storage 1-1.2:1.0: USB Mass Storage device detected
Dec 25 11:33:47 raspberrypi kernel: [58307.029145] scsi host0: usb-storage 1-1.2:1.0
Dec 25 11:33:47 raspberrypi mtp-probe: checking bus 1, device 13: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2"
Dec 25 11:33:47 raspberrypi mtp-probe: bus: 1, device: 13 was not an MTP device
Dec 25 11:33:47 raspberrypi mtp-probe: checking bus 1, device 13: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2"
Dec 25 11:33:47 raspberrypi mtp-probe: bus: 1, device: 13 was not an MTP device
Dec 25 11:33:47 raspberrypi usb_modeswitch: switch device 12d1:1505 on 001/013
Dec 25 11:33:47 raspberrypi kernel: [58307.818077] usb 1-1.2: USB disconnect, device number 13
找到答案。而不是Modem = /dev/gsmmodem
或Modem = /dev/ttyUSB0
需要设置Modem = /dev/ttyUSB2
- 这并不明显,我猜取决于调制解调器类型。 尽管如此,它在USB0上声明gsmmodemm:
pi@raspberrypi:~ $ ls -al /dev/gsm*
lrwxrwxrwx 1 root root 7 Dec 25 20:32 /dev/gsmmodem -> ttyUSB0
要确定要拨打哪个端口 - 只需运行自动 wvdial 配置 -sudo wvdialconf
并拿起最后一个端口。
Editing `/etc/wvdial.conf'.
Scanning your serial ports for a modem.
ttyUSB0<*1>: ATQ0 V1 E1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB0<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB0<*1>: Speed 9600: AT -- OK
ttyUSB0<*1>: Max speed is 9600; that should be safe.
ttyUSB0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB1<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB1<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
ttyUSB2<*1>: ATQ0 V1 E1 -- OK
ttyUSB2<*1>: ATQ0 V1 E1 Z -- OK
ttyUSB2<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyUSB2<*1>: Modem Identifier: ATI -- Manufacturer: huawei
ttyUSB2<*1>: Speed 9600: AT -- OK
ttyUSB2<*1>: Max speed is 9600; that should be safe.
ttyUSB2<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
Found a modem on /dev/ttyUSB0.
Modem configuration written to /etc/wvdial.conf.
ttyUSB0<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"
ttyUSB2<Info>: Speed 9600; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"