+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
Like Tree1Likes

Thread: Android Accessory Mode not supported?

  1. #1
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    7

    Android Accessory Mode not supported?

    Hi,

    After trying the USB Host API mode yesterday, I now decided to see if the accessory mode (which has the tablet in client mode) works. But, it looks like that's not supported either. When uploading a test app, I get requires unavailable shared library com.android.future.usb.accessory. There is a /dev/usb_accessory, so maybe the kernel at least has the required elements, but at least the support from the java side is missing. This post suggest it's a question of missing com.android.future.usb.accessory.jar, but I guess that has native code in it, so I'd need a MIPS version of that library...

    Any suggestions? If neither host nor client modes work, I'll have to sell this tablet and look for something with better OS implementation (or hope for a cyanogen rom...)

    (running 4.0.3 with custom rom)

  2. Geekbuying 728
  3. #2
    Currently Offline Beta **
    Join Date
    Jan 2012
    Posts
    28
    are trying to use google adk?
    if you do, and use demokit code, did you change the code to honeycomb version or above?

    ~and.... i have no luck detecting the adk device on paladin (
    Last edited by neoload1; 03-04-2012 at 02:00 AM.

  4. #3
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    7
    Yes, you're right, thank you for the pointer. I was using code based on the old API.

    If I change it to android.hardware.usb, it loads without problems. It does even switch into accessory mode (switches USB device PID), and I can see usbManager reporting the event in logcat.

    But then, just as in my host mode tests, usbManager returns NULL on getAccessoryList(), and none of the intents are ever called.

    (I am testing this with a linux PC as host, using code from here. I don't actually have a host-capable arduino, but using the PC as host I can see exactly what is happening on this end).

  5. #4
    Currently Offline Beta **
    Join Date
    Jan 2012
    Posts
    28
    uh oh , i think i'm the one gonna need your help ) i do have the device that arduino compatible, and the usbManager still returns NULL on getAccessoryList(). My question is: when are they switched to accessory mode? on which line of code (and which file/class)?

    thanks

  6. #5
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    7
    I am using somewhat different code from you, for connecting to a PC, see attached (modified from Turn your Linux computer into a huge Android USB Accessory | Using Android in Industrial Automation). It's the host (i.e. the PC in my case) that initates the switch I think.

    What I notice is that the device PID initially is 0xdddd (through lsusb in linux). When I connect in accessory mode, it switches to either 0x2D00 or 0x2D01 (still need to find out why there are two options).

    When I initialize a connect from linux, I can see in logcat messages from UsbManager. Unfortunately even if I run adb through wireless (in order to free up the usb port) adb disconnects the moment I connect as accessory mode, so I can only see logcat on the device (and can't cut and paste here). With a bit more time, I can save the log file and get the relevant messages, maybe tomorrow evening.
    Attached Files
    jsgage likes this.

  7. #6
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    2
    I also tried ADK on Paladin without any success. However I found other way to connecting external device, called "MicroBrigde" and it did work fine.

  8. #7
    Currently Offline Beta **
    Join Date
    Jan 2012
    Posts
    28
    Quote Originally Posted by mars_999 View Post
    I also tried ADK on Paladin without any success. However I found other way to connecting external device, called "MicroBrigde" and it did work fine.
    (, C & C++ , no java?

  9. #8
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    2
    It seems to me that ADK and MicroBridge has no difference in developing language.

    Android device: Java
    Ext. device: C for PIC device, C++ for Arduino device , or you can use any language if you wish.

  10. #9
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    7
    Thanks Mars for confirming that Microbridge mode works. So at least client mode is possible, but I need a host-capable arduino, which costs nearly as much as the tablet....

  11. #10
    Currently Offline Beta
    Join Date
    Mar 2012
    Posts
    6
    Hi Thorsten,

    I have an Advanced II (with the stock 4.0.3) and I do also have an Arduino board.

    First off, to explain the two different PIDs:
    The first is used when USB Debugging is off, the second when it is on. With USB Debugging on, it will report two Interfaces (the Accessory Mode and ADB).

    You said you use a custom ROM. May I ask which one you're using?

    What happens internally is pretty straight-forward:
    The host checks the VID and PID. If its not an Android Accessory enabled device (i.e. Google's VID and either 0x2D00 or 0x2D01 as PID), it sends three custom USB control requests:
    • ACCESSORY_GET_PROTOCOL
    • six cases of ACCESSORY_SEND_STRING
      These are important, because Android uses these to find the App to handle this specific accessory.
    • ACCESSORY_START
    If the device does not support Android Accessory mode at all, it will return a STALL (0x05) to any of these commands. Otherwise it will, after receiving the ACCESSORY_START command, disconnect from the bus and reconnect with the new VID/PID combination. It will then have two mass transfer endpoints for communication.

    Now, I have this problem with the stock ROM:
    It starts off with PID 0x0001 and after the hosts sends the above command sequence, it does switch, but the new PID is 0x0004 (or 0x0002 and 0x0005 if USB Debugging is on) and Android does not even ask to open the DemoKit app.

    Even if I program my firmware to treat 0x0004 as an Android Accessory enabled device, the communication does not work. Like I mentioned, Android does not react to the switch like it should.

    So, if your ROM does in fact switch to 0x2D00 or 0x2D01, that would certainly be an improvement for me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts