Air720正常启动后,通过USB连接到linux设备上,驱动正常加载后会产生如下设备:
1.Air720 系列 (1802/1802S)
2.Air720U系列(8910)
static const struct usb_device_id option_ids[] = {//+add by airm2m for Air72x
{ USB_DEVICE(0x1782, 0x4e00) }, /* 720U 系列*/
{ USB_DEVICE(0x1286, 0x4e3d) }, /* 720 系列*/
//-add by airm2m for Air72x{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD_LIGHT) },
static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
int endpoint,
int dir, void *ctx, char *buf, int len,
void (*callback) (struct urb *))
{
struct usb_serial *serial = port->serial;
struct urb *urb;
urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
if (!urb)
return NULL;
usb_fill_bulk_urb(urb, serial->dev,
usb_sndbulkpipe(serial->dev, endpoint) | dir,
buf, len, callback, ctx);//+add by airm2m for Air72x
if(dir == USB_DIR_OUT){
struct usb_device_descriptor *desc = &serial->dev->descriptor;
if((desc->idVendor == cpu_to_le16(0x1286) && desc->idProduct == cpu_to_le16(0x4e3d)) ) /* 720 系列*/
{
urb->transfer_flags |= URB_ZERO_PACKET;
}
if((desc->idVendor == cpu_to_le16(0x1782) && desc->idProduct == cpu_to_le16(0x4e00)) ) /* 720U 系列*/
urb->transfer_flags |= URB_ZERO_PACKET;
}
}
//-add by airm2m for Air72x{
return urb;
}
static struct urb *option_setup_urb(struct usb_serial *serial, int endpoint,
int dir, void *ctx, char *buf, int len,
void (*callback)(struct urb *))
{
......
/* Fill URB using supplied data. */
usb_fill_bulk_urb(urb, serial->dev,
usb_sndbulkpipe(serial->dev, endpoint) | dir,
buf, len, callback, ctx);
//+add by airm2m for Air72x
if(dir == USB_DIR_OUT)
{struct usb_device_descriptor *desc = &serial->dev->descriptor;
if(desc->idVendor == cpu_to_le16(0x1286) && desc->idProduct == cpu_to_le16(0x4e3d)) /* 720 系列*/
{
urb->transfer_flags |= URB_ZERO_PACKET;
}
if(desc->idVendor == cpu_to_le16(0x1782) && desc->idProduct == cpu_to_le16(0x4e00)) /* 720U 系列*/
{
urb->transfer_flags |= URB_ZERO_PACKET;
}}
//-add by airm2m for Air72x
return urb;
}
static struct usb_serial_driver option_1port_device = {
.driver = {
.owner = THIS_MODULE,
.name = "option1",
},
....
#ifdef CONFIG_PM
.suspend = usb_wwan_suspend,
.resume = usb_wwan_resume,//+add by airm2m for Air720#endif
.reset_resume = usb_wwan_resume,
//-add by airm2m for Air720
};
/* 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.no_dynamic_id = 1,
.reset_resume = usb_serial_resume,
//-add by airm2m for Air72x
};
cd <your kernel directory>
make menuconfig
[*] Device Drivers →
[*] USB Support →
[*] USB Serial Converter support →
[*] USB driver for GSM and CDMA modems
[*] Device Drivers →
[*] Network device support →
[*] PPP (point-to-point protocol) support
make
二、模块测试
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!