Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I am new to Android Platform and I Like to know whether it is possible for an Android device (App) to communicate with Linux/XP system via USB port for 2 way communication. If yes how can it be done?

What I want to achieve: I have a PC running Linux and I want to write a small App in my Android device to send and receive data from PC via USB.

share|improve this question
    
This depends a little bit on what you mean by "communicating". Are you looking for devices that support USB host mode, or are you just looking to send data packets both ways over the wire? The latter can be accomplished with ADB and port forwarding –  eldarerathis Sep 30 '11 at 14:38
add comment

3 Answers

up vote 2 down vote accepted

This isn't possible on most devices, since they don't support USB Host mode. Some devices have USB OTG support or a USB Host port, but these are relatively rare devices so far. In theory you could write an application on Win/Linux to access the phone via USB but not the other way around.

share|improve this answer
1  
While this is generally correct from a USB host standpoint, I just want to point out that you don't necessarily need host mode if you simply want to send data packets across a USB cable. You can use a client/server setup with a desktop app and ADB's port forwarding to send data packets both ways. This is essentially how PDANet works. –  eldarerathis Sep 30 '11 at 14:47
    
Yes, this is why I mentioned the possibility of writing an application for the desktop. I just forgot to mention the client/server architecture. Good clarification. –  onik Sep 30 '11 at 14:56
add comment

Android Devices as USB Hosts has been a point of interest for all the developers. Until the Android's HoneyComb OS (OS 3.0), there have been no signs of possibility.
The latest HoneyComb API (OS 3.1), however, seems to provide possibilities to support Android devices being used as USB Hosts. An API has been included for the same.
Therefore, though as of now very few Android devices support the USB Host capability, it will be possible in all the upcoming devices.

share|improve this answer
    
1) 3.1 is Honeycomb, not ICS. It's already been deployed to many devices, and several are in fact at 3.2 already. 2) Several Honeycomb devices absolutely support USB host mode, including the Xoom. You just need an OTG adapter if the device doesn't have a full sized USB port. –  eldarerathis Sep 30 '11 at 14:42
    
+1 to that... I was probably referring to older documentation. But, yes, new devices do support USB Host capability. Thanks, @eldarerathis ! –  SamSPICA Oct 1 '11 at 9:26
add comment

Android doesn't directly expose USB device-mode to applications, but apps can transfer data indirectly via IP when using tethering. This sometimes requires an additional custom 'proxy-like' software/driver on the host to unwrap the data. For example to interpret ipMIDI as MIDI on Linux, multimidicast/QmidiNet is needed.

Host-mode however, has been exposed since 3.1 (in android.hardware.usb).

Hopefully Google will eventually support device-mode (sigh). See these issues in project Android (and star them if they interest you!):
https://code.google.com/p/android/issues/detail?id=10176
https://code.google.com/p/android/issues/detail?id=30198

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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