Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and...

17
Copyright © Neoway Technology Co., Ltd. 1 Android RIL Driver User Guide Version 1.0

Transcript of Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and...

Page 1: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Copyright © Neoway Technology Co., Ltd. 1

Android RIL Driver

User Guide

Version 1.0

Page 2: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. i

Copyright © Neoway Technology Co., Ltd. 2017. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without prior

written consent of Shenzhen Neoway Technology Co., Ltd.

Trademarks

is the trademark of Neoway Technology Co., Ltd.

All other trademarks and trade names mentioned in this document are the property of their respective

holders.

Notice

This document applicable models are: N720, N710.

This document is intended for system engineers (SEs), development engineers, and test engineers.

The information in this document is subject to change without notice due to product version update or

other reasons.

Every effort has been made in preparation of this document to ensure accuracy of the contents, but all

statements, information, and recommendations in this document do not constitute a warranty of any kind,

express or implied.

[email protected]

[email protected]

Website: http://www.neoway.com

Page 3: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. ii

Revision Record

Issue Date Changes

V1.0 2017-04 Initial draft

Page 4: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. iii

Content 1 About This Document ...................................................................................................... 1

2 RIL Driver ........................................................................................................................... 2

2.1 VID and PID List ................................................................................................................................ 2

2.2 Function .............................................................................................................................................. 2

2.3 Software Version ................................................................................................................................ 2

3 USB Driver Configuration ............................................................................................... 3

3.1 Adding VID/PID ................................................................................................................................. 3

3.2 Configuring the Serial Port Driver in Menuconfig GUI ..................................................................... 3

3.3 Testing ................................................................................................................................................ 4

4 Configuring USB NDIS Kernel ...................................................................................... 5

4.1 Configuring NDIS in Menuconfig GUI .............................................................................................. 5

4.2 Test ..................................................................................................................................................... 6

5 RIL Integration ................................................................................................................... 7

5.1 About RIL ........................................................................................................................................... 7

5.1.1 Communication between AP and BP......................................................................................... 7

5.1.2 Position of RIL in Android System ........................................................................................... 8

5.2 Configuring RIL ................................................................................................................................. 8

6 FAQ .................................................................................................................................... 11

6.1 How to Set APN ................................................................................................................................11

6.2 How to Capture Logs........................................................................................................................ 13

6.3 How to Analyze Dialup Failure ........................................................................................................ 13

Page 5: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 1

1 About This Document This document provides guidance for users to integrate the RIL library driver into the device running

Android OS, and to modify the configuration file to debug the RIL library driver for the PPP dial-up or

NIDS dialing.

It is applicable to N720, and N710.

Page 6: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 2

2 RIL Driver

2.1 VID and PID List

Neoway has several models of 4G LTE modules, which support NDIS and PPP dial-up. The following

table shows corresponding VID and PID list.

Model no VID PID

N720 0x2949 0x8241

N710 0x05c6 0x8080

Configurations of N710 USB port:

Default USB composition: RNDIS + MODEM + TTY + Diag

Configurations of N720 USB port:

Default USB composition: RNDIS + MODEM + TTY + TTY + Mass storage + ADB + Diag

2.2 Function

Function Support or Not

Data service YES

2.3 Software Version

Software Version Support or Not

Android 3.x YES

Android 4.x YES

Android 5.x YES

Android 6.x YES

Page 7: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 3

3 USB Driver Configuration

3.1 Adding VID/PID

N710 is used as an example. VID/PID varies with modules.

Open drivers / usb / serial / option.c.

#define QUALCOMM_VENDOR_ID 0x05C6

Add the following line in the option_ids array:

USB_DEVICE (QUALCOMM_VENDOR_ID, 0x8080)}

3.2 Configuring the Serial Port Driver in Menuconfig GUI

In the kernel directory, execute make menuconfig. In the GUI displayed, perform the following

procedures:

Step 1 Navigate to Device Drivers.

Step 2 Select USB support.

Step 3 Select USB Gadget Support.

Step 4 Select USB Gadget Drivers (Serial Gadget (with CDC ACM and CDC OBEX support)).

Page 8: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 4

