Java Rxtx Usb Serial Driver
As noted above, you'll need to come up with device drivers for whatever USBSerial 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 USBSerial 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. 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.
How to read a usb serial port in JAVA? My Xbee device is connected to my laptop on a usb serial. Terminal programm and RXTX is connecting to the serial port.
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:. “More on Droid host mode,”. “USB Host mode on Motorola Droid,”. 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.
Prolific Usb Serial Driver
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.
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. 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. 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'.
I add some detail to my question. I receive on my Xbee device a flow of GPS coordinates but I'm unable to read and stock these data on a buffer.
My Xbee device is connected to my laptop on a usb serial port, that's why I want to create a program java to read and use my data flow sending by the serial port. I'm searching on internet some code example or tutorials, without enought advices for my understanding, or I just find some dead projects. I found that it's possible to use jssc library or javax.comm (but I can't download the javax.zip on sun).
Rxtx
Do you know an other better USB API? Could you help me to understand how I can manage to read and stock my Flow of GPS cordinate? Forget abut USB, it acts as transparent bridge. What you need is a way to read from the serial port. Javax.comm is not (officially) available any more.
I have been successfull dealing with the arduino serial port with the library. First make sure you see the serial port on your dev machine. This might require to install a driver.
Rxtx Library Download
Then use a terminal program to connect to the serial port. Once this is working go on and get RXTX working. Just in case: You can have only one connection at a time. Make sure that only one of IDE, terminal programm and RXTX is connecting to the serial port at the same time.