-
03-03-2012 03:06 PM #1
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)
-
03-04-2012 01:57 AM #2
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.
-
03-04-2012 08:34 PM #3
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).
-
03-04-2012 09:21 PM #4
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
-
03-04-2012 10:16 PM #5
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.
-
03-05-2012 01:38 AM #6
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.
-
03-05-2012 05:46 AM #7
Beta
**
- Join Date
- Jan 2012
- Posts
- 28
-
03-05-2012 06:47 AM #8
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.
-
03-06-2012 12:11 PM #9
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....
-
03-20-2012 03:13 PM #10
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
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.


1Likes
LinkBack URL
About LinkBacks
Reply With Quote


