Android RIL Driver: User Guide
Android RIL Driver: User Guide
Android RIL Driver: User Guide
User Guide
Rev. Android_RIL_Driver_User_Guide_V1.8
Date: 2019-03-07
Status: Released
www.quectel.com
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
GENERAL NOTES
QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.
COPYRIGHT
THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
QUECTEL WIRELESS SOLUTIONS CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION
AND EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE
FORBIDDEN WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF
DAMAGES. ALL RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR
REGISTRATION OF A UTILITY MODEL OR DESIGN.
Copyright © Quectel Wireless Solutions Co., Ltd. 2019. All rights reserved.
Android_RIL_Driver_User_Guide 1 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
History
1.7 2018-07-13 Macro GAO Added Android 8.x in supported Android versions
Android_RIL_Driver_User_Guide 2 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
Contents
1 Introduction .......................................................................................................................................... 6
1.1. Applicable Products ..................................................................................................................... 6
4 Configure SELinux............................................................................................................................. 16
4.1. Configure Service ril-daemon .................................................................................................... 16
4.2. Uncomment the function of switchUser() ................................................................................... 16
4.3. Configure SELinux Rule for RIL ................................................................................................. 17
6 FAQs .................................................................................................................................................... 20
6.1. How to Set the APN ................................................................................................................... 20
6.2. Why Quectel RIL Driver Does not Work .................................................................................... 21
6.3. Why Short Messages cannot be Sent or Received ................................................................... 21
7 Appendix A References..................................................................................................................... 22
Android_RIL_Driver_User_Guide 3 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
Table Index
Android_RIL_Driver_User_Guide 4 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
Figure Index
Android_RIL_Driver_User_Guide 5 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
1 Introduction
This document mainly introduces how to integrate RIL (Radio Interface Layer) driver into Android OS of
customers’ target devices as well as how to modify the configuration files for starting RIL service.
Android_RIL_Driver_User_Guide 6 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
Android_RIL_Driver_User_Guide 7 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
SMS YES
Phonebook YES
Android_RIL_Driver_User_Guide 8 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
3 RIL Integration
The chapter mainly describes the RIL driver structure and procedures of setting up an Android system
with the RIL driver.
Android RIL provides the abstract layer between Android telephony service and radio hardware.
The following illustrates the RIL in the context of Android telephony architecture.
Application Phone
Framework Java/android/telephony
RIL
Java/android/telephony/gsm
Unix
Libraries
Radio Daemon (RILD)
(User Space) /commands/rild
Vendor RIL
System/libs/libril-vendor.so
Packet Service
Linux Kernel Linux IP Stack
Voice and
Control
Packet Driver
PPP.for example
Baseband Baseband
Android_RIL_Driver_User_Guide 9 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
The RIL in Android is located between kernel and application framework. It is divided into two parts: RILD
and Vendor RIL.
Vendor RIL is responsible for radio communication via AT command channel and data communication
with packet data channel (PDCH).
The java framework of RIL consists of two parts as well. One is RIL module and the other is Phone
module. The RIL module is used to communicate with the lower RILD, and the phone module directly
provides phone function interfaces to application.
The kernel needs to be configured to support PPP dial up. For detailed operation procedures, please refer
to Chapter 3.6 in Quectel_WCDMA<E_Linux_USB_Driver_User_Guide.
If customers use EC2x, EG9x, Ex06, Ex12, AGxx, UCxx or UGxx modules, please integrate USB serial
driver, CDC ACM driver, GobiNet driver or QMI WWAN driver in Linux kernel. Otherwise, please skip this
section. For detailed operation procedures, please refer to Chapter 3.2, Chapter 3.3, Chapter 3.4 or
Chapter 3.5 in Quectel_WCDMA<E_Linux_USB_Driver_User_Guide.
Android_RIL_Driver_User_Guide 10 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
Please put the following RIL library files provided by Quectel into the Android system.
NOTE
If customers use Android 8.0 or later versions, Quectel RIL driver V1.42.08 or later versions should be
used.
Android_RIL_Driver_User_Guide 11 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
In order to use the RIL driver normally, some configuration files in Android system should be modified.
The init.rc can be configured by adding ril-daemon service to it. The relevant lines added to init.rc are
different, depending on the accessing interfaces and the android versions being used.
If customers’ modules are accessed by USB interface, like EC2x, EG9x, Ex06, Ex12, AGxx, UCxx and
UGxx, please add the following lines to init.rc:
Android_RIL_Driver_User_Guide 12 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
If customers’ modules are accessed by UART interface, like Mxx modules, please add the following lines
to init.rc:
⚫ -B <baud rate>
The speed of UART port. For example: 115200bps, 230400bps or 460800bps. The default baud rate is
115200bps.
Android_RIL_Driver_User_Guide 13 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
The location of init.rc file varies with customers’ project settings. The following gives a non-exhaustive list
of file paths which may contain the init.rc file.
⚫ system/core/rootdir/init.rc
⚫ device/fsl/imx6/init.rc
⚫ device/ti/am335xevm_sk/init.am335xevm.rc
⚫ device/generic/x86/init.rc
⚫ device/samsung/smdkv210/init.smdkv210_sdmmc.rc
3.5.2. Modify rild.c (Applicable for Android Versions prior to Android 8.0)
RILD (ril-daemon) requires root privileges, so please comment the function of switchUser() in the file
($Android_src)/hardware/ril/rild/rild.c.
Android_RIL_Driver_User_Guide 14 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
3.5.3. Add HIDL Description (Applicable for Android 8.0 or Later Versions)
On Android 8.0 or later versions, the communication interface between Android phone framework and
ril-daemon service has been changed from socket to HIDL, so please make sure that the manifest.xml
contains the following HIDL description.
<hal format="hidl">
<name>android.hardware.broadcastradio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IBroadcastRadioFactory</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.radio.deprecated</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IOemHook</name>
<instance>slot1</instance>
</interface>
</hal>
<hal format="hidl">
<name>android.hardware.radio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IRadio</name>
<instance>slot1</instance>
</interface>
</hal>
The location of manifest.xml file varies with customers’ project settings. For example:
device/rockchip/rk3399/manifest.xml.
Android_RIL_Driver_User_Guide 15 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
4 Configure SELinux
If the SELinux installed in customers’ Android devices is enabled and runs in enforcing mode, please
follow the procedures below to make sure that Quectel RIL has full access to SELinux privileges.
Otherwise, customers can skip this chapter.
To make sure Quectel RIL has full access to Selinux priviledges, the user of service ril-daemon should be
radio, so the user of service ril-daemon indicated in Chapter 3.5.1 should be changed from root to radio.
Besides, capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW should be added to ril-daemon service.
An example, taking Android 8.0 for instance, is shown below.
To make sure Quectel RIL has full access to Selinux priviledges, the function of switchUser() mentioned in
Chapter 3.5.2 should be uncommented.
Android_RIL_Driver_User_Guide 16 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
#quectel port
/dev/ttyUSB* 0660 radio radio
/dev/cdc-wdm* 0660 radio radio
/dev/qcqmi* 0660 radio radio
/dev/cdc-acm* 0660 radio radio
The locations of ueventd.rc, rild.te and file_contexts may vary with customers’ project settings, but in
general, these files are located in the following paths respectively by default.
⚫ system/core/rootdir/ueventd.rc
⚫ external/sepolicy/rild.te
⚫ external/sepolicy/file_contexts
Android_RIL_Driver_User_Guide 17 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
5 Debugging Method
1) Catch the logs of RIL module by typing the following command in Window’s CMD tool:
2) Catch the logs of Android system by typing the following command in Window’s CMD tool:
3) Sometimes, customers may want to perform tests on lots of devices or for a long time, and it is not
convenient to connect all devices with PC via USB cables. In such case, customers can catch the log
files by following command:
adb shell
logcat –b radio –v time –f <filename> &
The character "&" makes the "logcat" process run in the background, thus customers’ devices can be
disconnected.
4) When customers’ tests are finished, the log files can be fetched from devices to a local directory by
the following command:
Android_RIL_Driver_User_Guide 18 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
The following table lists some log tags that are commonly applied.
RIL /hardware/ril/reference-ril/refereince-ril.c
AT /hardware/ril/reference-ril/atchannel.c
RILD /hardware/ril/rild/rild.c
RILC /hardware/ril/libril/ril.cpp
RILB /frameworks/base/telephony/java/com/android/internal/telephony/BaseCommands.java
RILJ /frameworks/base/telephony/java/com/android/internal/telephony/gsm/RIL.java
GSM /frameworks/base/telephony/java/com/android/internal/telephony/gsm/GSMPhone.java
Android_RIL_Driver_User_Guide 19 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
6 FAQs
If the dialling process is interrupted, it is quite possible that the APN has not been set yet. Please set the
APN in Android UI: Settings → WIRELESS & NETWORKS → … → Mobile Networks → Access Point
Names.
If nothing is found in Access Point Names, it indicates that the APN has not been set. In such case,
customers need to add a new APN to the system. The following is an example shows the access point
editing interface. Please note that the Access Point Name varies with the operators and (U)SIM cards.
Android_RIL_Driver_User_Guide 20 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
There are many reasons that may cause the failure of Quectel RIL operation, some common causes are
listed as below for troubleshooting.
Use command getprop init.svc.ril-daemon to check RIL daemon status. If non-value, Stopped or
Restarting is returned, rather than Running, it indicates that RIL daemon is not running.
Check the "ril-daemon" service definition in init.rc through command cat /init.rc | grep ril-daemon. The
expected result should be service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so. Check
the arguments, word spelling, blank space, etc. to make sure the RIL library is loaded correctly.
⚫ Use ls -l /dev/ttyUSB* command to check the access right of the device file.
⚫ Use getenforce command to check whether the SELinux has been enabled. If yes, please use
setenforce 0 command to disable the SELinux.
Use getprop gsm.version.ril-impl command to check the Quectel RIL version, and the return value
should be started with Quectel_Android_RIL_SR. If not, then it indicates the RIL library is not provided
by Quectel.
If the return value is false, it indicates that the SMS receive/send function has been disabled.
If non-value is returned, please check frameworks/base/core/res/res/values/config.xml (the manufacturer
override configure file) and find config_sms_capable. If the config_sms_capable configuration in the
config.xml is false (e.g. <bool name="config_sms_capable">false</bool>), please change it to true.
Android_RIL_Driver_User_Guide 21 / 22
LTE/UMTS/HSPA(+)/GSM/GPRS Module Series
Android RIL Driver User Guide
7 Appendix A References
Abbreviation Description
MS Mobile Station
PID Product ID
VID Vendor ID
Android_RIL_Driver_User_Guide 22 / 22