Tuesday, September 4, 2012

USB Host on Android

Android 4 supports USB host.  This is great! 

Does it actually work?  Wellll.... sort of.

Observations so far:

  • Galaxy Nexus:  Works fine with OTG cable, huge power budget.
  • N7: Works fine with OTG cable, huge power budget
  • Xoom 1: Some things work, some don't.  "Simple" USB ops seem fine, but complex stuff (like driving a USB wifi NIC) seem to blow up.
  • Motorola Razr Maxx: This one is extra weird.  USB host exists, but requires a +5v backfed power, with enough amps on it to charge the phone in host mode.  That's a hell of a thing.  The Razr also enforces an excessively small power budget (so small I'm not sure it allows ANY device to function) unless a hub is in the chain.  It doesn't even have to be an externally-powered hub!  (Well, except that you have to externally provide USB power regardless).
  • HTC One V: AKA the Ninja Phone, is reported to have non-working USB host due to kernel bugs.  Custom ROMs only?
  • Other phones: No idea, let me know in the comments?
How do we fix this? Even on phones with a generous power budget, we need to prevent high-power USB devices from draining the phone battery (sometimes in the matter of 30 minutes).


I'm working on a USB power injection board which provides micro-usb ports for phone and battery packs (on the assumption that everyone has a ton of micro cables handy by this point), an integrated one-port USB2 high-speed hub to handle power budget problems, and a standard female USB socket for client devices.

Could you solder together some cables and get the same effect?  Sure.  You could also use a no-logic power splitter board like one I made earlier.  But it's really ugly, and prone to falling apart at the worst moments.





So I'd rather do it cleanly.

9 comments:

  1. USB Host and USB OTG work on my Asus Padfone. I've done lsusb setups and many devices don't even need to be configured.

    Haven't messed with add_lunch_combo for AOSP device builds yet. There's at least one good guide on forum.xda-developers.org -- "[GUIDE] Using external USB wifi" with links to others that have been successful in many cases.

    WIth HakShop now selling the MiniAnd mk802 and the influx of new SoC boards with AOSP support, I'm starting to see a very bright future for Android-based WiFi pen-testing and network analysis tools.

    Are you using a cable such as the SANOXY USB 2.0 Female to Micro USB Male OTG one found on Amazon?

    I have also successfully done USB OTG with every Samsung Galaxy Nexus build I've seen. The Samsung Galaxy S2 required a custom kernel (usually from a custom ROM, but it could also be the stock ROM). The kernel usually adds the USB OTG support.

    ReplyDelete
  2. Some observations on OTG support:

    - On a stock (unrooted) Nexus S, OTG doesn't seem to work at all. This is even though the phone is running Jelly Bean. It did not work on my Nexus S under Ice Cream Sandwich either. My test peripheral was a Logitech USB wireless mouse. I tried both a stand alone OTG cable, as well as OTG cable going to a powered hub, with the peripheral attached to the hub.
    - I can corroborate that OTG works (mostly) on the Galaxy Nexus, through either a stand alone OTG cable or through a powered hub. I haven't tried attaching multiple devices to the hub however. I experienced something today though that I have never seen mentioned before, which is that my Galaxy Nexus simply stopped recognising my Alfa AWUS 036H (I have an experimental app setup to claim the device when it is plugged in). I was able to get my USB mouse recognized still, but it just would not recognize the alfa, even after restarting the phone etc. I finally tried the alfa through a powered USB hub and now it's being recognised again. I have no idea why this is. My best guess is that it is a power constraint of some sort - perhaps the battery is getting old and tipped the scales today. Either way, if you at some point in time find your phone no longer works with something it used to over a stand alone OTG cable, consider trying with a powered hub.

    ReplyDelete
  3. LG Optimus 2x not support OTG USB,.. please help me

    ReplyDelete
  4. Are you planning on selling these boards? Or maybe release the design project?

    ReplyDelete
  5. dre: I have plans for the mk802. It's very interesting. Also you can run straight up Ubuntu on it. I've used several OTG cables.

    Bryce: Yeah I'd bet power.

    Nismar: Not much you can do. Try a custom ROM? May also be a HW limitation.

    Melvin: Yeah the plan is to get them built, need to make some tweaks.

    ReplyDelete
  6. I have RAZR Maxx ICS 4.0.4
    Purchase Monoprice otg cable(9724) connect Sandisk USB flash drive no response..Will charge using USB cable type A to A(male) A/C USB(5.2v 1.2A)Sierra wall charger.
    Later purchase Monoprice 7-Port USB 2.0 HUB w/ AC adapter(5v 2.0A)no response. I try USB A to A cable thru OTG cable connection to USB hub powered no response. I disconnected power adapter from USB Hub no response. Connect USB Hub To cell wall charger using USB A to A cable then from Hub using USB A to Micro no OTG cable no response. All attempts Sandisk USB flash drive did try connecting Canon T3i alone using Android App called DSLR no response

    ReplyDelete
  7. Looks good. Maybe I should think of something to do with my amp connectors automotive, if my lighting electronics were still working, I wouldn't even try to move the connectors to other electronics I have at home.

    -Marchello

    ReplyDelete
  8. Did you ever build these USB power injector boards? They'd be perfect for a USB bar code scanner project I have.... (Presentation scanner, Motorola DS9208)

    ReplyDelete
  9. Working on it - dropped the ball on a lot of stuff this fall; getting laid off makes everything kind of wonky. You'd think there'd be tons of free time but somehow it doesn't end up being true.

    ReplyDelete