Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source...

42
Android RIL Production delivery Source code Application Note Abstract This document describes how to build and use the RIL library for LEON-G / SARA-G340 / SARA-G350 / LISA-U / SARA-U / TOBY-L2 series on the Android operating system. www.u-blox.com UBX-13002041 - R10

Transcript of Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source...

Page 1: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL Production delivery – Source code Application Note

Abstract

This document describes how to build and use the RIL library for LEON-G / SARA-G340 / SARA-G350 / LISA-U / SARA-U / TOBY-L2 series on the Android operating system.

www.u-blox.com

UBX-13002041 - R10

Page 2: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10

Page 2 of 42

Document Information

Title Android RIL

Subtitle Production delivery – Source code

Document type Application Note

Document number UBX-13002041

Revision, date R10 24-Oct-2014

Document status Advance Information

Document status explanation

Objective Specification Document contains target values. Revised and supplementary data will be published later.

Advance Information Document contains data based on early testing. Revised and supplementary data will be published later.

Early Production Information Document contains data from product verification. Revised and supplementary data may be published later.

Production Information Document contains the final product specification.

This document applies to the following products:

Product name

LEON-G series

SARA-G340 series

SARA-G350 series

LISA-U series

SARA-U series

TOBY-L2 series

u-blox reserves all rights to this document and the information contained herein. Products, names, logos and designs described herein may in whole or in part be subject to intellectual property rights. Reproduction, use, modification or disclosure to third parties of this document or any part thereof without the express permission of u-blox is strictly prohibited.

The information contained herein is provided “as is” and u-blox assumes no liability for the use of the information. No warranty, either express or implied, is given, including but not limited, with respect to the accuracy, correctness, reliability and fitness for a particular

purpose of the information. This document may be revised by u-blox at any time. For most recent documents, please visit www.u-blox.com.

Copyright © 2014, u-blox AG

Page 3: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Contents

Page 3 of 42

Contents

Contents .............................................................................................................................. 3

1 Introduction .................................................................................................................. 5

2 Production delivery ...................................................................................................... 6

2.1 Software release ................................................................................................................................... 6

2.2 Android 2.3 delivery contents ............................................................................................................... 6

2.3 Android 4.0, 4.1, 4.2, 4.3, 4.4 deliveries contents ................................................................................ 6

3 Host PC configuration .................................................................................................. 7

4 Build source code ......................................................................................................... 8

5 Debug RIL .................................................................................................................... 10

5.1 Host PC configuration ........................................................................................................................ 10

5.1.1 Windows configuration ............................................................................................................... 10

5.1.2 Linux configuration ..................................................................................................................... 10

5.2 RIL log ................................................................................................................................................ 11

Appendix .......................................................................................................................... 12

A Kernel configuration .................................................................................................. 12

A.1 USB kernel configuration .................................................................................................................... 12

A.2 UART kernel configuration .................................................................................................................. 12

A.3 SPI kernel configuration ...................................................................................................................... 12

A.4 RNDIS / ECM kernel configuration ...................................................................................................... 12

A.5 PPP kernel configuration ..................................................................................................................... 13

B Android 2.3 module configuration ............................................................................ 13

B.1 USB .................................................................................................................................................... 13

B.1.1 BoardConfig.mk configuration ............................................................................................... 13

B.1.2 Init.rc configuration .............................................................................................................. 13

B.2 UART .................................................................................................................................................. 14

B.2.1 BoardConfig.mk configuration ............................................................................................... 14

B.2.2 Init.rc configuration .............................................................................................................. 15

B.3 SPI ...................................................................................................................................................... 16

B.3.1 BoardConfig.mk configuration ............................................................................................... 16

B.3.2 Init.rc configuration .............................................................................................................. 16

C Android 4.0 module configuration ............................................................................ 18

C.1 USB .................................................................................................................................................... 18

C.1.1 AndroidProducts.mk ............................................................................................................ 18

C.1.2 Init.rc configuration .............................................................................................................. 18

Page 4: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Contents

Page 4 of 42

C.2 UART .................................................................................................................................................. 19

C.2.1 AndroidProducts.mk ............................................................................................................ 19

C.2.2 Init.rc configuration .............................................................................................................. 20

C.3 SPI ...................................................................................................................................................... 21

C.3.1 AndroidProducts.mk ............................................................................................................ 21

C.3.2 Init.rc configuration .............................................................................................................. 21

D Android 4.1/ 4.2 / 4.3 / 4.4 module configuration.................................................... 24

D.1 USB .................................................................................................................................................... 24

D.1.1 Ueventd.[platform].rc .................................................................................................................. 24

D.1.2 AndroidProducts.mk ............................................................................................................ 24

D.1.3 Init.rc configuration .............................................................................................................. 24

D.2 UART .................................................................................................................................................. 26

D.2.1 AndroidProducts.mk ............................................................................................................ 26

D.2.2 Init.rc configuration .............................................................................................................. 26

D.3 SPI ...................................................................................................................................................... 28

D.3.1 AndroidProducts.mk ............................................................................................................ 28

D.3.2 Init.rc configuration .............................................................................................................. 28

E AT pass through commands ...................................................................................... 30

F Compatibility matrix .................................................................................................. 40

F.1 Android software deliveries compatibility matrix ................................................................................. 40

F.2 Supported interfaces compatibility matrix ........................................................................................... 40

Related documents .......................................................................................................... 41

Revision history ................................................................................................................ 41

Contact .............................................................................................................................. 42

Page 5: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Introduction

Page 5 of 42

1 Introduction

u-blox assumes no responsibility for inappropriate use of RIL by customers.

The document applies to the following software deliveries:

o Android 2.3 (Gingerbead)

o Android 4.0 (Ice Cream Sandwich)

o Android 4.1, 4.2, 4.3 (Jelly Bean)

o Android 4.4 (KitKat)

The software has been developed using the following platforms:

o Android 2.3 (Gingerbead): BeagleBoard-XM

o Android 4.0 (Ice Cream Sandwich): BeagleBoard-XM

o Android 4.1, 4.2, 4.3 (Jelly Bean): PandaBoard

o Android 4.4 (KitKat): PandaBoard

See appendixes F.1 and F.2 for the list of Android software deliveries and interfaces supported by u-blox cellular modules.

In the following sections <name> indicates a parameter that can:

