1. Rxtx Download
  2. Usb Serial Drivers
Active2 years, 11 months ago

I want to send signals via serial port using the JavaComm API classes on an Android device, and here is how I imagine it: 1- the Android device would be: Archos 3.2 which has android 2.2 and USB h. Installation for Windows. RXTX installation procedure if you want to run RXTX enabled programs ==. Identify your Java Runtime Environment's folder. Installation Instructions for RXTX. The JControl/IDE needs a JAVA Communication API to communicate with a JControl device via the serial line (RS232). We recommend Trent Jarvi's RXTX package or the JAVA Communication API from Sun Microsystems. The rxtx mail-list is at Majordomo@hex.linuxgrrls.org. Send email with 'subscribe rxtx' in the subject without the quotes to join. This is a native lib for jdk 1.1.* and newer. If you find changes required for different platforms or OS's please pass them back this way so we may share it with others. USB stands for 'Universal Serial Bus'. It is an industry standard developed in the mid-1990s that defines the cables, connectors and communications protocols used in a bus for connection, communication, and power supply between computers and electronic devices. USB was intended to standardize the.

I want to send signals via serial port using the JavaComm API classes on an Android device, and here is how I imagine it:

1- the Android device would be: Archos 3.2 which has android 2.2 and USB host mode.

2- include RxTx lib package with my Android app. and include RxTx native code using Android NDK.

3- a short cable which is usb-->serial.

Could you explain to me where I might face problems?

gobernador
4,4473 gold badges26 silver badges50 bronze badges
ramirami

8 Answers

I just ported the JavaCOMM ( GNU RXTX ) library to the Android. Here is the link http://v-lad.org/projects/gnu.io.android/

You still might need to rebuild your kernel and maybe recompile the shared library for your environment. But this should get you started.

VladVlad
6,2793 gold badges33 silver badges53 bronze badges

As noted above, you'll need to come up with device drivers for whatever USB<->Serial device you have. Many of these devices use the Prolific PL2303 chip:

which the stock linux kernel has support for, and has had for a long time. I've used this and it works fine, so I would recommend you stick with USB<->Serial devices that use this chip.

Beyond that, with udev these devices normally show up as /dev/ttyUSB#. How that happens with Android, I don't know, so you'll need to figure that out.

Finally, you will need to build the RxTx native code. This code is pretty crufty - I had problems building it on a fairly modern Angstrom, and I was not trying to cross-compile at all.

Usb
TazMainiacTazMainiac

Unlike the regular PCs, most of the stock kernels for the android devices come with minimum compiled modules. You need to recompile the kernel with enabled drivers for USB to serial converters. You luck depends on the specific device that you using. A lot of manufactures violate GPL, by not providing the kernel source code. Some manufactures like Motorola with the Droid 2 require signed kernel. Which makes it impossible to load custom kernel on the device.

Also, although many devices have USB host mode you have to jump through the hoops to switch the device mode. For example Motrola droid requires a special dongle to be plugged in into the USB port before powering on to switch into the host mode.

Here are some links for you that explain what you need to do:

  1. “More on Droid host mode,” http://www.tombom.co.uk/blog/?p=134.

    Electrical engineering definition We are the best source for free download of network equipment Visio stencils that we develop for Cisco Systems, Juniper Networks, Alcatel-Lucent, Leviton, Panduit, Tripp Lite and more.

  2. “USB Host mode on Motorola Droid,” http://www.tombom.co.uk/blog/?p=124.

VladVlad
6,2793 gold badges33 silver badges53 bronze badges

Yes, it's definitely a mess to use the serial devices from the phone side on the Android. The problem is that the various devices present on the AOS is not documented, and rarely coincides with standard Linux ones. Thus you are never sure what/who you are actually talking to, some device, abstraction layer (HAL, UART,PCI etc). Here is a tutorial on how to talk to a serial device (the modem) from an externally USB connected PC.

In any case, if your phone does support USB host mode, there have to be another way to reach your serial port/devices using that. After all, backward compatibility does often insure some kind of FAX, telephony or external modem support from your USB cable. Also there is tehtering which may also contain some virtual serial device..

There is a tutorial for some of this here.

PS. The main problem of such programs (like that of Vlad) and applications (like serial-api) are that they make too strong assumptions on the device/port names and the permissions needed to reach (read/write) these..

not2qubitnot2qubit
5,2602 gold badges45 silver badges73 bronze badges

Probably not exactly what you're looking for, but this instructable might point you in the right direction

Stewart MurrieStewart Murrie

The biggest problem is probably the USB->Serial Adapter:

You need the either a device driver for the USB Serial Driver, which is probably not included in the android kernel.

The other option is to use something like libusb (which may have to be ported to android as well) and a user space driver based on libusb.

plaisthosplaisthos
4,1696 gold badges28 silver badges61 bronze badges

I've done this.You need to:1. Root the device.

  1. Create your own module for the specific USB chiset you're about to use: Building kernel module for Android

  2. I recommend using the ported usb-serial-for-android library, which has the PL2303 driver already implemented:https://code.google.com/r/felixhaedicke-usb-serial-for-android

Community
VaidenVaiden
10.7k4 gold badges45 silver badges71 bronze badges

What you need to do first is to root the tablet in order to get Read/Write access to the serial ports.

After you do this take a look at Android Serial Port API. You can download the source code and see how it is implemented.

It has a native lib that gets a file descriptor to the serial ports and then you can read and write to the ports. Usually the app may not list all the available ports on the tablet. To see where your device is connected, plug it in the USB with HostMode, and in an Emulator type 'dmesg tail'. It should give you details about the device, and the port that is connected to.

I also used an Archos Tablet, mine device was connected to '/dev/ttyACM0'.

Good Luck!

Rxtx Download

Ovidiu LatcuOvidiu Latcu
48.9k13 gold badges67 silver badges82 bronze badges
Serial

Usb Serial Drivers

Not the answer you're looking for? Browse other questions tagged javaandroidembeddedserial-portcommunication or ask your own question.