Step 5 Go back to the previous directory, select USB Serial Converter support.

3.3 Testing

After compiling and reflashing and the serial port is configured, check whether /dev/ttyUSB* is generated

in the setting node.

If it is generated, upper applications can communicate with the module via these ports (send AT

commands, etc.).

For an N710 module

− If three ttyUSB ports are displayed: ttyUSB0 is the AT port, ttyUSB1 is the modem port.

− If five ttyUSB ports are displayed: ttyUSB2 is the AT port, ttyUSB3 is the modem port.

For an N720 module

− If six ttyUSB ports are displayed: ttyUSB3 is the AT port, ttyUSB1 is the modem port.

− If five ttyUSB ports are displayed: ttyUSB2 is the AT port, ttyUSB0 is the modem port.

When testing AT commands, modify the permissions of ttyUSB if requiring permission.

Page 9: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 5

4 Configuring USB NDIS Kernel If PPP dialup is used, skip this step and move to RIL integration.

USB NDIS kernel is configured in two ways: one is in the deconfig, the other is in the menuconfig GUI.

The following sections describe how to configure in menuconfig GUI.

4.1 Configuring NDIS in Menuconfig GUI

In the kernel directory, execute make menuconfig. In the GUI displayed, perform the following

procedures:

Step 1 Select Device Drivers.

Step 2 Select Network device support.

Step 3 Select USB Network Adapters.

Step 4 Select Multi-purpose USB Networking Framework.

Page 10: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 6

Step 5 Select Host for RNDIS and ActiveSync devices.

4.2 Test

Recompile the software and reflash into device. Power on the device again and plug in module. After the

device is powered on, usb0 is added when querying using the netcfg command.

Page 11: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 7

5 RIL Integration Decompression Neoway_Android_Ril.tar.gz.

libreference-ril.so (PPP dialup)

libreference-ril_ndis.so (used for NDIS dialup. Modify the library name when using it)

init.gprs-pppd (PPP dialup script)

Neoway_Android_RIL_Driver_User_Guide_V1.0

5.1 About RIL

Android Radio Interface Layer (RIL) provides an abstraction layer between the Telephony service and the

Radio hardware. RIL is responsible for the reliable data transmission, AT command sending and response

parsing.

5.1.1 Communication between AP and BP

The OS, user interface (UI), and applications run on the application processor (AP), such as an

ARM-based CPU. The radio communications and control software, however, runs on another separated

CPU called Baseband Processor (BP).

In an Android OS, RIL Daemon (RILD) runs on the AP. Applications on the AP send AT commands to BP

through the RILD, and the BP sends the information received to the AP through RILD. AP and BP

communicate in the following two ways:

Solicited Response: AP sends a request to BP, and BP sends a reply to AP.

Unsolicited Response: BP sends events to AP.

Page 12: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 8

5.1.2 Position of RIL in Android System

The following figure shows the RIL in the context of Android's Telephony system architecture.

Android RIL includes an upper layer and a lower layer:

The upper layer is in the Java Framework, which is Java-based. It consists of two parts:

− RIL framework: the RIL module is mainly used for communication with the lower RILD.

− Phone framework: The phone framework directly expose the telephony interface to application

developers to implement the telephony function.

The lower layer is above the Linux kernel and C/C++-based. It consists of two components:

− RILD: The RILD initializes the Vendor RIL, processes all communication from Android

telephony services, and dispatches calls to the Vendor RIL as solicited commands.

− Vendor RIL, The radio-specific Vendor RIL of ril.h that processes all communication with radio

hardware and dispatches calls to the RILD through unsolicited commands.

5.2 Configuring RIL

Configure RIL in the following process:

Step 1 Modify init.rc.

Generally, this file is in the /system/core/rootdir/ file directory. Navigate to the init.rc file using adb

shell and then modify it.

Page 13: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 9

NDIS

Specify the library name as shown below. Then jump to Step 5 to add the file.

service ril-daemon /system/bin/rild –l libreference-ril.so

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio sdcard_rw

PPP

Perform the following steps:

1. Specify the library and serial device name.

Delete the RIL library file and serial device name after -1 in service rild and add the following

