一、 EC200S驱动移植
下载EC200S驱动
打开Linux源码的drivers/usb/serial/option.c文件,找到option_ids数组,在数组中加入如下内容:
{USB_DEVICE(0x2C7C,0x6002) }
在drivers/usb/serial/option.c文件中找到option_probe函数,在此函数中添加内容:
//Quectel UC20's interface 4 can be used as USB Network deviceif(serial->dev->descriptor.idVendor==cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)return -ENODEV;//Quectel EC20(MDM9215)'s interface 4 can be used as USB Network deviceif(serial->dev->descriptor.idVendor== cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)&& serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)return -ENODEV;if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {__u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);__u8 bInterfaceNumber = serial->interface->cur_altsetting->desc.bInterfaceNumber;//Quectel module's some interfaces can be used as USB Network device (ecm, rndis, mbim)if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF)return -ENODEV;if ((idProduct&0xF000) == 0x6000) {//ASR interface 4 is modem port}else if ((idProduct&0xF000) == 0x8000) {//HISI interface 0 is NCMif (bInterfaceNumber < 1)return -ENODEV;}else {//MDM interface 4 is QMIif (bInterfaceNumber >= 4)return -ENODEV;}}
继续在 drivers/usb/serial/option.c 文件里面找到 option_1port_device 结构体变量,在里面加入
.reset_resume= usb_wwan_resume,
打开 drivers/usb/serial/usb_wwan.c 文件,在 usb_wwan_setup_urb函数中添加
if (dir == USB_DIR_OUT) {if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6)&& serial->dev->descriptor.idProduct == cpu_to_le16(0x9090))urb->transfer_flags |= URB_ZERO_PACKET;if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6)&& serial->dev->descriptor.idProduct == cpu_to_le16(0x9003))urb->transfer_flags |= URB_ZERO_PACKET;if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6)&& serial->dev->descriptor.idProduct == cpu_to_le16(0x9215))urb->transfer_flags |= URB_ZERO_PACKET;if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C))urb->transfer_flags |= URB_ZERO_PACKET;}
二、内核配置
-> Device Drivers-> -*- Network device support-> USB Network Adapters-> -*- Multi-purpose USB Networking Framework
-> Device Drivers-> [*] USB support-> <*> USB Serial Converter support-> <*> USB driver for GSM and CDMA modems
-> Device Drivers-> [*] USB support-> <*> Support for Host-side USB-> <*> USB Modem (CDC ACM) support
-> Device Drivers-> [*] Network device support-> <*> PPP (point-to-point protocol) support-> <*> PPP BSD-Compress compression-> <*> PPP Deflate compression-> [*] PPP filtering-> <*> PPP MPPE compression (encryption)-> [*] PPP multilink support-> <*> PPP over Ethernet-> <*> PPP support for async serial ports-> <*> PPP support for sync tty ports
三、编译内核,EC200S-CN使用USB插入V3S的USB-OTG接口。
内核配置好后,编译内核,V3S用新编译的内核启动,接入EC200S-CN模块后,会生成下面几个驱动,说明EC200S-CN的驱动移植成功。
四、移植ppp
下载ppp源码在ubunt下交叉编译
cd ppp-2.4.4/./configure //配置make CC=arm-linux-gnueabihf-gcc //编译
编译完成后会在当前目录下生成chat/chat、 pppd/pppd、 pppdump/pppdump 和pppstats/pppstats 这四个文件,把这四个文件拷贝到V3S文件系统中的/usr/bin目录下。
在V3S文件系统中创建/etc/gosuncn目录,把下面四个文件拷贝到此目录。
ppp-on.shgosuncn_optionsgosuncn_ppp_dialerdisconnect.sh
启动脚本拨号
./ppp-on &
出现以下信息说明EC200S-CN拨号成功。
联网测试
以上出现的驱动、脚本源码在这里下载。点这里