如何在Ubuntu的USB连接与亚行的Android设备 [英] How to usb-connect android devices with adb under ubuntu
问题描述
其他可能在Ubuntu Linux操作系统遇到的问题与亚行的调试。
Other may have experienced problems with adb debugging under ubuntu linux.
症状是USB连接的Android设备如可用性与月食。 您可能会测试这个
The symptom is the availability of usb connected android devices e.g. with eclipse. You may test this with
adb usb
当你得到
error: insufficient permissions for device
您可能会遇到像我同样的问题。 但是,我发现在互联网上的一些或多或少的次优解决方案
you probably run into the same problem like me. However, I found on the internet some more or less sub optimal solutions
其基本思想是启动亚行根。我发现的解决方案是累赘。
The basic idea is to start adb as root. The solutions I found were cumbersome.
一个建议是开始,亚行每须藤。另外一个建议是建立在/etc/init.d引导脚本
One proposal is to start adb per sudo. An other proposal was to set up a boot script in /etc/init.d
我的解决办法是给亚洲开发银行开始以root的权限。要做到这一点,切换到root
My solution is to give adb the permission to start as root. To do so, switch to root
sudo bash
chown root adb
chmod ug+s-w adb
安全爱好者可以提出
security fanatics may propose
sudo chown root adb
sudo chmod ug+s-w adb
如果亚行已经在运行,你需要杀死恶魔,开始用root权限
If adb is already running you need to kill the demon to start with root permission
adb kill-server
当一切都正确
adb usb
应该返回
restarting in USB mode
如果没有,请尝试第的lsusb检查您的设备是否已连接
if not, try lsusb th check whether your device is already connected
推荐答案
在谷歌推荐的方式来处理与亚行设备权限是创建一个udev规则这将在设备枚举设置相应的权限。
The Google recommended way to deal with ADB device permissions is to create an UDEV rule which would set appropriate permissions on device enumeration.
按<一个href="http://developer.android.com/tools/device.html">http://developer.android.com/tools/device.html
如果您正在开发的Ubuntu Linux操作系统,你需要添加一个udev规则 文件,其中包含一个USB配置为每种类型的设备你 要用发展。在规则文件中,每个设备 制造由唯一的供应商ID识别,所指定的 ATTR {idVendor}财产。对于供应商ID的列表,请参阅USB厂商ID, 下面。要设置设备检测在Ubuntu Linux:以root身份登录,并 创建这个文件:/etc/udev/rules.d/51-android.rules。使用此格式 添加每个供应商的文件:SUBSYSTEM ==USB, ATTR {idVendor} ==0BB4,MODE =0666,GROUP =plugdev
If you're developing on Ubuntu Linux, you need to add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs, below. To set up device detection on Ubuntu Linux: Log in as root and create this file: /etc/udev/rules.d/51-android.rules. Use this format to add each vendor to the file: SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
在这个例子中,供应商ID是对于HTC。该模式分配 指定读/写权限和组定义哪个Unix组 拥有该设备节点。注:该规则的语法可能会略有不同 根据您的环境。咨询的udev文档您 系统需要。对于规则语法的概述,请参阅本指南 书写udev规则。现在执行的:chmod a + R /etc/udev/rules.d/51-android.rules当通过USB插上,可以 请验证您的设备是从执行ADB设备连接 你的SDK平台工具/目录下。如果连接时,你会看到 设备名称列为设备。
In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node. Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules. Now execute: chmod a+r /etc/udev/rules.d/51-android.rules When plugged in over USB, can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected, you'll see the device name listed as a "device."
这篇关于如何在Ubuntu的USB连接与亚行的Android设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!