1. Source Repository
  2. Download Binaries
Bookmark and Share

Android and Serial Port.

This is an informational page for my port of the RXTX library to the android platform. The RXTX library started as an implementation of Sun's JavaCOMM API and now it grew into an independent project. The main page for RXTX project is here.

Unfortunately the Android Java environment and the Linux environment are different enough from the standard Linux or Windows enironment that the library could not be used as is. So I made the port of the library. The current port is based on the GNU.IO library version 2.1.7.

Here is a picture of the test program running on the Motorola Droid connected via serial port to the embedded device running FreeNAS.




This library was tested in the following environment.

Device Motorola Droid
ROM Cyanogen 6.1
USB-to-Serial port adapter Silicon Laboratories CP-2103



How to try it for yourself


Following the steps below will void your phone warranty. Also if you are not very careful you might end up breaking your phone. You have been warned, proceed with caution.



Obviously, you'll need an Android device either with built-in serial port or USB port that could switch to a host mode. Some devices such as Motorola Droid require a special dongle to switch the USB port to the host mode. More information about such dongles could be found here:

USB to serial port adapter. I used the Silicon Laboratories CP2103 evaluation kit which is available from DigiKey.



If you are not lucky to have the kernel on your device that supports the serial port you have to build one yourself. I have provided a pre-built kernel and modules for Motorolla Droid running Cyanogen 6.1. You can download it from the links below. Make sure you download both the kernel and the modules.

Rooting the phone and installing CyanogenMod

Because the standard Droid phone come with the serial driver, the phone has to be rooted. For myself when working with embedded android project I use the excellent CyanogenMod distribution. It gives all the features of a commercial Android platform plus many tools that come very handy for embedded work. This distribution is also very flexible to allow creating of locked down solutions to be deployed in the field. Look here for instructions on how to set it up. Note that the library was tested with version 6.1. If you install some other version the binaries (kernel and driver modules ) below might not work properly.

Setting up


Download Binaries

File Description
boot.img Boot image
module.tgz Kernel modules
librxtxSerial.so Shared library
GnuIOTEST.apk Example application

Bookmark and Share