一灶芝、模塊簡介
- 使用M.2物理接口席怪,usb通信接口
- 支持大下行速率為150Mbps奇昙,大上行速率為50Mbps。
- 其包含三個(gè)版本:EM05-CE群叶、EM05-CML和 EM05-E*吃挑,能在LTE-FDD、LTE-TDD街立、DC-HSDPA舶衬、HSPA+、HSDPA赎离、HSUPA逛犹、WCDMA和CDMA等多種網(wǎng)絡(luò)制式中進(jìn)行數(shù)據(jù)通信。
二梁剔、模塊使用
1.修改linux內(nèi)核
1)移植USB Serial驅(qū)動
? 移植后模塊連接到USB串行驅(qū)動時(shí)虽画,驅(qū)動程序?qū)⒃谀夸?dev中創(chuàng)建設(shè)備文件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; }
-
-
增加休眠后喚醒接口
當(dāng)MCU進(jìn)入暫停/休眠模式時(shí),一些USB主機(jī)控制器/USB集線器將失去電源或重新設(shè)置荣病,并且在MCU退出暫停/休眠模式后码撰,它們不能恢復(fù)USB設(shè)備。請?zhí)砑右韵抡Z句以啟用重新設(shè)置恢復(fù)過程个盆。
-
修改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配置
- 執(zhí)行命令make menuconfig進(jìn)入配置
1)內(nèi)核模塊
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 //這個(gè)選項(xiàng)一定要勾選朵栖,否則可能無法在系統(tǒng)中查看設(shè)備
<*>Kmod-usb-serial
<*>Kmod-usb-serial-option
<*>Kmod-usb-serial-wwan
<*>kmod-usb-uhci
<*>Kmod-usb2
2)網(wǎng)絡(luò)配置
NetWork >>
<*>wwan
<*>chat
<*>ppp
<*>uqmi
<*>umbim
3)Utilities配置
Utilities
<*>comgt
<*>usb-modeswitch //自動模式更改,將設(shè)備置于USB調(diào)制解調(diào)器模式
<*>usbutils//【可選柴梆,可查看usb設(shè)備】
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.網(wǎng)關(guān)配置
1)接入4G模塊后混槐,使用ls /dev命令,可以看到usb轉(zhuǎn)串口設(shè)備
-
lsusb 命令查看usb設(shè)備
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進(jìn)行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'
-
重啟網(wǎng)絡(luò)
/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)