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?
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.
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.
I have emailed Samsung support and am awaiting a reply.
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.