o be customized

o be set corresponding to the system configuration

o provide software version

The following sections describe the production packages delivered by u-blox.

An overview of the system setup is provided as well as the procedure to perform a log.

The following symbols are used to highlight important information within this document:

An index finger points out key information pertaining to integration and performance.

A warning symbol indicates actions that could negatively impact performance or damage the device.

Page 6: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Production delivery

Page 6 of 42

2 Production delivery

2.1 Software release

The delivery consists of the RIL library source code.

Android RIL does not offer a standard interface for powering off the module, so it is necessary to modify the Android java framework application that manages system power off and sends the AT+CPWROFF command. The AT pass through commands are explained in Appendix E.

2.2 Android 2.3 delivery contents

The RIL production delivery is provided in the RIL_sc_<version>.zip compressed file with the content

structured as follows:

RIL_sc_<version>.zip

ril_sc_<version> Source overlay for Android platform

external/ppp/ Data connection files

hardware/gsm0710muxd Channel multiplexer

hardware/ril/rapid_ril/ RIL core directory

system/core/init/property_service.c Set GPRS service property

system/core/rootdir/Android.mk Compilation script

system/core/rootdir/ueventd.rc Device permission

system/core/rootdir/etc/init.gprs-pppd Script for starting PPP service

system/core/rootdir/etc/ppp/ PPP script directory

system/core/rootdir/etc/rril-repo.sh RIL script

system/core/rootdir/etc/rril/repository.txt RIL parameters

system/core/rootdir/ueventd.rc Set device properties

2.3 Android 4.0, 4.1, 4.2, 4.3, 4.4 deliveries contents

The RIL production delivery is provided in the RIL_sc_<version>.zip compressed file with the content

structured as follows:

RIL_sc_<version>.zip

ril_sc_<version> Source overlay for Android platform

build/target/product Device configuration folder files

external/ppp/ Data connection files

hardware/gsm0710muxd Channel multiplexer

hardware/ril/ublox_ril/ RIL core directory

system/core/rootdir/Android.mk Compilation script

system/core/init/property_service.c Set RIL services property

system/core/liblog/logd_write.c Log configuration files

Page 7: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Host PC configuration

Page 7 of 42

3 Host PC configuration

This section applies to the Linux operating system.

Android software deliveries, to which this document applies, require Java 6 on Ubuntu.

Configure the host PC to build the source code. Prior to configuring the host PC, install Linux Ubuntu [2]. The delivery has been tested with Ubuntu version 10.04.

The host installation requires Android-specific dependencies that can be dynamically installed using the commands listed below:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid

partner"

sudo apt-get update

sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-

dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev

zlib1g-dev minicom tftpd uboot-mkimage expect

sudo update-java-alternatives -s java-6-sun

In addition to the host PC setup requirements for Ubuntu 10.04 or later, add

sudo apt-get install tofrodos

Verify the requirements for Android’s distribution for the platform, following tutorial, manual, etc. related to the platform’s distribution.

Page 8: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Build source code

Page 8 of 42

4 Build source code

This section applies to the Linux operating system.

Create a build directory using the following commands, where <android_root> is the directory name:

mkdir <android_root>

cd <android_root>

Download an Android distribution for the platform. Follow the tutorial, manual, etc. related to the platform’s distribution.

Android distribution must be one of the deliveries listed in section 1. Full functionality of software in other Android OS versions is not guaranteed.

Create a directory and uncompress the RIL file

The password provided from u-blox to decrypt RIL compressed file is needed.

mkdir <ril_dir>

cd <ril_dir>

cp <path_of_ril>/RIL_sc_<version>.zip .

unzip –P <ril_password> RIL_sc_<version>.zip

Copy the RIL source code in the Android distribution

o For Android 2.3 delivery

cp –pvRf ril_sc_<version>/external/ppp/ <android_root>/external/ppp

cp –pvRf ril_sc_<version>/hardware/ril/rapid_ril

<android_root>/hardware/ril/

