rk3288 ec20
适用任何版本linux EC20/EC25通信模块的4G拨号适配,
make menuconfig 配置:
USB相关:
\drivers\usb\serial\option.c
[] Device Drivers →
[*] USB Support →
<*> USB Serial Converter support →
[*] USB driver for GSM and CDMA modems
PPP相关:(和PPP相关的,我都选上了)
drivers/net/ppp/Kconfig:5 ppp_generic.c
[] Device Drivers →
[] Network device support →
[*] PPP (point-to-point protocol) support
…
d.保存退出,执行make
只需要三步,完成EC20/EC25通信模块的4G拨号适配,适用任何版本linux
第一步,确定,内核已经开启USB网卡和USB串口驱动的支持
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_WWAN=y
CONFIG_USB_SERIAL_OPTION=y
CONFIG_USBNET=y
第二步,在内核中\drivers\usb\serial\option.c,static const struct usb_device_id option_ids后面加入EC20/EC25的硬件ID
static const struct usb_device_id option_ids[] = {
#if 1 //Added by Quectel
{ USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 /
{ USB_DEVICE(0x05C6, 0x9003) }, / Quectel UC20 /
{ USB_DEVICE(0x05C6, 0x9215) }, / Quectel EC20 /
{ USB_DEVICE(0x2C7C, 0x0125) }, / Quectel EC25/EC20 R2.0 /
{ USB_DEVICE(0x2C7C, 0x0121) }, / Quectel EC21 */
#endif
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD_LIGHT) },
如果一、二步操作成功,系统重新升级后,会出现
/ # cat /dev/ttyUSB
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3 /dev/ttyUSB4
用AT指令验证tty设备的响应
/ # cat /dev/ttyUSB2 & echo -e "AT+CGMI\r\n" >/dev/ttyUSB2
/ # AT+CGMI
Quectel
OK
AT+CGMI
Quectel
OK
AT+CPIN?
第三步:切换模块的工作模式为ECM
输入echo -e “AT+QCFG=“usbnet”,1\r\n” > /dev/ttyUSB2
命令,设备返回OK
/ # echo -e "AT+QCFG=\"usbnet\",1\r\n" > /dev/ttyUSB2
/ # AT+QCFG="usbnet",1
OK
输入 echo -e “AT+QCFG=“usbnet”,1\r\n” > /dev/ttyUSB2
命令,模块重启
重启后,ifconfig多出了一个usb0接口,并会自动获取IP地址
usb0 Link encap:Ethernet HWaddr 5E:B0:80:23:9A:50
inet addr:192.168.225.56 Bcast:192.168.225.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:41 errors:0 dropped:0 overruns:0 frame:0
TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3186 (3.1 KiB) TX bytes:2348 (2.2 KiB)
此时,模块和调式设备已经成接入 3G/4G网络,并可用自动适应及漫游3G/4G网络
附:查询当前模式
cat /dev/ttyUSB2 & echo -e “AT+QCFG=“usbnet”\r\n” >/dev/ttyUSB2
+QCFG: “usbnet”,1 为ECM模式
+QCFG: “usbnet”,0 为RNDS模式
作者:别亦吝
来源:CSDN
原文:https://blog.csdn.net/qq_24487165/article/details/87937837
版权声明:本文为博主原创文章,转载请附上博文链接!