添加 USB 串口驱动:
device drivers-->
usb support-->
usb serial converter support-->
USB driver for GSM and CDMA modems
添加 USB 网卡驱动
device drivers-->
Network device support-->
usb Network Adapters-->
Mulil-purpose USB Networking Framework
device drivers-->
Network device support-->
ppp support-->
ppp filtering
ppp support for async serial ports
ppp support for sync tty ports
ppp deflate compression
ppp BSD-compress compression
在内核驱动源文件中添加模组相关的信息
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(0x19d2, 0x1476) }
}
添加黑名单信息,上面添加模组信息时只添加了设备的 VID 和 PID,没有附加任何
额外的端口信息,这样会导致设备的网卡也被加载成为 USB 串口。以下提供一种类
似于黑名单的方式,在 option_probe 函数中,将网卡对应的端口加入黑名单,防
止 USB 网卡被加载成为 USB 串口。
printk("idVendor=%x, idProduct=%x, bInterfaceNumber =%d\r\n",
serial->dev->descriptor.idVendor,
serial->dev->descriptor.idProduct,
serial->interface->cur_altsetting->desc. bInterfaceNumber);
if (serial->dev->descriptor.idVendor == 0x19d2 &&
serial->dev->descriptor.idProduct == 0x1476 &&
serial->interface->cur_altsetting->desc. bInterfaceNumber==3)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x19d2&&
serial->dev->descriptor.idProduct == 0x1476&&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 4)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x19d2&&
serial->dev->descriptor.idProduct == 0x1476&&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 5)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x19d2&&
serial->dev->descriptor.idProduct == 0x0199&&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 0)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x19d2 &&
serial->dev->descriptor.idProduct == 0x0199 &&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 1)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x305a &&
serial->dev->descriptor.idProduct == 0x1406 &&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 3)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x305a &&
serial->dev->descriptor.idProduct == 0x1406 &&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 4)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x305a &&
serial->dev->descriptor.idProduct == 0x1406 &&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 5)
return -ENODEV;
//the following is added for GM510
if (serial->dev->descriptor.idVendor == 0x305a&&
serial->dev->descriptor.idProduct == 0x1415&&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 0)
return -ENODEV;
if (serial->dev->descriptor.idVendor == 0x305a&&
serial->dev->descriptor.idProduct == 0x1415&&
serial->interface->cur_altsetting->desc. bInterfaceNumber == 1)
return -ENODEV;
在Android系统的*.rc中添加服务
文件路径:一般情况下,路径在device/rockchip/rk3288/init.rk30board.rc
ril-daemon 服务(添加前注释掉原来的 ril-daemon 服务)
service ril-daemon/system/bin/rild-l/system/lib/libreference-ril-gosuncn.so
class main
socket rild stream 660 root radio
socket rild-debug stream 660 radio system
user root
group radio cache inet misc audio log
pppd_gprs 服务
service pppd_gprs/system/etc/init.gprs_pppd
user root
group radio cache inet misc log
disabled
oneshot
文件名 | 打包后在 Android 系统中的目录 |
libreference-ril-gosuncn.so | /system/lib |
netcfg | /system/bin |
init.gprs_pppd | /system/etc |
ip-up-ppp0 | /system/etc/ppp |
ip-down-ppp0 | /system/etc/ppp |
Leave a Reply