0
\$\begingroup\$

The Android AOA specification states that

When the Android-powered device is in host mode, it acts as the USB host and powers the bus.

and

When the Android-powered device is in USB accessory mode, the connected USB hardware (an Android USB accessory in this case) acts as the host and powers the bus.

As a consequence, all of the Android Accessory documentation or examples are for circuits/programs that provide USB Host to communicate with the Android in device mode. The particular Android accessory I want to develop needs to draw power from the device, and I know this is possible with On-the-Go technology, but using an OTG device puts the Android in Host mode.

How can an HID device (AVR device using LUFA, to be specific) act as an Android Accessory AND pull power from the Android phone?

\$\endgroup\$
  • 1
    \$\begingroup\$ Why put the accessory in accessory mode in the first place? From what I can tell from the documentation, Host mode (on the android device) powers the device and allows 2-way data communication between the device & the host. You're saying that the device you're creating is an HID device. Look at computers. If you were to translate the android definitions to a computer, the PC would be in host mode, which would give power to my keyboard & mouse, but would still allow 2-way data comms to the mouse & itself. \$\endgroup\$ – gnimmargorP May 3 '17 at 17:00
  • 1
    \$\begingroup\$ Your HID device is in device/slave/accessory mode, then the android device has to be in host mode, and by default host side will provide power. Also your HID device obviously does not run android so it will never be a "Android-powered device in USB accessory mode", it's a "USB accessory to a android-powered host". \$\endgroup\$ – user3528438 May 3 '17 at 17:39
  • \$\begingroup\$ @user3528438 android accessories act as host. That's the idea behind AOA. \$\endgroup\$ – Passerby May 3 '17 at 18:13
  • \$\begingroup\$ i see cheap (logic-less) micro usb interfaces for various ebay junk; leading me to think a lot of phones just provide 5v all the time... \$\endgroup\$ – dandavis May 4 '17 at 5:24
  • \$\begingroup\$ @user3528438 I want my device to identify itself as an accessory to the Android device, not be an Android device. However, all the examples I find require the device to act as the host (aka, the power supply) but I need to the device to be powered by the Android. \$\endgroup\$ – Blake Lucas May 4 '17 at 23:16
2
\$\begingroup\$

It cannot. Most devices are not designed like that. You could avoid usb issues by using Bluetooth instead. And as far as I know, AOA is out dated and not very well supported any more. It stagnated with kit Kat and universal OTG support.

As mentioned though, a USB HID device will always be a slave to the host. For HID, which is a predefined USB standard and not an arbitrary device that requires custom drivers, USB OTG is what you want. Power will be available to your device.

\$\endgroup\$
  • \$\begingroup\$ I'm trying to avoid Bluetooth, so the device can be as plug-and-play as possible. I've gotten USB communication working with my chip, but I guess I can't make a device into a literal accessory. \$\endgroup\$ – Blake Lucas May 4 '17 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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