Difference between revisions of "Android"

From sigrok
Jump to navigation Jump to search
Line 31: Line 31:
== Building from source ==
== Building from source ==


=== Current status ===
You can also build various sigrok components from source. The nightly APK (see above) is built using the [http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/android/sigrok-cross-android sigrok-cross-android] script from our [http://sigrok.org/gitweb/?p=sigrok-util.git;a=tree;f=cross-compile/android sigrok-util repository]. You can use that script to build your own APK locally (and/or modify it if you want).


You can start the sigrok application on your android phone using a terminal (ex: adb). You don't need root access.
$ '''git clone git://sigrok.org/sigrok-util'''
$ '''cd sigrok-util/cross-compile/android'''


It's strongly suggested to use at least android 4.0.3.
The following invocation will install the required Android NDK, SDK, and toolchains into '''$HOME/android''' (per default). Please check the [http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/android/README README] and modify the [http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/android/sigrok-cross-android sigrok-cross-android] script to your needs.


You cannot integrate sigrok in a android application yet. (WIP)
$ '''./sigrok-cross-android prepare'''


You don't have a nice UI. (WIP)
Then, in order to build the APK, you can run:


=== Binary ===
  $ '''./sigrok-cross-android'''
 
You can download a pre-compiled test version on [https://www.dropbox.com/sh/ndnwwct2ahl58cr/Awmm2vrTkX]
 
You are welcome to give feedback to martling on the IRC channel or gabriel.klein@nuage.ch.
 
=== Issues ===
 
* I need to "ln libftdi.so libftdi.so.1". It's an issue as you need to be root to do that. You cannot have libs that don't follow the libXXX.so pattern.
 
* I need to be root to be able to open the USB port. Solution: Find a way to "hack" or rebuild the libs to be able to inject the USB fs from the java/android layer.
 
* I need to store the firmware somewhere.
 
 
=== Initial setup ===
 
First build the Linux version. You need some extra libraries that are not described here.
 
http://sigrok.org/wiki/Linux
 
You may need to install additional packages: libtool, glibmm-2.4-dev...
 
 
Download the latest [http://developer.android.com/tools/sdk/ndk/index.html Android NDK] and extract it, e.g. in '''$HOME/android'''.
 
$ '''cd $HOME'''
$ '''mkdir android'''
  $ '''cd android'''
$ '''wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2'''
$ '''or wget http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2''' (If you have a 64 bits version of Linux)
$ '''tar xfvj android-ndk-r9d-linux-x86.tar.bz2'''
$ '''cd android-ndk-r9d'''
 
Now, create a toolchain installation that can be used for cross-compiling for Android (adapt '''--platform''' and '''--arch''' as needed):
 
$ '''./build/tools/make-standalone-toolchain.sh --platform=''android-15'' --install-dir=$HOME/android/android-arm-toolchain --arch=''arm'''''
 
You now have a working toolchain and build environment in '''$HOME/android/android-arm-toolchain'''.
 
=== Cross-compiling ===


$ '''git clone git://sigrok.org/sigrok-util'''
The file '''build/pulseview/android/bin/PulseView-debug.apk''' is the APK that you can install on your Android device.
$ '''cd sigrok-util/cross-compile/android'''
$ '''./sigrok-cross-android'''


Please check the '''README''' and edit the '''sigrok-cross-android''' script as needed.
== Manual testing ==


=== Hardware ===
Create a temporary folder where you can store and execute files on your Android device.


You may be interested to buy a [http://www.dx.com/p/micro-usb-on-the-go-host-otg-adapter-pair-50774?Utm_rid=28739841&Utm_source=affiliate Micro USB On-The-Go] (delivery is 4-8 weeks.)
$ '''adb shell'''
$ '''mkdir /data/local/tmp/sigrok'''
$ '''exit'''


=== Testing ===
Copy libraries to your device:


Create a temporary folder where you can store and execute files on your android phone.
$ '''cd ~/sr_android/lib'''
$ '''ls *.so* | while read l; do adb push $l /data/local/tmp/sigrok; done'''


$ adb shell
Copy '''sigrok-cli''' to the device:
$ mkdir /data/local/tmp/sigrok/
$ exit


Copy libraries on your phone
  $ '''cd ~/sr_android/bin'''
  $ cd ~/sr_android/lib/
  $ '''adb push sigrok-cli /data/local/tmp/sigrok'''
  $ ls *.so* | while read l; do adb push $l  /data/local/tmp/sigrok/; done


Copy sigrok-cli to the phone
Test if '''sigrok-cli''' is working as expected:
$ cd ~/sr_android/bin/
$ adb push sigrok-cli /data/local/tmp/sigrok/


Test is sigrok cli is working as expected
  $ '''adb shell'''
  $ adb shell
  $ '''cd /data/local/tmp/sigrok'''
  $ cd /data/local/tmp/sigrok
  $ '''export LD_LIBRARY_PATH=/data/local/tmp/sigrok'''
  $ export LD_LIBRARY_PATH=/data/local/tmp/sigrok  
  $ '''./sigrok-cli --scan'''
  $ ./sigrok-cli --scan

Revision as of 15:23, 25 January 2015

This page describes how you can use sigrok on Android devices.

Screenshots

PulseView running on a 7" Android tablet (800x400):

Nightly APK builds

You can download and install the experimental PulseView-NIGHTLY.apk (for ARM achitecture devices).

The APK ships PulseView for Android including all required libraries, protocol decoders, and so on.

Firmware files

In order for libsigrok/PulseView to be able to find firmware files for certain devices, you have to copy them to the following location:

/sdcard/sigrok-firmware

Please check libsigrok's README.devices file or the respective wiki page to find out whether your device needs firmware files.

Issues

Please check the list of known Android related issues. If you have specific issues which are not listed yet, please open a bug report and attach the relevant information, e.g. which device you used, which architecture (ARM/x86/MIPS/etc), the relevant parts of the adb log, and so on.

Building from source

You can also build various sigrok components from source. The nightly APK (see above) is built using the sigrok-cross-android script from our sigrok-util repository. You can use that script to build your own APK locally (and/or modify it if you want).

$ git clone git://sigrok.org/sigrok-util
$ cd sigrok-util/cross-compile/android

The following invocation will install the required Android NDK, SDK, and toolchains into $HOME/android (per default). Please check the README and modify the sigrok-cross-android script to your needs.

$ ./sigrok-cross-android prepare

Then, in order to build the APK, you can run:

$ ./sigrok-cross-android

The file build/pulseview/android/bin/PulseView-debug.apk is the APK that you can install on your Android device.

Manual testing

Create a temporary folder where you can store and execute files on your Android device.

$ adb shell
$ mkdir /data/local/tmp/sigrok
$ exit

Copy libraries to your device:

$ cd ~/sr_android/lib
$ ls *.so* | while read l; do adb push $l /data/local/tmp/sigrok; done

Copy sigrok-cli to the device:

$ cd ~/sr_android/bin
$ adb push sigrok-cli /data/local/tmp/sigrok

Test if sigrok-cli is working as expected:

$ adb shell
$ cd /data/local/tmp/sigrok
$ export LD_LIBRARY_PATH=/data/local/tmp/sigrok
$ ./sigrok-cli --scan