RK3288平台支持的3G modem还是蛮多的,移植所需要做的工作也不是特别多。本文只是粗略介绍4G模块的移植,涉及的东西也不深。如有错误,敬请谅解!
SoC:RK3288
4G chip:EC20
Platform:Android 5.1
厂家已经提供了相应的文档,这里也只是记录下流程.4G模块调试基本上分为三部分:驱动、RIL、android配置文件。
一、驱动配置
1.1 USB Driver Configure
Device Drivers --->
[*] USB support --->
<*> USB Serial Converter support
[*] USB Generic Serail Driver
[*] USB Driver for GSM and CMDA modems
1.2 add EC20 ‘s Vendor ID and Product ID in option_ids[] of drivers/usb/serial/option.c
USB_DEVICE(0x05c6, 0x9215);
- 1
- 1
1.3 USB Driver Configure
Device Drivers --->
[*] USB support --->
<*> USB Modem (CDC ACM) suppor
1.4 PPP Configure
Device Drivers --->
[*] Network device support --->
<*> PPP (point-to-point protocol) support
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
<*> PPP Deflate compression
二、RIL库
RIL库由厂家提供,将该拨号库拷贝到/system/lib/目录下,若厂家提供了ril源码,可将其拷贝到hardware/ril/reference-ril下。
注:需要使用RIL库来配置build.prop
三、配置
修改init.rc的内容,添加以下:
service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
class main
socket rild stream 660 root radio
socket rild-debug stream 666 radio system
user root
group radio cache inet misc audio sdcard_rw log
修改hardware/ril/rild/rild.c中:
OpenLib:
#endif
//switchUser();
然后重新编译android。(init.rc的修改需要在device/rockchip/rk3288/init.rc中修改,否则重新编译可能又被rockchip的配置所覆盖)。
按照文档做完上述工作后,发现4G依然不能用,通过adb shell中输入以下命令:
logcat -b radio
//出现以下错误提示
D/RIL_RK_DATA_V3.5( 169): Found a device, get id
D/use-Rlog/RLOG-RIL_RK_DATA_V3.5( 169): device path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4/3-1.4:1.0/ttyUSB0/tty/ttyUSB0
D/RIL_RK_DATA_V3.5( 169): USB device path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4
D/RIL_RK_DATA_V3.5( 169): TTY Device Vendor path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4/idVendor
D/RIL_RK_DATA_V3.5( 169): TTY Device Product path: /sys/devices/ff540000.usb/usb3/3-1/3-1.4/idProduct
D/RIL_RK_DATA_V3.5( 169): tty Device id is: 05C6/9215
D/RIL_RK_DATA_V3.5( 169): Searching modem table...
D/use-Rlog/RLOG-RIL_RK_DATA_V3.5( 169): [matchModem]: match model count=0
E/use-Rlog/RLOG-RIL_RK_DATA_V3.5( 169): E: Not support modem!!!!
这是因为RK3288的Android 5.1 SDK提供了ril相关配置,各个厂家的不同,还需要更改其适配自己的4G模块。例如厂家提供了rild库是libreference-ril.so,4G模块生成了/dev/ttyUSB0~4共5个串口,AT指令端口为/dev/ttyUSB0;而RK3288默认的配置为:
rild.libpath=/system/lib/libril-rk29-dataonly.so
rild.libargs=-d /dev/ttyACM0
因此将其修改为:
rild.libpath=/system/lib/libreference-ril.so
rild.libargs=-d /dev/ttyUSB0
源码中可在/device/rockchip/rk3288/rk3288_box/system.prop中修改,以后每次编译就能正常使用了。
最后需要在init.rc中添加:
chmod 777 /dev/ttyUSB0
chmod 777 /dev/ttyUSB1
chmod 777 /dev/ttyUSB2
chmod 777 /dev/ttyUSB3
chmod 777 /dev/ttyUSB4
重新编译源码后烧录固件,亲测中国联通4G LTE能正常上网。