<p style="color: rgb(51, 51, 51);"> Air720正常启动后,通过USB连接到linux设备上,驱动正常加载后会产生如下设备:</p><p style="color: rgb(51, 51, 51);"> 1.Air720 系列 (1802/1802S)<br></p><p style="color: rgb(51, 51, 51);"><img style="width: 728px;" src="http://oldask.openluat.com/image/show/attachments-2019-10-BqkECMQm5daebf60a1907.jpg" class="img-responsive"></p><p style="color: rgb(51, 51, 51);">2.Air720U系列(8910)</p><p style="color: rgb(51, 51, 51);"><br></p><p style="color: rgb(51, 51, 51);"><br></p><div><h2 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"><span style="font-weight: 700;">一、修改驱动</span></h2><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> </h5><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> 首先需要对Linux内核驱动做一定的修改,使操作系统能够支持Air720<span style="font-weight: 700;">。</span></h5><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"><span style="font-weight: 700;"><br></span></h5><h4 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;">1.Add VID add PID</span></h4><h4 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-size: 14px;"><font color="#ff0000"><span style="font-weight: 700;">File: [KERNEL]/drivers/usb/serial/option.c</span></font></span></h4><pre style="line-height: 1.42857;">static const struct usb_device_id option_ids[] = {<br><pre> //+add by airm2m for Air72x<br> { USB_DEVICE(0x1782, 0x4e00) }, /* 720U 系列*/<br> { USB_DEVICE(0x1286, 0x4e3d) }, /* 720 系列*/<br> //-add by airm2m for Air72x</pre><h5 style="line-height: 1.42857;"> { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },</h5> { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },<br> { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },<br> { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD) },<br> { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD_LIGHT) }, </pre><h4 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> </h4><h4 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;">2. Add the Zero Packet Mechanism </span></h4><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;">⦁For linux Kernel Version newer than 2.6.34:</span></h5><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;"><font color="#ff0000">File: [KERNEL]/drivers/usb/serial/usb_wwan.c</font></span></h5><pre style="line-height: 1.42857;">static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,<br> int endpoint, <br> int dir, void *ctx, char *buf, int len,<br> void (*callback) (struct urb *))<br>{<br> struct usb_serial *serial = port->serial;<br> struct urb *urb;<br> urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */<br> if (!urb)<br> return NULL;<br> usb_fill_bulk_urb(urb, serial->dev,<br> usb_sndbulkpipe(serial->dev, endpoint) | dir,<br> buf, len, callback, ctx);<br><pre> //+add by airm2m for Air72x<br> if(dir == USB_DIR_OUT){<br> struct usb_device_descriptor *desc = &serial->dev->descriptor;<br> if((desc->idVendor == cpu_to_le16(0x1286) && desc->idProduct == cpu_to_le16(0x4e3d)) ) /* 720 系列*/<br> {<br> urb->transfer_flags |= URB_ZERO_PACKET;<br> }<br> if((desc->idVendor == cpu_to_le16(0x1782) && desc->idProduct == cpu_to_le16(0x4e00)) ) /* 720U 系列*/<br> urb->transfer_flags |= URB_ZERO_PACKET;<br> }<br> }<br> //-add by airm2m for Air72x</pre><h5 style="line-height: 1.42857;"> {</h5> return urb;<br>}</pre><div style="color: rgb(51, 51, 51);"><span style="font-weight: 700;"><br></span></div><div style="color: rgb(51, 51, 51);"> <span style="font-weight: 700;">⦁For linux Kernel Version older than 2.6.35:</span><br></div><h4 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <font color="#ff0000"> <span style="font-size: 14px;"><span style="font-weight: 700;">File: [KERNEL]/drivers/usb/serial/option.c</span></span></font></h4><pre style="line-height: 1.42857;">static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint,<br>int dir, void *ctx, char *buf, int len,<br>void (*callback)(struct urb *))<br>{<br>......<br>/* Fill URB using supplied data. */<br>usb_fill_bulk_urb(urb, serial->dev,<br> usb_sndbulkpipe(serial->dev, endpoint) | dir,<br> buf, len, callback, ctx);<br>//+add by airm2m for Air72x<br>if(dir == USB_DIR_OUT)<br>{<br><pre> struct usb_device_descriptor *desc = &serial->dev->descriptor;<br> if(desc->idVendor == cpu_to_le16(0x1286) && desc->idProduct == cpu_to_le16(0x4e3d)) /* 720 系列*/<br> {<br> urb->transfer_flags |= URB_ZERO_PACKET;<br> }<br> if(desc->idVendor == cpu_to_le16(0x1782) && desc->idProduct == cpu_to_le16(0x4e00)) /* 720U 系列*/<br> {<br> urb->transfer_flags |= URB_ZERO_PACKET;<br> }</pre><h5 style="line-height: 1.42857;"><br></h5>}<br>//-add by airm2m for Air72x<br>return urb;<br>}</pre><div style="color: rgb(51, 51, 51);"><br></div><h4 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;">3. Add Reset Resume</span></h4><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;">⦁For linux Kernel Version newer than 3.4:</span></h5><h5 style="font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft Yahei", sans-serif; color: rgb(51, 51, 51);"> <span style="font-weight: 700;"><font color="#ff0000">File: [KERNEL]/drivers/usb/serial/option.c</font></span></h5><pre style="line-height: 1.42857;">static struct usb_serial_driver option_1port_device = {<br> .driver = { <br> .owner = THIS_MODULE,<br> .name = "option1",<br> }, <br> ....<br>#ifdef CONFIG_PM<br> .suspend = usb_wwan_suspend,<br> .resume = usb_wwan_resume,
//+add by airm2m for Air720
.reset_resume = usb_wwan_resume,
//-add by airm2m for Air720
endif
};
⦁For linux Kernel Version older than 3.5:
File: [kernel]/drivers/usb/serial/usb-serial.c
/* Driver structure we register with the USB core */
static struct usb_driver usb_serial_driver = {
.name ="usbserial",
.probe =usb_serial_probe,
.disconnect =usb_serial_disconnect,
.suspend =usb_serial_suspend,
.resume =usb_serial_resume,//+add by airm2m for Air72x
.reset_resume = usb_serial_resume,
//-add by airm2m for Air72x.no_dynamic_id = 1,
};4. Modify Kernel Configuration
Step 1:
cdStep 2:make menuconfigStep 3:Enable CONFIG_USB_SERIAL_OPTION[*] Device Drivers →
[*] USB Support →
[*] USB Serial Converter support →
[*] USB driver for GSM and CDMA modems
Step 4:Configure Kernel to Support PPP
[*] Device Drivers →
[*] Network device support →
[*] PPP (point-to-point protocol) support
5.编译内核
make将编译好的内核下载到开发板。
二、模块测试
将重新编译好的内核下载到开发板之后,待系统重新启动,如果是带RNDIS网卡的驱动,在/dev/目录下会出现如下设备节点:
Air720的AT端口是/dev/ttyUSB2,现在你可以使用UART端口工具如“minicom”或“busybox microcom”测试AT功能,结果如下: