登入系统

USB连接

$ adb devices
List of devices attached
c3d9b8674f4b94f6        device

$ adb shell


信息

root@linaro-alip:/# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@linaro-alip:/# cat /proc/cpuinfo 
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 17.28
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 1
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 17.28
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 2
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 17.28
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 3
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 17.28
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : Generic DT based system
Revision        : 0000
Serial          : c3d9b8674f4b94f6

root@linaro-alip:/# lscpu
Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
Model:                 5
Model name:            ARMv7 Processor rev 5 (v7l)
CPU max MHz:           1200.0000
CPU min MHz:           216.0000
BogoMIPS:              17.28
Flags:                 half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm

root@linaro-alip:/# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq 
1200000


enxf04bb3b9ebe5:为4G模块网卡。

root@linaro-alip:/# ifconfig
enxf04bb3b9ebe5: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f0:4b:b3:b9:eb:e5  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

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.5.238  netmask 255.255.255.0  broadcast 192.168.5.255
        inet6 fe80::4e8c:84f3:c65:d8d  prefixlen 64  scopeid 0x20<link>
        ether 4e:e6:5f:f6:f9:90  txqueuelen 1000  (Ethernet)
        RX packets 67857  bytes 8660174 (8.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 215  bytes 18705 (18.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 10  bytes 866 (866.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 866 (866.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@linaro-alip:/# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1
    link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 4e:e6:5f:f6:f9:90 brd ff:ff:ff:ff:ff:ff
4: enxf04bb3b9ebe5: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether f0:4b:b3:b9:eb:e5 brd ff:ff:ff:ff:ff:ff

root@linaro-alip:/# ls /sys/class/net/
enxf04bb3b9ebe5  eth0  lo  sit0


4G模块测试

ttyUSB*为4G模块串口,代表驱动已经加载。

root@linaro-alip:/# ll /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Mar 28 01:45 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Mar 28 01:45 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 2 Mar 28 01:45 /dev/ttyUSB2
crw-rw---- 1 root dialout 188, 3 Mar 28 01:45 /dev/ttyUSB3
crw-rw---- 1 root dialout 188, 4 Mar 28 01:45 /dev/ttyUSB4
crw-rw---- 1 root dialout 188, 5 Mar 28 01:45 /dev/ttyUSB5
crw-rw---- 1 root dialout 188, 6 Mar 28 01:45 /dev/ttyUSB6

root@linaro-alip:/# dmesg | grep ttyUSB
[    6.954985] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[    6.970489] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB1
[    6.985721] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB2
[    7.001201] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB3
[    7.016611] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB4
[    7.032307] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB5
[    7.052503] usb 2-1.2: GSM modem (1-port) converter now attached to ttyUSB6

root@linaro-alip:/# dmesg | grep enxf04bb3b9ebe5
[    7.196483] cdc_ether 2-1.2:1.0 enxf04bb3b9ebe5: renamed from usb0
[    8.272190] IPv6: ADDRCONF(NETDEV_UP): enxf04bb3b9ebe5: link is not ready
[    8.294254] cdc_ether 2-1.2:1.0 enxf04bb3b9ebe5: kevent 12 may have been dropped
[    8.294577] cdc_ether 2-1.2:1.0 enxf04bb3b9ebe5: kevent 11 may have been dropped

root@linaro-alip:/# lsusb
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
Bus 002 Device 006: ID 1782:4d11 Spreadtrum Communications Inc.    <--- 4G
Bus 002 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


检查USB端口模式

参考文档:

  1. FIBOCOM LG610系列 驱动集成指南_Linux & Android_V1.0.2.pdf
  2. FIBOCOM LG610系列 ECM拨号指南_Linux_V1.0.4.pdf
GTUSBMODE VID PID 操作系统 端口功能
31 0x1782 0x4d10 Windows  
32 0x1782 0x4d11 Linux(Android) ECM网口+MODEL+NV+MOS+DIAG+LOG+AT+AT
33 0x1782 0x4d11 Windows  

ttyUSB0、ttyUSB5、ttyUSB6可以用来响应AT,默认使用ttyUSB0

root@linaro-alip:/# echo "AT+GTUSBMODE?" > /dev/ttyUSB0
root@linaro-alip:/# cat /dev/ttyUSB0
AT+GTUSBMODE?


+GTUSBMODE: 32



OK


查询IMSI

root@linaro-alip:/# echo "AT+CIMI?" > /dev/ttyUSB0
AT+CIMI?


+CIMI: 460091*********



OK


查看IMEI,每个模块唯一

root@linaro-alip:/# echo "AT+CGSN?" > /dev/ttyUSB0
AT+CGSN?


+CGSN: "868680*********"



OK


查询批次号 S/N

root@linaro-alip:/# echo "AT+CFSN?" > /dev/ttyUSB0
AT+CFSN?


+CFSN: "KN69******"



OK


回复+CFUN:1 确认模块正常工作模式。 不是1则设置成1

root@linaro-alip:/# echo "AT+CFUN?" > /dev/ttyUSB0
AT+CFUN?


+CFUN: 1



OK


查询模块当前的固件版本号

root@linaro-alip:/# echo "AT+CGMR?" > /dev/ttyUSB0
AT+CGMR?


+CGMR: "16000.1000.00.06.71.15"



OK


确认SIM卡

root@linaro-alip:/# echo "AT+CPIN?" > /dev/ttyUSB0
AT+CPIN?


+CPIN: READY



OK
  • 回复+CPIN: READY说明识别到SIM卡。
  • 假如最少连接查询90秒仍然找不到SIM卡,复位模块。
  • 如果需要PIN码则先用AT+CPIN设置PIN码。


APN (获取到IP)

root@linaro-alip:/# echo "AT+CGDCONT?" > /dev/ttyUSB0
AT+CGDCONT?


+CGDCONT: 0,"IP","wonet","10.215.50.83",0,0



OK

root@linaro-alip:/# echo "AT+COPS?" > /dev/ttyUSB0
AT+COPS?


+COPS: 0,0,"CHN-UNICOM",7 <--- 中国联通



OK

APN是模块即将选用的运营商网络的标识,建议联系SIM供应商确认设置对应的APN。


确认信号指标正常

root@linaro-alip:/# echo "AT+CSQ?" > /dev/ttyUSB0
AT+CSQ?


+CSQ: 31,99



OK
  • 返回值格式为 +CSQ: <rssi>,<ber> 第一个参数<rssi>大于0并且不是99。
  • 假如连续查询90秒返回值不正确,则复位模块。
  • <ber>为误码率,0…7: 参考GSM 05.08中的RXQUAL值,99: 未知或不可检测。
rssi 信号 说明
0 -113 dBm or less  
1 -111 dBm  
20-30 -109 … -43 dBm  
31 -51 dBm or greater 信号优
99 not known or not detectable 无信号


PS域 (数据网络)

root@linaro-alip:/# echo "AT+CGREG?" > /dev/ttyUSB0
AT+CGREG?


+CGREG: 0,1



OK
  • 查询结果是1或者5表示注册上PS域
  • 连接查询超过90秒仍然注册不上PS域,复位模块。


激活

root@linaro-alip:/# echo "AT+GTRNDIS?" > /dev/ttyUSB0
AT+GTRNDIS?


+GTRNDIS: 0



OK

root@linaro-alip:/# echo "AT+GTRNDIS=1,1" > /dev/ttyUSB0
AT+GTRNDIS=1,1


OK

root@linaro-alip:/# echo "AT+GTRNDIS?" > /dev/ttyUSB0
AT+GTRNDIS?


+GTRNDIS: 1,1,"10.215.50.83","123.123.123.123","123.123.123.124"



OK

root@linaro-alip:/# ifconfig enxf04bb3b9ebe5
enxf04bb3b9ebe5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.215.50.83  netmask 255.255.255.0  broadcast 10.215.50.255
        inet6 fe80::741e:ca:305c:fd64  prefixlen 64  scopeid 0x20<link>
        inet6 ::c011:10fb:ee6b:7e1  prefixlen 64  scopeid 0x0<global>
        ether f0:4b:b3:b9:eb:e5  txqueuelen 1000  (Ethernet)
        RX packets 7  bytes 1408 (1.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42  bytes 4436 (4.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


+GTRNDIS=0,1 释放

root@linaro-alip:/# echo -e "AT+GTRNDIS=0,1" > /dev/ttyUSB0
AT+GTRNDIS=0,1


OK

root@linaro-alip:/# echo -e "AT+GTRNDIS?" > /dev/ttyUSB0
AT+GTRNDIS?


+GTRNDIS: 0



OK

root@linaro-alip:/# ifconfig enxf04bb3b9ebe5
enxf04bb3b9ebe5: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f0:4b:b3:b9:eb:e5  txqueuelen 1000  (Ethernet)
        RX packets 7  bytes 1408 (1.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 42  bytes 4436 (4.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


联网测试

环境中有两块网卡eth0与enxf04bb3b9ebe5

root@linaro-alip:/# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.5.1     0.0.0.0         UG    100    0        0 eth0  <--- 优先极高
0.0.0.0         10.215.50.1     0.0.0.0         UG    101    0        0 enxf04bb3b9ebe5
10.215.50.0     0.0.0.0         255.255.255.0   U     100    0        0 enxf04bb3b9ebe5
192.168.1.1     10.215.50.1     255.255.255.255 UGH   100    0        0 enxf04bb3b9ebe5
192.168.5.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0

删除重建

root@linaro-alip:/# route del default gw 192.168.5.1 eth0
root@linaro-alip:/# route del default gw 10.215.50.1 enxf04bb3b9ebe5

root@linaro-alip:/# route add default gw 192.168.5.1 eth0
root@linaro-alip:/# route add default gw 10.215.50.1 enxf04bb3b9ebe5 <--- 最后的优先级高
root@linaro-alip:/# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.215.50.1     0.0.0.0         UG    0      0        0 enxf04bb3b9ebe5
0.0.0.0         192.168.5.1     0.0.0.0         UG    0      0        0 eth0
10.215.50.0     0.0.0.0         255.255.255.0   U     100    0        0 enxf04bb3b9ebe5
192.168.1.1     10.215.50.1     255.255.255.255 UGH   100    0        0 enxf04bb3b9ebe5
192.168.5.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
root@linaro-alip:/#


复位模块

厂家提供

root@linaro-alip:/# echo -e "AT+CFUN=15" > /dev/ttyUSB0


ATIO

可能是清理IO的命令

root@linaro-alip:/# echo -e "ATIO" > /dev/ttyUSB0


其它

GPS获取测试失败,厂家称会在esim卡功能中实现。