http://ask.openluat.com/article/95?tdsourcetag=s_pcqq_aiomsg
1、此次更新兼容了android2.3.4、android4、android5、android6、 android7版本
2、修復了相關BUG
3、模塊軟件版本需要同步更新至AirM2M_720_V446_LTE_AT或者更高版本
4、此版本已在RK、全志平臺各CPU上驗證通過。
5、RIL代碼與以下廠商調試通過:
深圳市三全視訊科技有限公司 http://www.3qvideo.com/
深圳市啓明雲端科技有限公司 http://www.wireless-tag.cn/
深圳市羣智信息技術有限公司 http://www.alagroup.cn/
深圳市衆雲世紀科技有限公司 http://www.zysj-sz.com/
深圳音諾恆科技有限公司 http://www.innohi.com.cn/
深圳市國睿智能技術有限公司 http://www.gruio.com/
RIL驅動下載地址:ril_release_1115.tar.gz
一、 LINUX內核修改
1. Add VID add PID
File: [KERNEL]/drivers/usb/serial/option.c
static const struct usb_device_id option_ids[] = {
//+add by airm2m for Air72x
{ USB_DEVICE(0x1286, 0x4e3d) },
//-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) },
2. Add the Zero Packet Mechanism
⦁For linux Kernel Version newer than 2.6.34:
File: [KERNEL]/drivers/usb/serial/usb_wwan.c
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))
{
urb->transfer_flags |= URB_ZERO_PACKET;
}
}
//-add by airm2m for Air72x
return urb;
}
⦁For linux Kernel Version older than 2.6.35:
File: [KERNEL]/drivers/usb/serial/option.c
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))
{
urb->transfer_flags |= URB_ZERO_PACKET;
}
}
//-add by airm2m for Air72x
return urb;
}
3. Add Reset Resume
⦁For linux Kernel Version newer than 3.4:
File: [KERNEL]/drivers/usb/serial/option.c
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,
#endif
//+add by airm2m for Air726
.reset_resume = usb_wwan_resume,
//-add by airm2m for Air726
};
⦁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
cd <your kernel directory>
make menuconfig
Step 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
將編譯好的內核下載到開發板。
二、android修改和編譯
1. 請將附件中的代碼包(reference-ril_release_1115.tar.gz)下載並解壓縮。
2. 將解壓後的refrence-ril目錄下的所有文件覆蓋到android代碼的hardware/ril/refrence-ril目錄下
3. 在rild.c文件中, 註釋掉 switchUser(); 這一行代碼。
4. 輸入touch hardware/ril/* 強制讓ril目錄下所有的文件參與編譯
5. 開始編譯android
三、配置
1. 在init.rc文件中加入如下代碼:
# ril related services
service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so class main
socket rild stream 660 root radio
socket rild-debug stream 660 radio system
user root
#ril related services
service ril-daemon /system/bin/rild -l /system/lib64/libreference-ril.so class main
socket rild stream 660 root radio
socket rild-debug stream 660 radio system
user root
2. 如果您使用的是物聯網卡(比如46004的SIM卡),可能需要在apns-conf.xml中添加相應的APN
3. 對於android5.0及以上的版本,需要對SELinux相關的配置文件做如下改動:
1). 在external/sepolicy/file_contexts文件中加入以下代碼:
/dev/ttyUSB[0-9]* u:object_r:tty_device:s0
/system/bin/rild u:object_r:rild_exec:s0
/system/socket/rild u:object_r:rild_socket:s0
/system/socket/rild-debug u:object_r:rild_debug_socket:s0
/system/bin/pppd u:object_r:pppd_exec:s0
/dev/ppp u:object_r:ppp_device:s0
2).在external/sepolicy/rild.te文件中加入以下代碼:
allow rild default_prop:property_service set;
allow rild device:chr_file { read write ioctl open getattr };
allow rild kernel:system module_request;
allow rild net_radio_prop:property_service set;
allow rild ppp_device:chr_file { read write ioctl open };
allow rild ppp_exec:file { read execute open execute_no_trans };
allow rild radio_prop:property_service set;
allow rild self:capability { net_admin setuid };
allow rild shell_exec:file { read execute open execute_no_trans };
allow rild sysfs_wake_lock:file { open read write };
allow rild system_file:file execute_no_trans;
allow rild system_prop:property_service set;
3).修改external/sepolicy/domain.te(也有可能在其他位置,具體請諮詢方案商)
neverallow { domain -unconfineddomain -ueventd -recovery -busybox } device:chr_file { open read write };
改成:
neverallow { domain -unconfineddomain -ueventd -recovery -busybox -rild } device:chr_file { open read write };
請注意:每個廠商提供的domain.te不一定如上所示。找到類似於neverallow {domain -XXXX -XXXX -XXXX} device:chr_file { open read write };格式的地方,加上-rild即可
四、調試
如果在調試過程中遇到了問題,我們可能需要您提供相關的LOG。
使用adb工具抓取相應的LOG的方法:
1. 使用命令 adb logcat –b radio –v time ,可以將LOG顯示在命令行窗口
2. 在linux/windows+cygwin環境下,可以使用命令 adb logcat –b radio –v time > 本地文件,將LOG輸出到本地目錄。