Question

I've a system with an Android Tablet + an embedded board implementing AOA Protocol.

All works fine, embedded board when connected to Android device send ACCESSORY_START command and Android enters in AOA mode. Then normal flow between two works fine too.

Now I've a question:

There is a way from embedded target to disable AOA mode without physically remove USB cable ?
A sort of ACCESSORY_STOP, so my Android target regain usual PID:VID instead of PID:VID for AOA mode ?

Or there is a way to do that programmatically with Android code ?

No correct solution

OTHER TIPS

If you want to close the accessory on app exit (without unplugging it), call System.exit(0) in Activity onDestroy(). This kills all app threads, including the accessory read thread which blocks the input stream. The accessory can then be reopened without re-plugging.

This is a partial answer to your question (just to make it clear for the watchful pedants diligently monitoring other people's business). But it's useful, because at least you can exit your app and then reconnect the accessory again without unplugging.

And yes, the problem is still with us in 2017., although it was documented ages ago.

I am dealing with the same issue in an embedded project. In the case of Android devices, I believe that power needs to be removed from the USB pins in order to cause a reconnection.

A USB reset at the data level from the host is not enough. I have personally tested resetting the bus, but the device simply reconnects as accesory mode.

If the android accessory device has the ability to power the controller on or off, then a physical USB reconnection can be simulated. In the case of my embedded platform this is performed by using echo 0 or echo 1 into /sys/class/gpio/123/value where 123 is the pin number defined in a header file in the linux kernel sources. This pin number must exported to user space, and must be aligned with the schematic of the embedded project to the pin that controls the powering of the controller which may be called PWR_EN or ENABLE.

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top