cp –pvRf ril_sc_<version>/system/core/* <android_root>/system/core/

o For Android 4.0 / 4.1 / 4.2 / 4.3 / 4.4 delivery

cp –pvRf ril_sc_<version>/external/ppp/ <android_root>/external/ppp

cp –pvRf ril_sc_<version>/hardware/ril/ublox_ril

<android_root>/hardware/ril/

cp –pvRf ril_sc_<version>/system/* <android_root>/system

cp –pvRf ril_sc_<version>/build/* <android_root>/build

The delivery overwrites or adds some Android system files.

Page 9: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Build source code

Page 9 of 42

Modify the kernel configuration as in section A and configure script files module connection to the Android platform as described in:

o Section B for Android 2.3 (Gingerbread)

o Section C for Android 4.0 (Ice Cream Sandwich)

o Section D for Android 4.1 / 4.2 / 4.3 (Jelly Bean) and Android 4.4 (KitKat)

Add the following lines into build/target/product/core.mk to build RIL library and mux daemon:

PRODUCT_PACKAGES += librapid-ril-core \

gsm0710muxd

Build the Android system for the device or for the emulator

Use the tutorial, manual, etc. related to the platform’s distribution.

Insert a microSD card (minimum 2 GB) into the PC. Determine the SD card device name. Prompt dmesg

command on a system shell. An example of the result of this command is below

[85560.292608] sd 6:0:0:2: [sdd] Assuming drive cache: write through

[85560.292613] sd 6:0:0:2: [sdd] Attached SCSI removable dis

The device name is written in the brackets (e.g. sdd)

The next step partitions and populates the microSD card with the root filesystem, bootloader, etc

Use the command provided in the platform distribution to create an SD card for the platform

This step can clear the hard disk drive if the entered SD card device name after the script name is incorrect.

Insert the SD card into board's SD slot

Connect the board with u-blox cellular module using one of the supported interfaces

Power on both devices

Page 10: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Debug RIL

Page 10 of 42

5 Debug RIL

5.1 Host PC configuration

5.1.1 Windows configuration

On a Windows host, download and extract the Android SDK [4]

Update the Android SDK using the command:

<home>\android-sdk-windows\tools\android.bat

Download USB driver for Android [3] and extract in <home>\android-sdk-windows\usb-drivers\

Modify the section [Google.NTx86] of android_winusb.inf in <home>\android-sdk-

windows\usb-drivers\usb_driver_r03-windows with the following lines:

;

;TI EVM

%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9018

%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9018&MI_01

Run a shell and type the following command:

echo 0x18D1 > "%USERPROFILE%\.android\adb_usb.ini"

Install the downloaded USB drivers for Android OS

Connect the device to the PC

The device is now ready to start communication

5.1.2 Linux configuration

On a Linux host, download and extract Android SDK [4]

On Linux, type the following commands in a shell:

sudo su <passwd>

mkdir ~/.android

vi ~/.android/adb_usb.ini

echo "0x0451" > ~/.android/adb_usb.ini

Connect the device to the PC

The device is now ready to start communication

Page 11: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Debug RIL

Page 11 of 42

5.2 RIL log

Setup the Android Debugger (ADB) as mentioned above. By means of ADB it is possible to choose getting RIL / telephony-related log messages using the following command:

adb logcat –v time –b radio

The above command generates a log output like the following example:

12-21 11:42:22.654 D/RILD (33): RILD: rilLibPath='/system/lib/librapid-ril-core.so'

12-21 11:42:22.654 D/RILD (33): Connecting to 'qemud' socket

12-21 11:42:22.693 I/RIL-repo(51): /data/rril/repository.txt exists

12-21 11:42:23.883 I/RILR (33): Log level [2]

12-21 11:42:23.883 I/RILR (33): CSystemManager::CSystemManager() - Enter

12-21 11:42:23.883 I/RILR (33): CSystemManager::CSystemManager() - Exit

12-21 11:42:23.883 I/RILR (33): CSystemManager::InitializeSystem() - Enter

12-21 11:42:24.002 I/RILR (33): CSystemManager::InitializeSystem() - Retrieved Last CLIP Value: 0x0

12-21 11:42:24.114 I/RILR (33): CSystemManager::InitializeSystem() - Retrieved Last CLIR Value: 0x0

12-21 11:42:24.243 I/RILR (33): CSystemManager::InitializeSystem() - Retrieved Last COLP Value: 0x0

12-21 11:42:24.342 I/RILR (33): CSystemManager::InitializeSystem() - Retrieved Last COLR Value: 0x0

12-21 11:42:24.683 I/RILR (33): RIL_Init,init not finish:0

12-21 11:42:25.533 I/RILR ( 33): CChannelBase::OpenPort() - Opening COM

Port=[/dev/socket/qemud] g_bIsSocket=[1]

12-21 11:42:25.533 I/RILR (33): CPort::OpenSocket('/dev/socket/qemud', 'gsm')

12-21 11:42:25.533 I/RILR (33): CFile::Open() - Enter

12-21 11:42:25.533 I/RILR (33): CFile::Open() : pszFileName=[/dev/socket/qemud]

12-21 11:42:25.533 I/RILR (33): CFile::Open() : fIsSocket=[1]

12-21 11:42:25.533 I/RILR (33): CFile::Open() - Exit m_fInitialized=[1]

12-21 11:42:25.533 I/RILR (33): CPort::OpenSocket() - Port is open!!

12-21 11:42:25.533 I/RILR (33): CPort['/dev/socket/qemud'] << 'gsm'

12-21 11:42:25.684 I/RILR (33): RIL_Init,init not finish:0

It is possible to provide the general Android log messages using the following command:

adb logcat –v time

The above command generates a log output like the following example:

12-21 11:42:22.453 I/DEBUG ( 31): debuggerd: Dec 2 2011 16:20:35

12-21 11:42:22.503 D/qemud ( 39): entering main loop

12-21 11:42:22.513 I/Netd ( 30): Netd 1.0 starting

12-21 11:42:22.564 I/Vold ( 29): Vold 2.1 (the revenge) firing up

12-21 11:42:22.564 D/Vold ( 29): USB mass storage support is not enabled in the kernel

12-21 11:42:22.564 D/Vold ( 29): usb_configuration switch is not enabled in the kernel

12-21 11:42:22.564 D/Vold ( 29): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)

12-21 11:42:22.854 D/qemud ( 39): fdhandler_accept_event: accepting on fd 9

12-21 11:42:22.854 D/qemud ( 39): created client 0xe078 listening on fd 10

12-21 11:42:22.854 D/qemud ( 39): client_fd_receive: attempting registration for service 'boot-

properties'

Page 12: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 12 of 42

Appendix

A Kernel configuration Configure the kernel to support the u-blox cellular module and the connection to the applicable interface.

A.1 USB kernel configuration Enable the kernel configuration as follows:

Device Drivers

USB Support

<*>USB Modem (CDC ACM) support

A.2 UART kernel configuration This device is enabled to default kernel configuration.

A.3 SPI kernel configuration Enable the kernel configuration as follows:

Device Drivers

SPI Support

<*>Debug support for SPI driver

<*>GPIO-based bitbanging SPI Master

<*>McSPI driver for OMAP24xx/OMAP34xx

Implement the dedicated SPI protocol (see the SPI interface Application note [1]) on the SPI kernel driver to properly work with the cellular modules supporting SPI interface.

A.4 RNDIS / ECM kernel configuration Enable the kernel configuration as follows:

Device Drivers

Network device support

USB Network Adapters

<*>Multi-purpose USB Networking Framework

<*>CDC Ethernet support

<*>Host for RNDIS and ActiveSync devices

This configuration is required only for TOBY-L2 configured with 1 CDC-ACM port and 1 RNDIS (factory-programmed configuration) or 1 ECM (AT+UUSBCONF=2).

Page 13: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 13 of 42

A.5 PPP kernel configuration Enable the kernel configuration as follows:

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

Check if the “chat” package is included on the build. If not, add it using the following line in one of the .mk files included in the build.

PRODUCT_PACKAGES += chat

B Android 2.3 module configuration Configure the kernel to support the u-blox cellular module and the connection to the applicable interface.

B.1 USB To enable the USB module connection, configure BoardConfig.mk and init.rc files as follows.

B.1.1 BoardConfig.mk configuration

Add to BoardConfig.mk file the following lines to build RIL library for USB connection:

# u-blox RIL communication interface

RIL_COM_INTERFACE := usb

B.1.2 Init.rc configuration

Add to the init.rc file the following lines:

# Change permissions for modem

chmod 0660 /dev/ttyACM0

chown radio radio /dev/ttyACM0

chmod 0660 /dev/ttyACM1

chown radio radio /dev/ttyACM1

chmod 0660 /dev/ttyACM2

chown radio radio /dev/ttyACM2

# Set permissions for u-blox RIL Repository

Page 14: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 14 of 42

chown radio radio /system/etc/rril

chmod 0770 /system/etc/rril

chown radio radio /system/etc/rril/repository.txt

chmod 0660 /system/etc/rril/repository.txt

# Set u-blox RIL repository state

setprop net.rril.repository notready

# Prepare u-blox RIL repository

service rril-repo /system/bin/rril-repo.sh

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/ttyACM0 -n /dev/ttyACM1

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio

service pppd_gprs /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_term /system/bin/stop_pppd 15

disabled

oneshot

service pppd_kill /system/bin/stop_pppd 9

disabled

oneshot

B.2 UART To enable the UART module connection, configure BoardConfig.mk and init.rc files as follows.

B.2.1 BoardConfig.mk configuration

To build the RIL library for a UART connection, add the following lines to the BoardConfig.mk file:

# u-blox RIL communication interface

RIL_COM_INTERFACE := uart

Page 15: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 15 of 42

B.2.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/<serial_port>

chown radio radio /dev/<serial_port>

# Set permissions for RIL repository

chown radio radio /system/etc/rril

chmod 0770 /system/etc/rril

chown radio radio /system/etc/rril/repository.txt

chmod 0660 /system/etc/rril/repository.txt

# Set RIL repository state

setprop net.rril.repository notready

# Multiplexing device

service gsmmuxd /system/bin/logwrapper /system/bin/gsm0710muxd –s

/dev/<serial_port> –n3 -v7 -mbasic

user radio

group radio cache inet misc

oneshot

# Use this service for stopping gsmmuxd

service mux_stop /system/bin/stop_muxd 15

disabled

oneshot

# Prepare u-blox RIL repository

service rril-repo /system/bin/rril-repo.sh

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/pts/0 -n /dev/pts/1

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio

service pppd_gprs /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

Page 16: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 16 of 42

disabled

oneshot

# use these services for stopping pppd

#

# terminate pppd with SIGTERM

service pppd_term /system/bin/stop_pppd 15

disabled

oneshot

# forcefully kill pppd with SIGKILL

service pppd_kill /system/bin/stop_pppd 9

disabled

oneshot

B.3 SPI To enable the SPI module connection, configure BoardConfig.mk and init.rc files as follows.

B.3.1 BoardConfig.mk configuration

To build RIL library for SPI connection add the following lines to the Boardconfig.mk file:

# u-blox RIL communication interface

RIL_COM_INTERFACE := spi

B.3.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/<spi_port>

chown radio radio /dev/<spi_port>

# Set permissions for u-blox RIL repository

chown radio radio /system/etc/rril

chmod 0770 /system/etc/rril

chown radio radio /system/etc/rril/repository.txt

chmod 0660 /system/etc/rril/repository.txt

# Set u-blox RIL repository state

setprop net.rril.repository notready

# Multiplexing device

Page 17: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 17 of 42

service gsmmuxd /system/bin/logwrapper /system/bin/gsm0710muxd -

s/dev/<spi_port> –n3 -v7 -mbasic

user radio

group radio cache inet misc

oneshot

# Use this service for stopping gsmmuxd

service mux_stop /system/bin/stop_muxd 15

class main

disabled

oneshot

# Prepare u-blox RIL repository

service rril-repo /system/bin/rril-repo.sh

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/pts/0 -n /dev/pts/1

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio

service pppd_gprs /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

# use these services for stopping pppd

#

# terminate pppd with SIGTERM

service pppd_term /system/bin/stop_pppd 15

disabled

oneshot

# forcefully kill pppd with SIGKILL

service pppd_kill /system/bin/stop_pppd 9

disabled

oneshot

Page 18: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 18 of 42

C Android 4.0 module configuration

C.1 USB To enable the USB module connection, configure AndroidProducts.mk and init.rc files as follows.

C.1.1 AndroidProducts.mk

Add to the AndroidProduct.mk file the following lines for the specific device contained in the device

configuration folder (e.g. /device/ti/beagleboard):

# u-blox RIL communication interface

RIL_COM_INTERFACE := usb

C.1.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/ttyACM0

chown radio radio /dev/ttyACM0

chmod 0660 /dev/ttyACM1

chown radio radio /dev/ttyACM1

chmod 0660 /dev/ttyACM2

chown radio radio /dev/ttyACM2

# Set permissions for u-blox RIL Repository

chown radio radio /system/etc/rril

chmod 0770 /system/etc/rril

chown radio radio /system/etc/rril/repository.txt

chmod 0660 /system/etc/rril/repository.txt

# Set u-blox RIL repository state

setprop net.rril.repository notready

# Prepare u-blox RIL repository

service rril-repo /system/bin/rril-repo.sh

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/ttyACM0 -n /dev/ttyACM1

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

Page 19: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 19 of 42

group radio cache inet misc audio

service pppd_data0 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_data1 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_term /system/bin/stop_pppd 15

class main

disabled

oneshot

service pppd_kill /system/bin/stop_pppd 9

class main

disabled

oneshot

C.2 UART To enable the UART connection, configure AndroidProducts.mk and init.rc files as follows.

C.2.1 AndroidProducts.mk

Insert the following lines into the AndroidProduct.mk file contained in the device configuration folder (e.g.

/device/ti/beagleboard).

# u-blox RIL communication interface

RIL_COM_INTERFACE := uart

Page 20: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 20 of 42

C.2.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/<serial_port>

chown radio radio /dev/<serial_port>

# Set permissions for u-blox RIL repository

chown radio radio /system/etc/rril

chmod 0770 /system/etc/rril

chown radio radio /system/etc/rril/repository.txt

chmod 0660 /system/etc/rril/repository.txt

# Set u-blox RIL repository state

setprop net.rril.repository notready

# Multiplexing device

service gsmmuxd /system/bin/logwrapper /system/bin/gsm0710muxd –s

/dev/<serial_port> –n3 -v7 –mbasic

class main

user radio

group radio cache inet misc

oneshot

# Use this service for stopping gsmmuxd

service mux_stop /system/bin/stop_muxd 15

class main

disabled

oneshot

# Prepare u-blox RIL repository

service rril-repo /system/bin/rril-repo.sh

class main

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/pts/0 -n /dev/pts/1

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

Page 21: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 21 of 42

group radio cache inet misc audio

service pppd_data0 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_data1 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

# use these services for stopping pppd

#

# terminate pppd with SIGTERM

service pppd_term /system/bin/stop_pppd 15

disabled

oneshot

# forcefully kill pppd with SIGKILL

service pppd_kill /system/bin/stop_pppd 9

disabled

oneshot

C.3 SPI To enable the SPI connection, configure AndroidProducts.mk and init.rc files as follows.

C.3.1 AndroidProducts.mk

Insert the following lines into the AndroidProduct.mk file contained in the device configuration folder (e.g.

/device/ti/beagleboard).

# u-blox RIL communication interface

RIL_COM_INTERFACE := spi

C.3.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/<spi_port>

chown radio radio /dev/<spi_port>

# Set permissions for u-blox RIL repository

chown radio radio /system/etc/rril

chmod 0770 /system/etc/rril

Page 22: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 22 of 42

chown radio radio /system/etc/rril/repository.txt

chmod 0660 /system/etc/rril/repository.txt

# Set u-blox RIL repository state

setprop net.rril.repository notready

# Multiplexing device

service gsmmuxd /system/bin/logwrapper /system/bin/gsm0710muxd -

s/dev/<spi_port> –n3 -v7 -mbasic

user radio

group radio cache inet misc

oneshot

# Use this service for stopping gsmmuxd

service mux_stop /system/bin/stop_muxd 15

class main

disabled

oneshot

# Prepare u-blox RIL repository

service rril-repo /system/bin/rril-repo.sh

class main

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/pts/0 -n /dev/pts/1

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio

service pppd_data0 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_data1 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

Page 23: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 23 of 42

oneshot

# use these services for stopping pppd

#

# terminate pppd with SIGTERM

service pppd_term /system/bin/stop_pppd 15

class main

disabled

oneshot

# forcefully kill pppd with SIGKILL

service pppd_kill /system/bin/stop_pppd 9

class main

disabled

oneshot

Page 24: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 24 of 42

D Android 4.1/ 4.2 / 4.3 / 4.4 module configuration

D.1 USB To enable the USB module connection, configure AndroidProducts.mk and init.rc files as follows.

Android 4.4 (KitKat) for TOBY-L2 series is available in the following configuration:

Configuration Command setting Remarks

6 CDC-ACM ports AT+UUSBCONF=0 and AT+CFUN=16 The data connection uses PPP process

1 CDC-ACM port and 1 RNDIS port AT+UUSBCONF=3 and AT+CFUN=16 This is the factory-programmed configuration.

The data connection uses RNDIS port (network

usb<X>)

1 CDC-ACM port and 1 ECM port AT+UUSBCONF=2 and AT+CFUN=16 The data connection uses ECM port (network eth<X>).

Table 1: Android 4.4 configuration on TOBY-L2 series

The commands must be issued before connecting to the Android device

TOBY-L2 module device name, enumerated by the kernel using the name ethX or usbX, must be set in init.rc file. The system properties net.data.dev must be set according to it, see the

init.rc example below as reference.

D.1.1 Ueventd.[platform].rc

Add to the ueventd.[platform].rc, where “platform” labels depends on the BSP, the following permissions:

/dev/ttyACM0 0660 radio radio

/dev/ttyACM1 0660 radio radio

/dev/ttyACM2 0660 radio radio

D.1.2 AndroidProducts.mk

Add to the AndroidProduct.mk file the following lines for specific device contained into device configuration

folder (e.g. /device/ti/panda):

# u-blox RIL communication interface

RIL_COM_INTERFACE := usb

D.1.3 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/ttyACM0

chown radio radio /dev/ttyACM0

chmod 0660 /dev/ttyACM1

Page 25: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 25 of 42

chown radio radio /dev/ttyACM1

chmod 0660 /dev/ttyACM2

chown radio radio /dev/ttyACM2

# Set permissions for u-blox RIL Repository

chown radio radio /system/etc/uril

chmod 0770 /system/etc/uril

chown radio radio /system/etc/uril/repository.txt

chmod 0660 /system/etc/uril/repository.txt

# Set u-blox RIL repository state

setprop net.uril.repository notready

# set network data device (specific for TOBY-L2 with RNDIS)

# setprop net.data.dev usb<x>

# set network data device (specific for TOBY-L2 with ECM)

# setprop net.data.dev eth<x>

# Prepare u-blox RIL repository

service uril-repo /system/bin/uril-repo.sh

class main

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/ttyACM0 -n /dev/ttyACM1

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio sdcard_r sdcard_rw log

#Services for ppp data connection management

service pppd_data0 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_data1 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

Page 26: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 26 of 42

oneshot

service pppd_term /system/bin/stop_pppd 15

class main

disabled

oneshot

service pppd_kill /system/bin/stop_pppd 9

class main

disabled

oneshot

#Service to start data connection for TOBY-L2

service netd_ena /system/bin/init_data

class main

disabled

oneshot

#Service to stop data connection for TOBY-L2

service netd_dis /system/bin/stop_data

class main

disabled

oneshot

D.2 UART To enable the UART connection, configure AndroidProducts.mk and init.rc files as follows.

D.2.1 AndroidProducts.mk

Insert the following lines into the AndroidProduct.mk file contained in the device configuration folder (e.g.

/device/ti/panda).

# u-blox RIL communication interface

RIL_COM_INTERFACE := uart

D.2.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/<serial_port>

chown radio radio /dev/<serial_port>

# Set permissions for u-blox RIL repository

chown radio radio /system/etc/uril

chmod 0770 /system/etc/uril

Page 27: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 27 of 42

chown radio radio /system/etc/uril/repository.txt

chmod 0660 /system/etc/uril/repository.txt

# Set u-blox RIL repository state

setprop net.uril.repository notready

# Multiplexing device

service gsmmuxd /system/bin/logwrapper /system/bin/gsm0710muxd –s

/dev/<serial_port> –n3 -v7 –mbasic

class main

user radio

group radio cache inet misc

oneshot

# Use this service for stopping gsmmuxd

service mux_stop /system/bin/stop_muxd 15

class main

disabled

oneshot

# Prepare u-blox RIL repository

service uril-repo /system/bin/uril-repo.sh

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/pts/0 -n /dev/pts/1

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio sdcard_r sdcard_rw log

service pppd_data0 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_data1 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

Page 28: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 28 of 42

# use these services for stopping pppd

#

# terminate pppd with SIGTERM

service pppd_term /system/bin/stop_pppd 15

disabled

oneshot

# forcefully kill pppd with SIGKILL

service pppd_kill /system/bin/stop_pppd 9

disabled

oneshot

D.3 SPI To enable the SPI connection, configure AndroidProducts.mk and init.rc files as follows.

D.3.1 AndroidProducts.mk

Insert the following lines into AndroidProduct.mk file contained in the device configuration folder (e.g.

/device/ti/panda).

# u-blox RIL communication interface

RIL_COM_INTERFACE := spi

D.3.2 Init.rc configuration

Add the following lines to the init.rc file:

# Change permissions for modem

chmod 0660 /dev/<spi_port>

chown radio radio /dev/<spi_port>

# Set permissions for u-blox RIL repository

chown radio radio /system/etc/uril

chmod 0770 /system/etc/uril

chown radio radio /system/etc/uril/repository.txt

chmod 0660 /system/etc/uril/repository.txt

# Set u-blox RIL repository state

setprop net.uril.repository notready

# Multiplexing device

service gsmmuxd /system/bin/logwrapper /system/bin/gsm0710muxd -

s/dev/<spi_port> –n3 -v7 -mbasic

user radio

group radio cache inet misc

oneshot

Page 29: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 29 of 42

# Use this service for stopping gsmmuxd

service mux_stop /system/bin/stop_muxd 15

class main

disabled

oneshot

# Prepare u-blox RIL repository

service uril-repo /system/bin/uril-repo.sh

user root

group radio

oneshot

# Load u-blox RIL

service ril-daemon /system/bin/rild -l /system/lib/librapid-ril-core.so --

-a /dev/pts/0 -n /dev/pts/1

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio sdcard_r sdcard_rw log

service pppd_data0 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

service pppd_data1 /system/bin/init.gprs-pppd

user root radio

group radio cache inet misc

disabled

oneshot

# use these services for stopping pppd

#

# terminate pppd with SIGTERM

service pppd_term /system/bin/stop_pppd 15

class main

disabled

oneshot

# forcefully kill pppd with SIGKILL

service pppd_kill /system/bin/stop_pppd 9

class main

disabled

oneshot

Page 30: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 30 of 42

E AT pass through commands The Android operating system does not allow sending commands to the module without using the RIL software layer, so two requests provided by RIL’s API must be used:

RIL_REQUEST_OEM_HOOK_RAW: it passes raw byte arrays back and forth

RIL_REQUEST_OEM_HOOK_STRINGS: It passes strings back and forth

The following is sample code that could be used to send commands directly to the module:

Add following lines in the bottom of packages/apps/settings/AndroidManifest.xml before

</application> field.

<activity android:name="RilOemHookTest"

android:label="@string/testing_RIL_OEMHook"

android:process="com.android.phone">

<intent-filter>

<action android:name="android.intent.action.MAIN" />

<category

android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />

</intent-filter>

</activity>

Add the following lines in the bottom of packages/apps/Settings/res/values/strings.xml file

before </resources> field.

<!-- For RIL OEM HOOK testing -->

<string name="testing_RIL_OEMHook">RIL OEM Hook Test</string>

<string name="ril_oem_choose">Choose a RIL OEM Hook API to

test:</string>

<string name="radio_api1">API 1 (datalen=0)</string>

<string name="radio_api2">API 2 (datalen=1)</string>

<string name="radio_api3">API 3 (datalen=6)</string>

<string name="radio_api4">API 4 Type command :</string>

<string name="radio_run">RUN</string>

<string name="ril_oem_response">Module response:</string>

Add the following lines in the bottom of

packages/apps/Settings/ers/xml/testing_settings.xml file before

</PreferenceScreen> field

<PreferenceScreen

android:title="@string/testing_RIL_OEMHook" >

<intent

android:action="android.intent.action.MAIN"

android:targetPackage="com.android.settings"

android:targetClass="com.android.settings.RilOemHookTest" />

Page 31: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 31 of 42

</PreferenceScreen>

Create a file package/apps/settings/com/android/settings/RilOemHookTest.java and

paste the following code:

package com.android.settings;

import android.app.Activity;

import android.os.Bundle;

import android.view.View;

import android.widget.EditText;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.Toast;

import com.android.internal.telephony.Phone;

import com.android.internal.telephony.PhoneFactory;

import android.view.View.OnKeyListener;

import android.view.KeyEvent;

import android.os.Message;

import android.os.Handler;

import android.os.AsyncResult;

import android.util.Log;

import android.app.AlertDialog;

public class RilOemHookTest extends Activity

{

private static final String LOG_TAG = "RILOemHookTestApp";

private RadioButton mRadioButtonAPI1 = null;

private RadioGroup mRadioGroupAPI = null;

private Phone mPhone = null;

private EditText CmdRespText = null;

private static final int EVENT_RIL_OEM_HOOK_CMDRAW_COMPLETE = 1300;

private static final int EVENT_RIL_OEM_HOOK_CMDSTR_COMPLETE = 1400;

private static final int EVENT_UNSOL_RIL_OEM_HOOK_RAW = 500;

private static final int EVENT_UNSOL_RIL_OEM_HOOK_STR = 600;

@Override

public void onCreate(Bundle icicle)

{

super.onCreate(icicle);

setContentView(R.layout.riloemhook_layout);

mRadioButtonAPI1 = (RadioButton) findViewById(R.id.radio_api1);

mRadioGroupAPI = (RadioGroup) findViewById(R.id.radio_group_api);

// Initially turn on first button.

mRadioButtonAPI1.toggle();

Page 32: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 32 of 42

// Get our main phone object.

mPhone = PhoneFactory.getDefaultPhone();

// Register for OEM raw notification.

//mPhone.mCM.setOnUnsolOemHookRaw(mHandler,

EVENT_UNSOL_RIL_OEM_HOOK_RAW, null);

// Capture text edit key press

CmdRespText = (EditText) findViewById(R.id.edit_cmdstr);

CmdRespText.setOnKeyListener(new OnKeyListener() {

public boolean onKey(View v, int keyCode, KeyEvent event) {

// If the event is a key-down event on the "enter" button

if ((event.getAction() == KeyEvent.ACTION_DOWN) &&

(keyCode == KeyEvent.KEYCODE_ENTER)) {

// Perform action on key press

Toast.makeText(RilOemHookTest.this,

CmdRespText.getText(), Toast.LENGTH_SHORT).show();

return true;

}

return false;

}

});

}

@Override

public void onPause()

{

super.onPause();

log("onPause()");

// Unregister for OEM raw notification.

//mPhone.mCM.unSetOnUnsolOemHookRaw(mHandler);

}

@Override

public void onResume()

{

super.onResume();

log("onResume()");

// Register for OEM raw notification.

//mPhone.mCM.setOnUnsolOemHookRaw(mHandler,

EVENT_UNSOL_RIL_OEM_HOOK_RAW, null);

}

public void onRun(View view)

{

// Get the checked button

Page 33: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 33 of 42

int idButtonChecked = mRadioGroupAPI.getCheckedRadioButtonId();

// Get the response field

CmdRespText = (EditText) findViewById(R.id.edit_response);

byte[] oemhook = null;

switch(idButtonChecked)

{

case R.id.radio_api1:

oemhook = new byte[1];

oemhook[0] = (byte)0xAA;

break;

case R.id.radio_api2:

oemhook = new byte[2];

oemhook[0] = (byte)0xBB;

oemhook[1] = (byte)0x55;

break;

case R.id.radio_api3:

// Send OEM notification (just echo the data bytes)

oemhook = new byte[7];

oemhook[0] = (byte)0xCC;

oemhook[1] = (byte)0x12;

oemhook[2] = (byte)0x34;

oemhook[3] = (byte)0x56;

oemhook[4] = (byte)0x78;

oemhook[5] = (byte)0x9A;

oemhook[6] = (byte)0xBC;

break;

case R.id.radio_api4:

// Send OEM command string

break;

default:

log("unknown button selected");

break;

}

if (idButtonChecked!=R.id.radio_api4)

{

Message msg =

mHandler.obtainMessage(EVENT_RIL_OEM_HOOK_CMDRAW_COMPLETE);

mPhone.invokeOemRilRequestRaw(oemhook, msg);

CmdRespText.setText("");

}

else

{

//Copy string from EditText and add carriage return

String[] oemhookstring = { ((EditText)

findViewById(R.id.edit_cmdstr)).getText().toString()+'\r' } ;

Page 34: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 34 of 42

//Create message

Message msg =

mHandler.obtainMessage(EVENT_RIL_OEM_HOOK_CMDSTR_COMPLETE);

//Send request

mPhone.invokeOemRilRequestStrings(oemhookstring, msg);

CmdRespText = (EditText) findViewById(R.id.edit_response);

CmdRespText.setText("---Wait response---");

}

}

private void logRilOemHookResponse(AsyncResult ar)

{

log("received oem hook response");

String str = new String("");

if (ar.exception != null)

{

log("Exception:" + ar.exception);

str += "Exception:" + ar.exception + "\n\n";

}

if (ar.result != null)

{

byte[] oemResponse = (byte[])ar.result;

int size = oemResponse.length;

log("oemResponse length=[" + Integer.toString(size) + "]");

str += "oemResponse length=[" + Integer.toString(size) + "]" +

"\n";

if (size > 0)

{

for (int i=0; i<size; i++)

{

byte myByte = oemResponse[i];

int myInt = (int)(myByte & 0xFF);

log("oemResponse[" + Integer.toString(i) + "]=[0x" +

Integer.toString(myInt,16) + "]");

str += "oemResponse[" + Integer.toString(i) + "]=[0x" +

Integer.toString(myInt,16) + "]" + "\n";

}

}

}

Page 35: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 35 of 42

else

{

log("received NULL oem hook response");

str += "received NULL oem hook response";

}

// Display message box

AlertDialog.Builder builder = new AlertDialog.Builder(this);

builder.setMessage(str);

builder.setPositiveButton("OK", null);

AlertDialog alert = builder.create();

alert.show();

}

private void logRilOemHookResponseString(AsyncResult ar)

{

log("received oem hook string response");

String str = new String("");

CmdRespText = (EditText) findViewById(R.id.edit_response);

if (ar.exception != null)

{

log("Exception:" + ar.exception);

str += "Exception:" + ar.exception + "\n\n";

}

if (ar.result != null)

{

String[] oemStrResponse = (String[])ar.result;

int sizeStr = oemStrResponse.length;

log("oemResponseString[0] [" + oemStrResponse[0] + "]");

CmdRespText.setText( "" + oemStrResponse[0] );

}

else

{

log("received NULL oem hook response");

CmdRespText.setText( "No response or error received" );

}

}

private void log(String msg)

{

Log.d(LOG_TAG, "[RIL_HOOK_OEM_TESTAPP] " + msg);

}

private Handler mHandler = new Handler()

{

Page 36: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 36 of 42

public void handleMessage(Message msg)

{

AsyncResult ar;

switch (msg.what)

{

case EVENT_RIL_OEM_HOOK_CMDRAW_COMPLETE:

log("EVENT_RIL_OEM_HOOK_CMDRAW_COMPLETE");

ar = (AsyncResult) msg.obj;

logRilOemHookResponse(ar);

break;

case EVENT_RIL_OEM_HOOK_CMDSTR_COMPLETE:

log("EVENT_RIL_OEM_HOOK_CMDSTR_COMPLETE");

ar = (AsyncResult) msg.obj;

logRilOemHookResponseString(ar);

break;

case EVENT_UNSOL_RIL_OEM_HOOK_RAW:

break;

case EVENT_UNSOL_RIL_OEM_HOOK_STR:

break;

}

}

};

}

Create a file packages/apps/settings/res/layout/riloemhook_layout.xml and copy and

paste the following code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

<TextView android:id="@+id/mylabel"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="@string/ril_oem_choose"

/>

<RadioGroup android:id="@+id/radio_group_api"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/mylabel"

android:orientation="vertical">

Page 37: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 37 of 42

<RadioButton android:id="@+id/radio_api1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/radio_api1"

/>

<RadioButton android:id="@+id/radio_api2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/radio_api2"

/>

<RadioButton android:id="@+id/radio_api3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/radio_api3"

/>

<RadioButton android:id="@+id/radio_api4"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/radio_api4"

/>

</RadioGroup>

<EditText

android:id="@+id/edit_cmdstr"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/radio_group_api"

android:layout_marginRight="20dip"

android:minWidth="200dip"

android:textColor="#000000"

android:background="@android:drawable/editbox_background"

/>

<Button android:id="@+id/run"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/edit_cmdstr"

android:text="@string/radio_run"

android:clickable="true"

android:onClick="onRun"

/>

<TextView android:id="@+id/label_response"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

Page 38: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 38 of 42

android:layout_below="@+id/run"

android:text="@string/ril_oem_response"

/>

<EditText

android:id="@+id/edit_response"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@+id/label_response"

android:minWidth="200dip"

android:minHeight="50dip"

android:layout_marginLeft="20dip"

android:layout_marginRight="20dip"

android:textSize="12px"

android:textColor="#FFFFFF"

android:background="#000000"

android:editable="false"

/>

</RelativeLayout>

It is possible to start this application from an Android shell using the following command:

am start -a android.intent.action.MAIN -n

com.android.settings/com.android.settings.TestingSettings

A screen such as Figure 1 is displayed.

Figure 1: Testing menu settings

Page 39: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 39 of 42

Click on “RIL OEM Hook Test” menu. A screen such as Figure 2 is displayed.

Figure 2: RIL OEM Hook application

The first three APIs send bytes to the RIL layer to execute a set of commands.

The fourth API sends the command string to the module. Type the command into white field and click the “RUN” button to execute the command. The module response is displayed in the bottom field.

RIL uses the numeric error value (AT+CMEE=1) as error result codes format. A change in the error report setting causes unexpected errors in the RIL behavior.

Page 40: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Appendix

Page 40 of 42

F Compatibility matrix

F.1 Android software deliveries compatibility matrix

Cellular

module

Android software deliveries

2.3 (Gingerbread) 4.0 (Ice Cream Sandwich) 4.1 / 4.2 / 4.3 (Jelly Bean) 4.4 (KitKat)

LEON-G series Supported Not supported Supported Supported

SARA-G340 series Supported Not supported Supported Supported

SARA-G350 series Supported Not supported Supported Supported

LISA-U series Supported Supported Supported Supported

SARA-U series Supported Supported Supported Supported

TOBY-L2 series Not supported Not supported Not supported Supported

Table 2: Android software deliveries compatibility matrix

F.2 Supported interfaces compatibility matrix

Cellular module SPI UART USB

LEON-G series Not available Supported Not available

SARA-G340 series Not available Supported Not available

SARA-G350 series Not available Supported Not available

LISA-U series Supported Supported Supported

SARA-U series Not supported Supported Supported

TOBY-L2 series Not available Not available Supported1

Table 3: Supported interfaces compatibility matrix

1 See Table 1 for the available configurations on TOBY-L2 series:

Page 41: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Related documents

Page 41 of 42

Related documents [1] SPI Interface Application Note, Docu No UBX-13001919

[2] Ubuntu download: http://www.ubuntu.com/desktop/get-ubuntu/download

[3] USB driver for Android: https://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip

[4] Android SDK: http://developer.android.com/sdk/index.html

[1] is available on http://www.u-blox.com

For regular updates to u-blox documentation and to receive product change notifications, register on our homepage.

Revision history

Revision Date Name Status / Comments

- 11-Jul-2011 fpic Initial release

1 05-Sep-2011 fpic Document aligned to RIL Delivery 01.02

2 23-Sep-2011 lpah Added chapter Appendix 1: Module connection

3 26-Jan-2012 lpah Extended to include LISA-U2 series

4 26-Mar-2012 fpic Extended to include Android 4.0 delivery

5 21-Jun-2012 fpic Extended to include LEON-G100 and LEON-G200 series

Added compatibility matrix for Android software deliveries and supported

interface by u-blox wireless modules

6 20-Nov-2012 fpic / lpah Android 4.1 supported

(Last revision with docu number 3G.G2-CS-11003)

A 30-Aug-2012 fpic Extended to include SARA-G350 series

Insert minor changes and support for 2G modules into Android 4.1

R08 08-Apr-2014 fpic Android 4.2 and 4.3 supported

Added note on power off handling

R09 31-Jul-2014 fpic Android 4.4 supported

Extended the document applicability to SARA-U2 and TOBY-L2 series

R10 24-Oct-2014 fpic Included modification for latest TOBY-L2 delivery

Page 42: Android RIL Source Code - evk-download.u-blox.com · Android RIL Production delivery – Source code Application Note Abstract This document describes how to build and use the RIL

Android RIL - Application Note

UBX-13002041 - R10 Advance Information Contact

Page 42 of 42

Contact For complete contact information visit us at www.u-blox.com

u-blox Offices

North, Central and South America

u-blox America, Inc.

Phone: +1 703 483 3180 E-mail: [email protected]

Regional Office West Coast:

Phone: +1 408 573 3640 E-mail: [email protected]

Technical Support:

Phone: +1 703 483 3185 E-mail: [email protected]

Headquarters

Europe, Middle East, Africa

u-blox AG

Phone: +41 44 722 74 44 E-mail: [email protected] Support: [email protected]

Asia, Australia, Pacific

u-blox Singapore Pte. Ltd.

Phone: +65 6734 3811 E-mail: [email protected] Support: [email protected]

Regional Office Australia:

Phone: +61 2 8448 2016 E-mail: [email protected] Support: [email protected]

Regional Office China (Beijing):

Phone: +86 10 68 133 545 E-mail: [email protected] Support: [email protected]

Regional Office China (Shenzhen):

Phone: +86 755 8627 1083 E-mail: [email protected] Support: [email protected]

Regional Office India:

Phone: +91 959 1302 450 E-mail: [email protected] Support: [email protected]

Regional Office Japan:

Phone: +81 3 5775 3850 E-mail: [email protected] Support: [email protected]

Regional Office Korea:

Phone: +82 2 542 0861 E-mail: [email protected] Support: [email protected]

Regional Office Taiwan:

Phone: +886 2 2657 1090 E-mail: [email protected] Support: [email protected]