2

I'm a newbie to the Android development world but have some experience with embedded systems.

I'd like to use an Android phone (4.x or higher) to control other devices via its USB port. We want to set the Android device as a USB host, so solutions where other devices play the host role (e.g. Android Open Accessory Development Kit's Arduino) will not meet our goal.

We are currently using Eclipse-SDK for Android development and successfully have compiled/run/debug several apps. However, I have a very naive question. I was wondering if there is a way one could use the USB port of the development host PC as an input to the Android Virtual Device emulator.

I realize that an easier way to debug the USB-host apps we are writing would be by having a real device. However, the price of the new Ice Cream Sandwich devices is somehow far away from our reach and not the ideal way for debugging an application at its early stages.

I appreciate any help you can provide me with.

nanoeng
  • 185
  • 1
  • 2
  • 9
  • I would strongly suggest that you don't get to far into this project without having an actual device to test on. It is very likely that anything you manage to figure out while working with the emulator may not transfer to a real device and you'll have gained little for the time you put into work on the emulator. – FoamyGuy Dec 30 '11 at 17:02
  • Thanks for the quick reply, Tim! We have a HTC Desire that has been set as our pet device for a while. We have run several experiments on it and plan to MOD it using CyanogenMod-9 as soon as it is made available. No matter it is not a pure ICS device, do you think it could work as a testing platform for the USB-host apps I described above? – nanoeng Dec 30 '11 at 17:12

2 Answers2

2

The Android Open Accessory Dev kit has been backported to 2.3.4 see here http://developer.android.com/guide/topics/usb/adk.html

So install CM7 or earlier (http://www.cyanogenmod.com/) on your HTC desire and you should be good to go!

Look at the example projects for the 2.3 SDK should help get you going in the right direction.

Path to SDK Samples for me was C:\Program Files\Android\android-sdk\samples

If your looking for USB Host Support basically control and talk to another usb device such as mouse, keyboard, usb thumb drive etc the following should help.

Nexus One as USB Host: http://sven.killig.de/android/N1/2.2/usb_host/

USB Host: External USB devices to Android phones?

Official Android SKD UsbDevice Class: http://developer.android.com/reference/android/hardware/usb/UsbDevice.html

Community
  • 1
  • 1
bigamil
  • 657
  • 4
  • 12
  • Thanks for the reply, Bigamil! I installed CM7 and looked for the USB example you mentioned. However, I couldn't find any under the **android-10** folder. USB examples start appearing after API 12 (Android 3.1). On the other hand, I'm not sure having Open Accessory Device capabilities will provide me with the hosting requirements I'm looking for. I explored that option earlier using an Arduino board but we definitely want to have the **hosting capabilities at the phone itself** without the use of external micro-controllers. – nanoeng Jan 03 '12 at 16:42
  • An example for 12 should work with a few minor changes in 10 since the API was backported. You need USB Host Support. I updated my answer to reflect that. Let me know what you think. – bigamil Jan 03 '12 at 21:22
  • Thanks for updating the answer you posted earlier. I'll try Sven Killig's method. – nanoeng Jan 03 '12 at 23:04
0

You should take a look at this project, its a great reference

https://code.google.com/p/mover-bot/

anders
  • 4,168
  • 2
  • 23
  • 31
  • You are welcome, its a great resource for getting started. I've contacted the developer before and he responded very quickly I'm sure he wouldn't mind some more :) good luck – anders Jan 06 '14 at 16:48