How can I get the ADK DemoKit example working on a Google I/O Galaxy Tab 10.1?
Asked Answered
J

4

5

I'm trying to get the DemoKit example working on an ADK board. It seems like even with the 3.1 update the Galaxy Tab doesn't have everything it needs (or at least doesn't work as advertised). And even with digging though the documentation it seems like the Samsung Kies app is possibly getting in the way.

It won't run if I use the API Level 10 Libraries as instructed (stepping through the debugger I see this exception: java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager). The same thing happens if I use the API Level 12 Libraries.

Setting the target to be the 3.1 platform (simply changing it in the project properties) it won't compile (due to use of the com.android.future.usb library). I found some documentation of some changes that you have to do to use the USB package on 3.1 and from that, these are the changes I made to DemoKitActivity.java

37,38c37
< import com.android.future.usb.UsbAccessory;
< import com.android.future.usb.UsbManager;
---
> import android.hardware.usb.*;
128c127
< UsbAccessory accessory = UsbManager.getAccessory(intent);
---
> UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
139c138
< UsbAccessory accessory = UsbManager.getAccessory(intent);
---
> UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
152c151
< mUsbManager = UsbManager.getInstance(this);
---
> mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);

Even after making those changes I've been running into issues though. It installs now and the initial screen for the DemoKit app comes up with the "Please connect a DemoKit board", but whenever I connect the ADK board and turn off USB debugging (with it on it, it does nothing), I just get the Samsung Kies app which says "Press the home key to quit Samsung Kies" and no other buttons respond. Hitting home and going back into the DemoKit app just shows the connect screen again and it never really connects to the board.

How can this be made to work? Does the ADK work with the Galaxy Tab 10.1 (Google I/O edition) and if so, am I on the right track?

UPDATE

Here's what the Arduino serial monitor says regardless if debug mode is on or off on the tablet (need to set the baud rate to 115200 to read the output):

Device addressed... Requesting device descriptor.

found possible device. swithcing to serial mode

Data packet error: 5could not read device protocol version

It repeats constantly while it's plugged in to the tablet.

UPDATE 2

I realized I didn't update the AndroidManifest.xml file... Changing:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="11" />

to

<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" />

and

<uses-library android:name="com.android.future.usb.accessory"/>

to

<uses-feature android:name="android.hardware.usb.accessory"/>

It didn't seem to change anything once I got that corrected.

UPDATE 3

I have emailed Samsung support and am awaiting a reply.

Japhetic answered 15/6, 2011 at 8:32 Comment(0)
B
6

My apologies, accessory mode currently doesn't work with the Samsung Galaxy Tab 10.1. Samsung is aware of the issue and is working on resolving it. When the device does support accessory mode you should be able to use the com.android.future.usb.* APIs which will make it easier for you to write an app that works both with Android 3.1 and 2.3.4.

Birch answered 20/6, 2011 at 22:18 Comment(1)
While Samsung is getting its act together, ICS is available for the Tab 10.1 and Accessory Mode works fine. androidcommunity.com/…Alyse
F
3

I just got the new TouchWiz update and now the Arduino reads this back to the serial port:

Device addressed... Requesting device descriptor.found possible device. swithcing to serial mode
device supports protcol 1

Device addressed... Requesting device descriptor.found android acessory device
config desc
interface desc
inEp: 1
outEp: 2

This is looking much better. The Galaxy Tab asks to run DemoKit, I hit OK, and it force quits. This better than it was previously.

I will update if I get it working fully.

Florilegium answered 10/8, 2011 at 4:55 Comment(2)
And I got it working now! Woohoo! Update did wonders. Talking back and forth to the Arduino ADK (Freeduino)Florilegium
Can you please list how did you do the update on Samsung Galaxy 10.1 tab? Is it the usual System update?Worldshaking
Z
1

Are you sure you are using the right build target? Instead of regular "Android 2.3.3" (level 10) or "Android 3.1" (level 12), you should use "Google APIs" targets. If you run "Android SDK and AVD Manager", you can find them under Available Packages > Third party add-ons > Google Inc > "Google APIs by Google Inc., Android API 10" (or 12).

Zarathustra answered 19/6, 2011 at 0:27 Comment(1)
Yep. Tried setting the target to all of them. Level 10 API, the Level 12 API, and then altering things and using the 3.1 platform as the build target. None of them seem to work.Japhetic
W
1

My Galaxy Tab 10.1 on Android 3.1 didn't have the accessories API as a backport as well. So I got the following exception as well:

java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager

One way to bringing it to work on the Tab 10.1 with Android 3.1 is to use the regular accessory API. Not the backported version. You can set your DemoKit projects target SDK to the regular API level 12 (Android 3.1).

In addition you have to change the code passages in the DemoKitActivity to get the UsbManager and the UsbAccesory to:

UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);

imports change to:

import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbManager;

The Android manifest can still contain the following entry but it is not required anymore:

<uses-library android:name="com.android.future.usb.accessory" />
Waller answered 6/1, 2012 at 12:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.