Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read and writer data via USB port on Android 3.1

I am trying to write an android app to read and write data from android tablet to our embedded device. The tablet and embedded device are connected via usb to serial converter. Is it possible to read data from the embedded device into our android tablet? Any sample code that I can take a look at?

like image 300
dan Avatar asked Apr 26 '12 19:04

dan


People also ask

How do I get USB permissions on Android?

To do this, your application has to: Discover connected USB devices by using an intent filter to be notified when the user connects a USB device or by enumerating USB devices that are already connected. Ask the user for permission to connect to the USB device, if not already obtained.

What is USB accessory mode?

USB accessory mode allows users to connect USB host hardware specifically designed for Android-powered devices. The accessories must adhere to the Android accessory protocol outlined in the Android Accessory Development Kit documentation.

How do I reset USB on Android?

Try following methods. Go to Settings> Storage> More (three dots menu)> USB computer connection, choose Media device (MTP). For Android 6.0, go to Settings> About phone (> Software info), tap “Build number” 7-10 times. Back to Settings> Developer options, check “Select USB Configuration”, choose MTP.

What is USB host port?

USB host is the system that connects to multiple USB clients. For example, the PC is a USB host and it can connect to multiple USB clients like mice, keyboards, and mass storage devices.


1 Answers

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

I've used it successfully.

like image 153
Vaiden Avatar answered Oct 05 '22 04:10

Vaiden