tags:

views:

439

answers:

1

We have made a device which can act as an USB host or slave and processes the data it receives. I want to use the Android phones to send the data to it via USB.

My research leads me to conclude that we cannot use Android devices in USB Host mode without modifying the hardware or OS. Doing so is not an option as this is going to be a commercially deployed device.

However, I couldn't find any information on using the Android phone as a slave. This is already technically possible because it can connect to the PC in a similar configuration. Can we do the same via an application? If so, any information on how to achieve this will be greatly appreciated. I have full access to our device's embedded system, so custom code there should not be a problem.

A: 

This is already technically possible because it can connect to the PC in a similar configuration.

Only for things baked into the firmware. Your SDK application cannot invent new Linux device drivers, nor does it have any access to the Android device side of the adb connection.

Can we do the same via an application?

Since you have not said what you are trying to do, this is impossible to answer in a definitive fashion.

Say, for example, the "device which can act as an USB host or slave and processes the data it receives" wants screenshots off of the Android device. That is eminently possible via adb, because adb has a protocol for that built in. All you would need to do is have your device connect to the Android device via the adb protocol and request screenshots, no different than does DDMS or hierarchyviewer.

So, I would look at the problem from a different perspective: if you can accomplish it via DDMS, you can do it via your custom device. If you can accomplish it via adb shell commands, you can do it via your custom device. If you cannot accomplish your goals via existing interfaces, though, since you have no way to invent new ones over USB, you will be stuck.

Conceivably, you could plug your custom device into a Bluetooth or WiFi dongle, then use those on Android for communication.

CommonsWare
Thanks for the reply! The device is a specialized printer. Bluetooth/WiFi support is planned, but not in the current version.But what you say about adb and DDMS is interesting. I will look more into this, thank you very much.
Vaayu