记录18.06 下驱动 EC20
openwrt 18.06 已经支持EC20 这个模块的识别了
只要在make menuconfig下选中以下模块, 是直接可以用AT命令读取到信息的,只是无法用qmi 应用程序获取到IP地址
Kernel modules --->
USB Support --->
-*- kmod-usb-core............................................ Support for USB
-*- kmod-usb-net............... Kernel modules for USB-to-Ethernet convertors
-*- kmod-usb-net-qmi-wwan.................................... QMI WWAN drive
<*> kmod-usb-ohci............................... Support for OHCI controllers
<*> kmod-usb-serial-option................... Support for Option HSDPA modem
无法获取IP地址主要是qmi 用的RAW-IP mode 没有在
[KERNEL]/drivers/net/usb/qmi_wwan.c
文件里面驱动起来,把下面补丁打入即可
https://download.csdn.net/download/jianzhizuo/10748784
@@ -175,6 +175,21 @@
* to 00:a0:c6:00:00:00 despite the host address being different.
* This function will also fixup such packets.
*/
+struct sk_buff *qmi_wwan_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
+{
+ if (dev->udev->descriptor.idVendor != cpu_to_le16(0x2C7C)) return skb;
+
+ // Skip Ethernet header from message
+ if (skb_pull(skb, ETH_HLEN)) {
+ return skb;
+ } else {
+ dev_err(&dev->intf->dev, "Packet Dropped ");
+ }
+ // Filter the packet out, release it
+ dev_kfree_skb_any(skb);
+ return NULL;
+}
+
static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
{
struct qmi_wwan_state *info = (void *)&dev->data;
@@ -445,6 +460,20 @@
}
dev->net->netdev_ops = &qmi_wwan_netdev_ops;
dev->net->sysfs_groups[0] = &qmi_wwan_sysfs_attr_group;
+#if 1 //Added by Quectel
+ if (dev->udev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
+ dev_info(&intf->dev, "Quectel EC25&EC21&EC20R2.0&EG91&EG95&EG06&EP06&EM06&BG96 work on RawIP mode\n");
+ dev->net->flags |= IFF_NOARP;
+ usb_control_msg(
+ interface_to_usbdev(intf),
+ usb_sndctrlpipe(interface_to_usbdev(intf), 0),
+ 0x22, //USB_CDC_REQ_SET_CONTROL_LINE_STATE
+ 0x21, //USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE
+ 1, //active CDC DTR
+ intf->cur_altsetting->desc.bInterfaceNumber,
+ NULL, 0, 100);
+ }
+#endif
err:
return status;
}
@@ -536,6 +565,7 @@
.unbind = qmi_wwan_unbind,
.manage_power = qmi_wwan_manage_power,
.rx_fixup = qmi_wwan_rx_fixup,
+ .tx_fixup = qmi_wwan_tx_fixup,
};
static const struct driver_info qmi_wwan_info_quirk_dtr = {
@@ -545,6 +575,7 @@
.unbind = qmi_wwan_unbind,
.manage_power = qmi_wwan_manage_power,
.rx_fixup = qmi_wwan_rx_fixup,
+ .tx_fixup = qmi_wwan_tx_fixup,
.data = QMI_WWAN_QUIRK_DTR,
}
quectel-CM 这个应用程序, 直接改成openwrt应用程序编译进代码就可以获取到IP了.
不过用原厂给的直接编译出来 是不会主动添加 DNS的,需要手动去/etc/resolv.conf dns 才能上网
下面这个是改好的包,解压放在package下面就行了,也会主动添加DNS
包下载地址: https://download.csdn.net/download/jianzhizuo/10749215
然后上成果图