Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
331 views
in Technique[技术] by (71.8m points)

android - How can I get the ADK DemoKit example working on a Google I/O Galaxy Tab 10.1?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...