在arm,i.mx6上调试使用EC20 4G模块上网

   日期:2020-09-07     浏览:95    评论:0    
核心提示:1,添加USB设备信息1.1,修改drivers/usb/serial/option.c(1)定义EC20 ID宏 #define QUECTEL_VENDOR_ID 0x2C7C #define QUECTEL_PRODUCT_EC20 0x0125(2)将ID宏信息添加到option_ids数组中 static const struct usb_device_id option_ids[] = { { USB_DEVICE

1,添加USB设备信息
1.1,修改drivers/usb/serial/option.c
(1)添加PID 和 VID

#define QUECTEL_VENDOR_ID 0x2C7C 
#define QUECTEL_PRODUCT_EC20 0x0125

(2)将ID宏信息添加到option_ids数组中

static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC20) }, 

(3)在option_probe中添加

if (dev_desc->idVendor == cpu_to_le16(0x05c6) &&
   dev_desc->idProduct == cpu_to_le16(0x9003) &&
   iface_desc->bInterfaceNumber >= 4)
       return -ENODEV;

if (dev_desc->idVendor == cpu_to_le16(0x05c6) &&
   dev_desc->idProduct == cpu_to_le16(0x9215) &&
   iface_desc->bInterfaceNumber >= 4)
       return -ENODEV;

if (dev_desc->idVendor == cpu_to_le16(0x2c7c) &&
   iface_desc->bInterfaceNumber >= 4)
       return -ENODEV; 

(4)在option_1port_device中

.resume          = usb_wwan_resume,
//在下面添加
.reset_resume     = usb_wwan_resume, 

1.2,修改drivers/usb/serial/usb_wwan.c
在usb_wwan_setup_urb中

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;
 } 

2,内核配置
2.1,启用USB网络支持
-> Device Drivers
-> – Network device support
-> USB Network Adapters
-> – Multi-purpose USB Networking Framework

2.2,使能USB串口GSM、CDMA驱动
-> Device Drivers
-> [] USB support
-> <> USB Serial Converter support
-> <
> USB driver for GSM and CDMA modems

2.3,使能USB的CDC ACM模式
-> Device Drivers
-> [] USB support
-> <> Support for Host-side USB
-> <
> USB Modem (CDC ACM) support

2.4,使能PPP功能
-> Device Drivers
-> [] Network device support
-> <*> PPP (point-to-point protocol) support

3,添加GobiNet 驱动
3.1,将官方的驱动拷贝到内核目录drivers/net/usb下。

3.2,在drivers/net/usb目录下的Makefile里添加要编译的驱动文件。
obj-$(CONFIG_USB_GOBI_NET) += GobiNet.o
GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o

3.3,在drivers/net/usb/Kconfig下添加Kconfig选项。

config USB_GOBI_NET
tristate"Gobi USB Net driver for Quectel module"
help
Support Quectelmodule. 5
A modemmanager with support for GobiNet is recommended. 7 Tocompile this driver as a module, choose M here: the module will be calledGobiNet.1

3.4,在内核添加官方的驱动文件,编译内核,后面使用新内核启动开发板。

-> Device Drivers 
-> [*] Network device support 
 -> -*- USB Network Adapters
-> <*> Gobi USB Net driver for Quectel module

4,交叉编译quectel-CM拨号文件
在官方提供的源码下直接make CROSS_COMPILE=arm-linux-gnueabihf-

5,将编译好的quectel-CM拷贝到开发板,执行quectel-CM -s cenet & 拨号即可,注意quectel-CM需要用到udhcpc。

6,上图:

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服