USB API (host mode)
Hi,
During the last two weeks I've been trying to do some simple USB communication using my Xoom (MZ601) as USB host. This have proven to be harder than I expected and my latest theory is that the USB API not activated on my tablet.
My simplest test app just tries to enumerate USB devices and is as follows:
I added this to my AndroidManifest.xml:
Code:
...
<uses-sdk android:minSdkVersion="12" />
<uses-feature android:name="android.hardware.usb.host" />
...
My activity looks like:
Code:
public class USBFinderActivity extends Activity
{
private static final String TAG = "USB Finder";
private UsbManager mManager;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mManager = (UsbManager)getSystemService(Context.USB_SERVICE);
Log.i(TAG, "Manager is: " + mManager.toString());
Log.i(TAG, "Device are: " + mManager.getDeviceList().toString());
for (UsbDevice device : mManager.getDeviceList().values())
{
Log.i(TAG, "Device: " + device.toString());
}
}
}
But all I get is:
Code:
D/USB Finder( 3157): Manager is: android.hardware.usb.UsbManager@407646e0
D/USB Finder( 3157): Device are: {}
I have tried this together with my mouse, USB-memory headset and HTC Desire in combination with the following ROMs: Stock 3.1, Stock + Rooted 3.2.2, Tiamat 2.1-Hammerhead and Tiamat 2.2.2-Moray, but the result is the same.
Some other tests I've done are: - USB-mouse works out of the box for all the different ROM:s.
- USB-memorys work good with Tiamat ROM:s.
- USB-headset shows up in logcat, dmesg and lsusb at least.
- Connecting the Xoom to my HTC Desire and run AdbTest without success
- Testing the market app USB Device Info. Devices show up under the Linux tab, but the Android Tab say "No devices detected".
I've spent a lot of time searching information. I'm not alone with this problem. There are more people who has the same problem, while others get it to work directly. I can not see any connection to why it works for some and others not. It's spread over different makes, models and versions.
So if anyone out there got some experience or information about this, feel free to post. I'm starting to run out of debugging ideas.
|