ADK 1.0 devices fail to work with Jelly Bean, why?
Asked Answered
B

4

5

Just connected the tried and true ADK accessory to Nexus 7 and Galaxy Nexus - and it failed to connect with "could not read device protocol version" message. Thought that the board died, connected to Nexus S with ICS - worked just fine. Worked on Galaxy Nexus before Jelly Bean upgrade as well, so hardware failure can be ruled out.

I've been watching ADK announcements pretty closely, but don't remember reading or hearing anything about this particular change, nor backward compatibility of Android devices supporting ADK 2.0.

Accessory Development Kit 2011 Guide says "Protocol version 1 is supported by Android 2.3.4 (API Level 10) and higher. Protocol version 2 is supported by Android 4.1 (API Level 16) and higher", it doesn't say that version 1 is not supported by 4.1, and it would be pretty bizarre to find that existing hardware would be abandoned just like that.

What am I missing here? Is this a bug or a feature?

Bickford answered 19/7, 2012 at 14:49 Comment(4)
I'm having the same issue. A USB accessory that works great on everything before Jellybean is being identified as a media device when connected to a Nexus 7.Ashanti
I just tried my ADK2011 (arguably a "tried and true ADK accessory") with two devices running 4.1 and it worked fine with both (Galaxy Nexus and Nexus 7). Is there any way you can provide more context than it didn't work? Source code/Errors/Logs/anything that demonstrates the problem?Indispose
@ajray: Code in question is at github.com/home-climate-control/arduino. Is the source for the code that works for you publicly available?Bickford
@Bickford developer.android.com/tools/adk/adk.html I'm using that device (ADK2011) with the default sketch (demokit.pde). I can connect to the device using your app, and pressing buttons randomly lit up one of the LED's. I cant get your arduino sketch to build; if I could I'd test it on my device.Indispose
T
5

The old ADK1 libraries released last year don't recognize the new AOA v2 protocol that JellyBean devices (Android 4.1 and up) speak. This was fixed in an updated ADK1 library release.

Go get the new ADK1 libraries:

Update your ADK libraries and upload your ADK1 sketch. Note that the new libraries have been updated to work with Arduino 1.0 and higher, so you will probably have to update your Arduino IDE as well.

Twopenny answered 23/7, 2012 at 23:41 Comment(7)
If it can be confirmed that's really the case, it should be filed as a bug against Android 4.1, since it both contradicts the documentation and, as a moving target, eliminates the usability of the interface in actual products.Statistician
@Chris: Guess it is a bug one can call a feature. Arduino.ccp from adk_release_0512.zip clearly refuses to speak to anything other than protocol 1. Trivial change to print the protocol number presented reveals that JellyBean devices present version 2. release_20120606, though, seems to understand >= 1 - but this will leave in the dust all existing devices conforming to ADK 1.0; good luck fixing firmware on devices already shipped and out of reach. Kinda upsetting to see this lack of foresight from ADK team.Bickford
I think Google are making it pretty clear that they're not overly interested in maintaining the USB interface for ADK. If you watch their presentation at Google IO this year they gave an interesting answer to an audience question. Watch this from 36m30s, youtube.com/watch?v=ZUaKSs3utrsAshanti
@Bickford Are you saying that the problem is only in the reported protocol, that if that is ignored it does work? If that is the case, one could argue the mistake is in the sketch code.Statistician
@Chris: I'm saying that adk_release_0512 will not work with Jelly Bean devices since they present version 2 which it doesn't understand. Didn't have time to see how release_20120606 works (hope to verify today), but in any case it doesn't help devices conforming to adk_release_0512 that are already out of reach.Bickford
AndroidAccessory.cpp:86 is where it breaks in adk_release_0512.Bickford
I'm asking about the difference between JB not understanding protocol version 1, vs the sketch not trying to talk protocol version 1 to it because JB says it supports protocol 2 (but also, implicitly protocol 1). If the first is true, JB fails on backwards compatibility. If the second is true, the sketch was not written with future compatibility in mind.Statistician
U
2

In reply to @Chris Stratton, the issue is the original library was not written with future compatibility in mind.

The original library assumes (by way of the protocol == 1 check in switchDevice()) that future protocol versions will not be backward compatible. It appears from the 20120606 library version (by implication of the revised protocol >= 1 check in switchDevice()) that the intention is now that future library versions are expected to be backward compatible.

Unfortunately this means existing firmware compiled with the original version of the library are not compatible with Jelly Bean devices. The firmware needs to be recompiled with the new library version and re-uploaded to the accessory.

Note also that as I write this there is an error in the documentation where the "ADK package" link in the side bar links to the older library version, not the newer version linked in the body text. (I have added a bug for this: https://code.google.com/p/android/issues/detail?id=35463)

Additional information:

  • Note that http://developer.android.com/tools/adk/aoa2.html#detecting says: "Version 2.0 of the protocol is upwardly compatible, so accessories designed for the original accessory protocol still work with newer Android devices." But this ignores the issue with the original library.

  • Note also that the code in http://developer.android.com/tools/adk/adk.html#start-adk and http://developer.android.com/tools/adk/aoa2.html#detecting both use the protocol >= 1 incantation. (I can't verify this but given the original library didn't use this version of the check I think the ADK2011 documentation has been updated to use the new check.)

Unconscionable answered 25/7, 2012 at 0:12 Comment(0)
G
1

I have managed to run the old ADK with my Jelly Beans device. Here are the details:

  • Running on Mac OS Mountain Lion
  • With Arduino Mega ADK
  • Samsung Galaxy S3 with 4.1.1

Steps:

  1. download darduino-1.0.1-macosx
  2. Empty the Documents/Arduino Folder
  3. Create a folder libraries in it
  4. Download the USB compatibilty files from labs.arduino.cc/uploads/ADK/GettingStarted/ArduinoADK-beta-001.zip.
  5. After unzipping copy the ArduinoADK-beta-001/libraries/UsbHost folder into the libraries folder mentioned above.
  6. Get the AndroidAccessory folder and copy it into libraries. Soory, Ican remember where I got it from. It is necessary so that the code can compile, because in knows what an Accesory is. This folder especially contains the AndroidAccessory.cpp and AndroidAccessory.h
  7. Start Ardoinu and for example upload the code to your board (Please insert # before the includes and definces, code format does not display it):

    include < Max3421e.h > include < Usb.h > include < AndroidAccessory.h > define ARRAY_SIZE 12;

    AndroidAccessory acc("Manufacturer", "Model", "Description", "Version", "URI", "Serial");

    char hello[12] = {'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'};

    void setup() { Serial.begin(115200); // acc.powerOn(); acc.begin(); }

    void loop() {

    if (acc.isConnected()) { for (int i=0; i < 12; i++) { Serial.print(hello[i]); delay(250); }

    Serial.println(); delay(250); } }

    1. When connecting the S3 via USB you should see the output in the Serial Monitor.

Best regards FL

Gielgud answered 4/12, 2012 at 22:42 Comment(0)
R
0

Simply changing the firmware from (protocol==1) check to (protocol>=1) worked for me (at least for enumeration - sending and receiving still needs to be tested). My hardware is LPC1768 mbed. (http://mbed.org/cookbook/mbed-with-Android-ADK)

Respective answered 2/4, 2014 at 17:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.