contents:

service ril-daemon /system/bin/rild -l libreference-ril.so

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio sdcard_rw

ril-deamon and /system/bin/rild, used to start RILD are the executable files, which are generated

after hardware/ril/rild.c. The parameters are as follows:

− -l: Specifies that the AT-related dynamic link library is libreference-ril.so;

− -d: Specifies that the AT port is /dev/ttyUSB0 (depends on the number displayed).

2. Add a dialup script.

service pppd_gprs /etc/init.gprs-pppd

class main

disabled

oneshot

group radio cache inet misc

3. Add permissions.

Create peers and chat directories.

on post-fs-data

......

mkdir /data/ppp 0777 root root

mkdir /data/ppp/peers 0777 root root

mkdir /data/ppp/chat 0777 root root

Step 2 Modify the dialing script path.

In the /ppp/pppd/pathnames.h file, modify the dialup script path:

Annotations: //#define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/"

Add: #define _PATH_PEERFILES _ROOT_PATH "/data/ppp/peers/"

Step 3 Modify the permissions.

Add directories in /system/core/include/private/android_filesystem_config.h:

android_dirs[]

{ 00755, AID_ROOT, AID_ROOT, "data/ppp/peers" },

Page 14: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 10

{ 00755, AID_ROOT, AID_ROOT, "data/ppp/chat" },

android_files[]

{00777, AID_ROOT, AID_SHELL, "system/etc/init.gprs-pppd"}

Step 4 After the modification, compile the code and finally burn.

Step 5 Add files.

NDIS dialup

Preset the libreference-ril.so library to /system/lib and modify the permissions of related files.

adb push libreference-ril.so /system/lib

adb shell chmod 777 /system/bin/ndc

adb shell chmod 777 /system/bin/netcfg

PPP dialup

Preset init.gprs-ppspd and 3gdata_call.conf to the path specified by init.rc and modify the

permissions.

adb push init.gprs-pppd /etc

adb push libreference-ril.so /system/lib

adb shell chmod 777 /etc/init.gprs-pppd

adb shell chmod 777 /system/lib/libreference-ril.so

Page 15: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 11

6 FAQ

6.1 How to Set APN

Perform the steps as follows:

Step 1 Tap the settings and navigate to the Access Point Names page.

Step 2 Tap New APN at the bottom.

Page 16: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 12

Step 3 Set APN based on the operator.

Step 4 Set MCC MNC.

MMC and MNC generally are set by default. If the MMC and MNC are not supported, set them

manually.

Page 17: Android RIL Driver User Guide - wless.ru · The lower layer is above the Linux kernel and C/C++-based. It consists of two components: − RILD: The RILD initializes the Vendor RIL,

Android RIL Driver User Guide

Copyright © Neoway Technology Co., Ltd. 13

6.2 How to Capture Logs

1. Capture radio log: adb logcat -b radio -v time.

2. Capture Android system log: adb logcat -v time.

3. If the device is connected to the computer via a serial port, execute the following commands after

entering the serial shell mode:

Locat -b radio -v time

Logcat -v time

4. Printed log as a file

6.3 How to Analyze Dialup Failure

Dialup failure might be caused by different factors. Follow the procedures below to locate the issues:.

1. Check if the SIM card works properly.

Search AT + CPIN? In the log to see if return value is READY.

If the module returns ERROR or SIM PIN (requiring PIN code), check whether the SIM card slot

detects the SIM card, whether it is powered on, or whether the SIM card is normal.

2. Check whether the module registers the voice network or data network.

Search AT + CREG? and AT + CGREG in the log. If the module returns 0,1 or 0,5, it can register

the voice network or data network. If it returns other values, check if the SIM card arrears, or if there

is any problem with the antenna.

3. Check whether PPP dialup or NDIS dialup works properly.

Search PPP or AT ^ NDISDUP = 1,1 in the log to see if any PPP dialup or NDIS dialup is

performed.

If not, search No APN found for carrier, which indicates that this APN is not supported. Add it to

apns-conf.xml.

If the message does not exist, search setup_data_call, which indicates data service is requested.

If setup_data_call does not exist, check if data service is enabled.