Openwrt Support MINI-PCIE EC20 (6)

1      Scope of Document

This document describes MINI PCIE usb hardware design, for EC20 4G module

2      Requiremen

2.1     Function Requirement

Support ec20 ppp diag under openwrt

2.2     Performance Requirement

Connect to 4G network

3      Hardware Overview

NA

                

4      Functional Description

4.1     Functional Block Diagram

NA

                    

5      Porting

5.1     Kernel porting

We want to enumerate  ec20 module through usb option driver

So we need to add ec20 pid and vid into option_ids , and other private modification

Index: trunk/target/linux/ramips/patches-3.18/999-support-ec20.patch

===================================================================

--- trunk/target/linux/ramips/patches-3.18/999-support-ec20.patch   (nonexistent)

+++ trunk/target/linux/ramips/patches-3.18/999-support-ec20.patch       (revision 9)

@@ -0,0 +1,69 @@

+--- a/drivers/net/usb/qmi_wwan.c

++++ b/drivers/net/usb/qmi_wwan.c

+@@ -819,7 +819,7 @@ static const struct usb_device_id produc

+     {QMI_GOBI_DEVICE(0x05c6, 0x9225)},     /* Sony Gobi 2000 Modem device (N0279, VU730) */

+     {QMI_GOBI_DEVICE(0x05c6, 0x9245)},     /* Samsung Gobi 2000 Modem device (VL176) */

+     {QMI_GOBI_DEVICE(0x03f0, 0x251d)},      /* HP Gobi 2000 Modem device (VP412) */

+-    {QMI_GOBI_DEVICE(0x05c6, 0x9215)},     /* Acer Gobi 2000 Modem device (VP413) */

++   //{QMI_GOBI_DEVICE(0x05c6, 0x9215)},   /* Acer Gobi 2000 Modem device (VP413) */

+     {QMI_GOBI_DEVICE(0x05c6, 0x9265)},     /* Asus Gobi 2000 Modem device (VR305) */

+     {QMI_GOBI_DEVICE(0x05c6, 0x9235)},     /* Top Global Gobi 2000 Modem device (VR306) */

+     {QMI_GOBI_DEVICE(0x05c6, 0x9275)},     /* iRex Technologies Gobi 2000 Modem device (VR307) */

+--- a/drivers/usb/serial/option.c

++++ b/drivers/usb/serial/option.c

+@@ -647,6 +647,10 @@ static const struct option_blacklist_inf

+ };

+

+ static const struct usb_device_id option_ids[] = {

++   #if 1  // add by panzidong

++   { USB_DEVICE(0x05C6,0x9215)},

++   { USB_DEVICE(0x2C7C,0x0125)},

++   #endif

+     { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MZ382) },

+     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },

+     { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },

+@@ -1873,6 +1877,9 @@ static struct usb_serial_driver option_1

+     .suspend           = usb_wwan_suspend,

+     .resume            = usb_wwan_resume,

+ #endif

++#if 1  // add by panzidong

++       //.reset_resume = usb_wwan_resume,

++#endif

+ };

+

+ static struct usb_serial_driver * const serial_drivers[] = {

+--- a/drivers/usb/serial/qcserial.c

++++ b/drivers/usb/serial/qcserial.c

+@@ -90,7 +90,7 @@ static const struct usb_device_id id_tab

+     {USB_DEVICE(0x03f0, 0x241d)}, /* HP Gobi 2000 QDL device (VP412) */

+     {USB_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */

+     {USB_DEVICE(0x05c6, 0x9214)}, /* Acer Gobi 2000 QDL device (VP413) */

+-    {USB_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */

++   //{USB_DEVICE(0x05c6, 0x9215)},     /* Acer Gobi 2000 Modem device (VP413) */

+     {USB_DEVICE(0x05c6, 0x9264)}, /* Asus Gobi 2000 QDL device (VR305) */

+     {USB_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */

+     {USB_DEVICE(0x05c6, 0x9234)}, /* Top Global Gobi 2000 QDL device (VR306) */

+--- a/drivers/usb/serial/usb_wwan.c

++++ b/drivers/usb/serial/usb_wwan.c

+@@ -470,6 +470,21 @@ static struct urb *usb_wwan_setup_urb(st

+     usb_fill_bulk_urb(urb, serial->dev,

+                     usb_sndbulkpipe(serial->dev, endpoint) | dir,

+                     buf, len, callback, ctx);

++   #if 1

++   //Added by panzidong 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;

++   }

++   #endif

++

+

+     return urb;

+ }

                   <*> kmod-usb-serial..................... Support for USB-to-Serial converters                                                      

    <*> kmod-usb-serial-option................... Support for Option HSDPA modems                                                      

                   -*- kmod-usb-serial-wwan..................... Support for GSM and CDMA modems  

<*> luci-proto-3g............................................. Support for 3G

5.2     System configure

If we want to use ec20, we can manual change /etc/config/network

Then /etc/init.d/network restart,  pppd deamon will be up.

In the nodewrt2p we can change the config_generate file, when system fisrt time bootup

ec20 relate ppp configure will be auto write to /etc/config/network file, get the right ipaddr ,

Normal access to the Internet , here are the changes made:

Index: trunk/package/base-files/files/bin/config_generate

===================================================================

--- trunk/package/base-files/files/bin/config_generate      (revision 15)

+++ trunk/package/base-files/files/bin/config_generate   (revision 16)

@@ -17,9 +17,30 @@

 delete network.globals

 set network.globals='globals'

 set network.globals.ula_prefix='auto'

 EOF

 }

+generate_4g_network() {

+     uci -q batch <<EOF

+set network.mobile=interface

+set network.mobile.proto='3g'

+set network.mobile.device='/dev/ttyUSB2'

+set network.mobile.service='utms'

+set network.mobile.apn='3gnet'

+EOF

+}

@@ -167,4 +189,8 @@

 json_get_keys keys led

 for key in $keys; do generate_led $key; done

+generate_4g_network

uci commit

原文地址:https://www.cnblogs.com/lianghong881018/p/10244675.html