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,上图: