在 Nexus one Android USB 配件模式下调试

发布于 2024-11-27 01:20:27 字数 520 浏览 5 评论 0原文

当我们在USB配件模式下使用Nexus one时,我们应该关闭手机中的adb模式。或者 USB 附件无法访问。

有谁知道如果adb模式关闭,我们如何调试apk? 我尝试了远程调试。失败的。

谷歌 SDK 说: 0x2D00 保留给支持配件模式的 Android 设备。 0x2D01 是为支持配件模式以及 ADB(Android 调试桥)协议的设备保留的,该协议公开了带有两个 ADB 批量端点的第二个接口。如果您在计算机上模拟附件,则可以使用这些端点来调试附件应用程序。一般来说,除非您的配件正在设备上实现 ADB 直通,否则不要使用此接口。

但是我们如何激活 PID 为 2D01 的 Nexus 呢?我的 Nexus 仅适用于 2D00

在此处添加参考: http://developer.android.com/guide/topics/usb/adk .html#确定

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 application 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

放我走吧 2024-12-04 01:20:27

我也尝试在连接到 Nexus S 手机时调试 Android 配件模式 (ADK) 设备。虽然我无法调试我的硬件,但我发现使用 Linux 系统作为附件模式设备很有用。这允许使用 usbmonWireshark 来观察底层协议。

如果有人有办法在不购买 USB 协议分析器 (www.openvizsla.org) 的情况下调试 Android 到配件的通信,请提供帮助。

Nexus-Computing GmbH 的 (android.serverbox.ch/?p=262) simplectrl.c(Linux 端)和 UsbTest(Android 端)非常宝贵,是以下内容的基础

:在 Ubuntu 11.04 下捕获 USB 流量:

1) 启用 usbmon:

mount -t debugfs none_debugs /sys/kernel/debug

sudo modprobe usbmon

2) 安装 Wireshark 和帮助程序:

sudo apt-get -y install flex bisonwireshark libusb-dev libusb-1.0-0-dev

apt-get source libusb code>

3) 下载并安装 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) 将您的 Android 设备连接到 Linux 系统并确保其已连接:

?/android-sdk/platform-tools/adb devices

5) 编译 USBTest 应用程序并将其上传到您的使用 eclipse 的 Android 设备(developer.android.com/sdk/installing.html) 或您喜欢的方法。您需要安装 Google API 2.3.3。我更新了 simplectrl 和 UsbTest,修复了一些错误,以确保它们开箱即用。它们可以作为附件在 LUFA 库支持列表 (groups.google.com/group/lufa-support/msg/2e6d76c92d9e828a) 上找到。

6) 确定要捕获的正确 USB 总线。 lsusb 将输出类似以下内容:

Bus 001 Device 057: ID 18d1:4e22 Google Inc.

以上表示您的 Android 设备位于 Bus 001 上。

7) 以 root 权限启动 Wireshark 并选择适当的捕获接口:

gksudowireshark

8) 将 Linux 系统连接到 Android 设备并运行 simplectrl

rm ./简单控件; gcc simplectrl.c -I/usr/include/ -o simplectrl -lusb-1.0 -I/usr/include/ -I/usr/include/libusb-1.0

9) simplectrl-to- 的 Wireshark 捕获会话示例USBTest 通信作为 LUFA 库支持列表中的附件提供(groups.google.com/group/lufa-support/msg/8c740dfa58a1d1fd)。


如果您想流式传输 usbmon 捕获的数据,可以执行以下操作:

1) 列出 usbmon 接口:sudo ls -laR /sys/kernel/debug/usb/usbmon/

2) 使用 lsusb< /code> 列出已连接的设备。输出将类似于:

Bus 001 Device 057: ID 18d1:4e22 Google Inc.

3) 以上表示您的 Android 设备位于 Bus 001 上,因此您应该捕获数据来自总线 1:

sudo sudo cat /sys/kernel/debug/usb/usbmon/1u

*注意总线 0 捕获所有总线。 u 定义数据的输出格式。有关更多信息,请阅读 (www.kernel.org/doc/Documentation/usb/usbmon.txt)。

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).

一个人的旅程 2024-12-04 01:20:27

通过 wifi 调试 USB 配件似乎只能在 Nexus 设备上进行(我使用的是 Nexus 7 和 Nexus 7 2013)。我尝试了许多其他产品(三星、摩托罗拉),当在设置中启用 USB 调试时,它们不会检测配件。还尝试了硬件 USB 切换器 - 没有帮助。

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.

北城孤痞 2024-12-04 01:20:27

如果您正在寻找此类信息,

Nexus one 未显示在 DDMS 问题

,还可以看看我的答案。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文