I would like to transfer data from a USB Host (of my Laptop or Android Device) to Serial COM port (of a Desktop PC) through a USB - Serial port(DB-9) adapter.
Is there any library existed to do this task??
i have already studied and tried http://developer.android.com/guide/topics/connectivity/usb/host.html but failed.
Can i send data by a using a java program or Android App from my Laptop or Android Device ??
Can i receive data by an app in Desktop PC and show us????
If so please guide me how.
Yes, this is possible, the implementation will depend on what device you pick.
Check out the usb-serial-for-android project for the communication from Android to the USB device. This has support for most major USB to UART Bridge devices such as a Silicon Labs, Prolific, FTDI and CDC Class devices.
You can talk to it as a serial device from your laptop computer using normal serial communications such as POSIX method for Linux or OSX or the Commuincations API for Windows.
Related
Is there any way to make a communication between a peripheral with android OS with RS232 support and a non android smart TV with RS232 support? Basically, I have to create an app which will be installed on the android based peripheral so that when it is connected to the TV using single RS232 cable, commands could be sent from peripheral to TV.
I have not been able to proceed because I am unable to find a process for that.
From what I understand, in stock Android unless you are doing something special in NDK (C code) with specific hardware there isn't a serial connector.
Android Things has a UART but that is specific to Android Things hardware.
If you are trying to get a off-the shelf phone/tablet to connect via serial, a USB-serial dongle would probably be the quickest route.
See: Communicating with serial USB device over Android
Since the microUSB connector will be occupied you can run adb over Wifi. See: Run/install/debug Android applications over Wi-Fi
I need to communicate with a device with a rs232 out put,but my laptop doesn't
have a rs232 port,then i bought a rs232 to USB converter and now i want to listen on the
usb port for data,can i use jssc to achive this. ???
I know this is months old, but I see no answers. The answer is yes.
You can test your cable by going to the JSSC google code project page and access the Wiki tab's JSSCTerminal link. It's a Java Applet Terminal program that allows you to connect a device via your cable, set port, speed, stop bits, etc., and then send commands and receive data.
I am successfully using JSSC to write Java programs to download data from Blood Glucose Meters and GPS trackers to my Linux and Windows 7 desktops and my Windows 7 laptop. My serial-to-USB cable uses an older Prolific chipset. The FTDI chipset should work too.
Once the appropriate drivers are loaded in your OS the OS sees the connected cable as a COM port in Windows and usually as the serial device /dev/ttyUSB0 in Linux/Mac. At this point you can use any Terminal/Comm program or library to interact with them including JSSC. You can download and run the examples unchanged from the JSSC project.
this lib is used by arduino ide on that purpose https://github.com/arduino/Arduino/blob/master/arduino-core/src/processing/app/Serial.java
I know that the latest android device with API>3.1 support USB host mode or USB OTG that allows you to connect a lot of usb devices like flash disks,mouse,keyboard etc. but can you connect any device that does not have common general drivers like USB to uart device,printers,cameras
I have linux drivers for these devices in source codes as .c files, So is there a way that I can build and install those drivers to an android phone and make the usb devices usable on the phone?
To use linux drivers for android you have to compile your own kernel or kernel module. If you expect your app to be used by other people, this is not a feasible way.
For some low bandwidth USB devices it is possible to write user space drivers in java using the Host API. For USB-UARTs there is the usb-serial-for-android project that is implementing a user space driver based on this API.
Never Mind ! I found a standard way for my device here It provides interface through native code and IPC and official library from manufacturer
I have been trying to get the FTDI D2xx driver working with my Android 2.3.4 tablet for a while now. After solving a number issues relating to actually loading the driver I am now in a situation where the FTDI device is just not seen by the sample application FTDI provides.
There are no errors reported in either LogCat or Java (debug) the device is just simply not found.
Java_com_ftdi_D2xx_getDeviceInfoList() returns zero.
The tablet is rooted, and the permissions for the ueventd.rc file are set to:
/dev/bus/usb/* 0666 root usb
The USB port I have connected my TTL-232R to does work (in that I can read a USB memory stick with it at least...)
Has anyone else experimented with this and/or got it working? If so some pointers would be greatly appreciated!
Many thanks
Does 2.3.4 support USB Host?
http://developer.android.com/sdk/android-2.3.4.html
No USB host support — Android 2.3.4 and the Open Accessory Library do not support USB host mode (for example, through UsbDevice), although USB host mode is supported in Android 3.1. An Android-powered device running Android 2.3.4 can not function as a USB host. The library enables the Android-powered device to function as a peripheral only, with the connected accessory functioning as USB host (through UsbAccessory).
I've got the sample working with ICS.
Well, I must manually switch from USB peripherals to USB host and vice versa in terminal emulator, since stock kernel does not support otg, custom kernel support otg, but not turn it on automaticly.
cmd1="echo host > /d/otg/mode"; // usb otg host on
cmd2="cat /d/otg/info</"; // check usb status, must be usb a_host and otg=1
cmd3="echo peripheral > /d/otg/mode"; // usb oth host off
I wish to connect 10 usb modems to a windows/linux pc and send AT comments to them to send sms and receive sms from them. Is this possible in Java?
I think it is possible. You just have to know the COMM port ID for each modem. I do not know pure java way to discover these IDs. So, you need some platform specific way (e.g. WMI on windows or some command on Unix). But once you have ID it should not be a problem.
Assuming the USB modem implements a serial interface, it should get a COMM port id. If so, you can use RXTX to talk to the model.
afaik, you can use serial communication while talking to usb devices as long as device hardware contains an ftdi chip or so. I used a c++ serial lib in a Qt project, talking to an Arduino connected on a usb port. arduino appears as a com device.
otherwise, you may look at the jusb project: http://www.ibm.com/developerworks/library/j-usb/index.html