I am designing a USB OTG board as an extension board for Android. The board is based upon Freescale KL25Z128VLK4. Most part of design is similar to IOIO from Sparkfun, with some extensions.
In current design, switching role host/device has to be done manually by swapping cable connection. However, in latter case, if KL25Z can not offer enough current to Android, KL25Z wants to hand over host role to Android, so it can switch off main supply of 5V/500mA, and works in low power mode with VBUS from Android.
Anyway, I want my board to support switching mode between HOST/Device, as well as support in Android.
In principle, HNP protocol should be started for switching A/B in OTG. However, I have no idea how to handle it in Android side. I mean I don't know how Android SDK support HNP in programmatic way? Any API involved? Any documents, labs and open projects?
As of right now HNP protocol is not supported in the Android. The only way to do this would be to reset the USB stack on your board and re enumerate each time you want to switch modes.