Hack A Day Article: USB host mode for Droid - Hack a Day
Source Article: USB Host mode on Motorola Droid Chris Paget's Blog
Thereís a simple hack to use your Motorola Droid phone as a USB host. It is a hardware-only hack that doesnít require you to crack open your phone , root it, or even to change firmware (although device drivers in the stock Android image may be quite limited). The dongle above is used as a key to enable the mode while the phone is booting. This was repurposed from a car charging cable by removing the wires and resistor and shorting the resistor pads. Once the phone is in host mode the dongle is swapped for a simple USB-mini to USB-A socket adapter, built from two cables you probably have lying around. Now you can plug in any device you want.
And now for the good stuff!
USB Host mode on Motorola Droid
Yes, itís true Ė Android (at long last!) has access to USB Host mode. I had been waiting for this to happen on the Nexus 1 or N900 some time soon, but as it turns out itís the Droid that takes the crown. Itís a neat little hack that I heard about at Shmoocon; Iíd like to thank to Mike Kershaw from Kismet and Mike Baker from OpenWRT for sharing Hereís how it works.
The USB hardware on the Droid is actually capable of USB-OTG (meaning that it can act as both host and peripheral), however it only possesses a standard USB Micro-B port instead of the Micro-AB port that you would normally get from an OTG device (such as the N810). With a minimal amount of effort (and tolerance of a few bugs) itís possible to enable the B port as a host interface (as OTG says you should be able to do), meaning it supplies power and acts as the bus controller. Itís actually pretty easy; I can easily think of about a hundred million ways to make this useful on the Droid (think: plug any USB hardware you like into your Droid, as long as it works in Linux it should work in Android).
Youíll need to make two things, a micro-dongle to enable the port (you plug it in during boot time) and a cable with the right connectors on each end (for connecting your peripheral). To do this youíll need three cables:
- A car charging cable (off-the-shelf at the Verizon store)
- A Micro-USB cable (as above)
- A USB extender cable (the teeny ones that sometimes come free with USB keys work great)
Start with the car charging cable. Break open the micro-usb connector (it comes apart fairly easily) and look at the little PCB inside Ė there should be a single tiny surface-mount resistor and two wires from the charger cable. Unsolder both wires and the resistor, and then bridge the pads where the resistor used to be so that itís completely shorted. The end result should look something like this:
This is your micro-dongle.
Next up, you need to make your connector cable. Cut the end off the USB extender cable, you want to keep the socket end and discard the plug. Cut the micro-usb cable as well, but on this one you want to keep the plug and discard the socket. You should now have a micro-usb plug thatíll fit into your droid and a usb socket that you could plug a memory stick into. Strip the wires off the ends of both cables and join them to each other, connecting like colours (and the shield) together. When itís finished it should look something like this:
(Youíll obviously want to insulate the wires afterwards, this is just to show how the colours are connected).
You donít even need to root your droid in order to verify it works (although I rooted mine using the instructions here anyway), just do the following:
- Turn your Droid off
- Plug the micro-dongle into the USB port
- Turn the droid on
- Unplug the micro-dongle as soon as the Motorola logo disappears (as the Droid lodo is appearing).
Once your Droid is booted, pull up a terminal and look at dmesg Ė after plugging in your USB peripheral using the cable you made earlier you should see the usual kernel notifications about new USB devices being connected; theyíll also turn on (or start charging) if theyíre powered by USB. Youíll only be able to plug in one peripheral before the port reverts to peripheral mode; youíll have to reboot with the micro-dongle if you want to go back into host mode. Also, if you leave the micro-dongle plugged in too long it triggers another bug, the port gets stuck supplying power to devices but not actually recognising them. Hopefully the drivers are sufficiently open-source that these are easy bugs to squash, and that dynamically switching between host mode and peripheral mode wonít be too hard to add either.
Unsurprisingly thereís not much driver support for USB peripherals in the standard Android kernel (I couldnít mount a USB key for example), but itís easy enough for the ROM developers to start adding drivers Ė Iíll be flashing Sholes shortly to see how it does. Expect to see a whole new generation of Android hackery to start soon
//edit: Andrew de Quincey has apparently also gotten Host mode working on the Hero, and pointed out that while the stock Android kernel may not support USB storage it does support USB keyboards. Plugging one into my Droid using the steps above, it Just Works. Itís kinda nice to have a proper keyboard on a cellphoneÖ