Reputation: 741
Is there any possibilities to mock up my pc as the usb host and my android device using android usb api. If it so, how to set up the initial configurations? Please help me...
Upvotes: 2
Views: 1041
Reputation:
If you are trying to get your phone to see your PC as a UsbAccessory
, it must communicate via the AOA (Android Open Accessory) protocol.
From the PC, you must detect and determine which device is your phone. Then go through its interfaces; typically, the accessory one will be class 0xFF and subclass 0xFF.
Once you've determined that, you must then determine its read and its write endpoints. Typically the accessory interface has one read and write, and they are both bulk transfer (0x02) type.
Finally, using the write endpoint, send specific control request packets to the phone to activate it in "accessory mode". These packets are all outlined here:
http://source.android.com/tech/accessories/aoap/aoa.html
After they're sent, the phone will be able to see your PC as a UsbAccessory
object (within the Android API). You can enumerate the accessories attached and begin communication via a FileInputStream
and FileOutputStream
, all documented here:
http://developer.android.com/guide/topics/connectivity/usb/accessory.html
Upvotes: 2