Debug in Nexus one Android Usb Accessory Mode
When we use Nexus one in Usb Accessory Mode , we should turn off the adb mode in the phone. or the Usb Accessory can not access.
Does anybody know if the adb mode turned off , how can we debug the apk ? I tried Remote debug . failed.
Google sdk said : 0x2D00 is reserved for Android-powered devices that support accessory mode. 0x2D01 is reserved for devices that support accessory mode as well as the ADB (Android Debug Bridge) protocol, which exposes a second interface with two bulk endpoints for ADB. You can use these endpoints for debugging the accessory app开发者_JAVA技巧lication if you are simulating the accessory on a computer. In general, do not use this interface unless your accessory is implementing a passthrough to ADB on the device.
But How can we activate the Nexus one with PID 2D01 ? My Nexus one only works with 2D00
Add a Reference Here: http://developer.android.com/guide/topics/usb/adk.html#determine
I too am trying to debug an Android Accessory Mode (ADK) device while it is connected to a Nexus S phone. Although I have not been able to debug my hardware I have found it useful to use a Linux system as the Accessory Mode device. This allows the use of usbmon and Wireshark to observe the underlying protocol.
If anyone has a way to debug Android-to-Accessory communication without buying a USB Protocol Analyzer (www.openvizsla.org) please help.
Nexus-Computing GmbH's (android.serverbox.ch/?p=262) simplectrl.c (Linux-side) and UsbTest (Android-side) were invaluable and the basis for the following:
What to do under Ubuntu 11.04 to capture USB traffic:
1) Enable usbmon:
mount -t debugfs none_debugs /sys/kernel/debug
sudo modprobe usbmon
2) Install Wireshark and helper programs:
sudo apt-get -y install flex bison wireshark libusb-dev libusb-1.0-0-dev
apt-get source libusb
3) Download and install libpcap, (www.tcpdump.org/release/libpcap-1.1.1.tar.gz)
tar xvf libpcap-1.1.1.tar.gz
cd libpcap-1.1.1
./configure
make
sudo make install
4) Connect your Android device to your Linux system and make sure it is connected:
?/android-sdk/platform-tools/adb devices
5) Compile and upload the USBTest App onto your Android device using eclipse (developer.android.com/sdk/installing.html) or your preferred method. You need Google APIs 2.3.3 installed. I have updated simplectrl and UsbTest with some bug fixes to make sure they work out of the box. They are available on the LUFA Library Support List (groups.google.com/group/lufa-support/msg/2e6d76c92d9e828a) as an attachment.
6) Determine the correct USB Bus to capture. lsusb
will output something like:
Bus 001 Device 057: ID 18d1:4e22 Google Inc.
The above means that your Android device is on Bus 001
.
7) Start Wireshark with root privileges and select the appropriate capture interface:
gksudo wireshark
8) Connect your Linux system to your Android device and run simplectrl
:
rm ./simplectrl; gcc simplectrl.c -I/usr/include/ -o simplectrl -lusb-1.0 -I/usr/include/ -I/usr/include/libusb-1.0
9) Example Wireshark capture session of simplectrl-to-USBTest communication is available as an attachment on the LUFA Library Support List (groups.google.com/group/lufa-support/msg/8c740dfa58a1d1fd).
If you want to stream usbmon captured data you can do the following:
1) list usbmon interfaces: sudo ls -laR /sys/kernel/debug/usb/usbmon/
2) use lsusb
to list connected devices. Output will be something like:
Bus 001 Device 057: ID 18d1:4e22 Google Inc.
3) The above means that your Android device is on Bus 001
so you should capture data from bus 1:
sudo sudo cat /sys/kernel/debug/usb/usbmon/1u
*Note Bus 0 captures all buses. The u
defines the output format of the data. For more information read (www.kernel.org/doc/Documentation/usb/usbmon.txt).
Debugging USB Accessory through wifi seems only possible on Nexus devices (I used Nexus 7 and Nexus 7 2013). I tried many others (Samsung's, Motorola), they don't detect accessory when USB debugging is enabled in settings. Also tried hardware usb switcher - does not help.
If you are looking for this kind of information,
Nexus one not showing in DDMS problem
And also take a look at my answer there.
精彩评论