一、模块简介
- 使用M.2物理接口,usb通信接口
- 支持大下行速率为150Mbps,大上行速率为50Mbps。
- 其包含三个版本:EM05-CE、EM05-CML和 EM05-E*,能在LTE-FDD、LTE-TDD、DC-HSDPA、HSPA+、HSDPA、HSUPA、WCDMA和CDMA等多种网络制式中进行数据通信。
二、模块使用
1.修改linux内核
1)移植USB Serial驱动
移植后模块连接到USB串行驱动时,驱动程序将在目录/dev中创建设备文件USB0/ttyUSB1/ttyUSB2…
-
增加PID&VID
-
修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/option.c文件
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(0x2C7C, 0x0125) }, /* Quectel EC25 EM05*/ { USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */ { USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */ { USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */ { USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */ { USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */ { USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */ { USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */ #endif
-
-
添加零包处理
-
修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/usb_wwan.c文件
static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, int endpoint, int dir, void *ctx, char *buf, int len, void (*callback) (struct urb *)) { struct usb_serial *serial = port->serial; struct urb *urb; urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ if (!urb) return NULL; usb_fill_bulk_urb(urb, serial->dev, usb_sndbulkpipe(serial->dev, endpoint) | dir, buf, len, callback, ctx); #if 1 //Added by Quectel for zero packet if (dir == USB_DIR_OUT) { struct usb_device_descriptor *desc = &serial->dev->descriptor; if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090)) urb->transfer_flags |= URB_ZERO_PACKET; if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003)) urb->transfer_flags |= URB_ZERO_PACKET; if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215)) urb->transfer_flags |= URB_ZERO_PACKET; if (desc->idVendor == cpu_to_le16(0x2C7C)) urb->transfer_flags |= URB_ZERO_PACKET; if (desc->idVendor == cpu_to_le16(0x1286) && desc->idProduct == cpu_to_le16(0x4e3d)) { urb->transfer_flags |= URB_ZERO_PACKET; } } #endif return urb; }
-
-
增加休眠后唤醒接口
当MCU进入暂停/休眠模式时,一些USB主机控制器/USB集线器将失去电源或重新设置,并且在MCU退出暂停/休眠模式后,它们不能恢复USB设备。请添加以下语句以启用重新设置恢复过程。
-
修改openwrt/build_dir/target-mipsel_24kc_glibc-2.24/linux-ramips_mt7688/linux-4.4.167/drivers/usb/serial/option.c文件。
static struct usb_serial_driver option_1port_device = { …… #ifdef CONFIG_PM .suspend = usb_wwan_suspend, .resume = usb_wwan_resume, #if 1 //Added by Quectel .reset_resume = usb_wwan_resume, #endif #endif };
2.修改openwrt配置
- 执行命令make menuconfig进入配置
1)内核模块
Kernel modules >>
USB Support >>
<*> Kmod -usb-core
-*-Kmod -usb-net
-*- kmod-usb-net-cdc-ether//【可选】
<*> kmod-usb-net-cdc-mbim
-*- kmod-usb-net-cdc-ncm
<*> kmod-usb-net-cdc-subset//【可选】
<*>kmod-usb-net-qmi-wwan
<*>Kmod-usb-ohci //这个选项一定要勾选,否则可能无法在系统中查看设备
<*>Kmod-usb-serial
<*>Kmod-usb-serial-option
<*>Kmod-usb-serial-wwan
<*>kmod-usb-uhci
<*>Kmod-usb2
2)网络配置
NetWork >>
<*>wwan
<*>chat
<*>ppp
<*>uqmi
<*>umbim
3)Utilities配置
Utilities
<*>comgt
<*>usb-modeswitch //自动模式更改,将设备置于USB调制解调器模式
<*>usbutils//【可选,可查看usb设备】
4)Luci配置
Luci
1. Collections
<*> luci
3. Applications
<*> luci-app-multiwan (optional to support multiple 3g dongles)//新版本为mwan3 【可选】
<*> luci-app-qos (optional to provide QOS support)//【可选】
6. Protocols
<*> luci-proto-3g
-*- luci-proto-ppp
3.网关配置
1)接入4G模块后,使用ls /dev命令,可以看到usb转串口设备
-
lsusb 命令查看usb设备
root@LEDE:~# lsusb Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 012: ID 2c7c:0125 #PID-2c7c:VID-0125 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
2)使用USB 3g / UMTS-modem进行WAN连接
参考https://openwrt.org/docs/guide-user/network/wan/wwan/3gdongle
-
修改\etc\config\network配置
config interface '4G' option ifname 'ppp0' option _orig_ifname 'eth0.2' option _orig_bridge 'false' option proto '3g' option device '/dev/ttyUSB2' option service 'umts' option ipv6 'auto' option keepalive '10 5' option metric '0'
-
重启网络
/etc/init.d/network restart
- 等待4G连接成功
root@LEDE:~# ifconfig 3g-4G Link encap:Point-to-Point Protocol inet addr:10.124.22.77 P-t-P:10.64.64.64 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:25 errors:0 dropped:0 overruns:0 frame:0 TX packets:58 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:1762 (1.7 KiB) TX bytes:3818 (3.7 KiB) br-lan Link encap:Ethernet HWaddr C6:E5:72:41:19:1D inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::c4e5:72ff:fe41:191d/64 Scope:Link inet6 addr: fd3f:6922:178d::1/60 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:19 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:2610 (2.5 KiB) eth0 Link encap:Ethernet HWaddr 40:D6:3C:1E:70:14 inet6 addr: fe80::42d6:3cff:fe1e:7014/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5519 errors:0 dropped:4 overruns:0 frame:0 TX packets:1579 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:476283 (465.1 KiB) TX bytes:152174 (148.6 KiB) Interrupt:5 eth0.1 Link encap:Ethernet HWaddr C6:E5:72:41:19:1D UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:19 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:2610 (2.5 KiB) eth0.2 Link encap:Ethernet HWaddr C6:E5:72:41:19:1E inet addr:192.168.3.94 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::c4e5:72ff:fe41:191e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1170 errors:0 dropped:0 overruns:0 frame:0 TX packets:280 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:70616 (68.9 KiB) TX bytes:22980 (22.4 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:2204 errors:0 dropped:0 overruns:0 frame:0 TX packets:2204 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:189751 (185.3 KiB) TX bytes:189751 (185.3 KiB) wlan0 Link encap:Ethernet HWaddr 40:D6:3C:1E:70:14 inet6 addr: fe80::42d6:3cff:fe1e:7014/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:13 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:1856 (1.8 KiB)