Fedora配置usb驱动支持adb

If you're developing on Ubuntu Linux, you need to add a udev rules file that contains a USB configuration for each type of deviceyou want to use for development. In the rules file, each device manufactureris identified by a unique vendor ID, as specified by theATTR{idVendor} property. For a list of vendor IDs, see USB Vendor IDs, below. To set up device detection onUbuntu Linux:

  1. 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"

    In this example, the vendor ID is for HTC. The MODEassignment specifies read/write permissions, and GROUP defineswhich Unix group owns the device node.

    Note: The rule syntaxmay vary slightly depending on your environment. Consult the udevdocumentation for your system as needed. For an overview of rule syntax, seethis guide to writing udevrules.

  2. Now execute:
    chmod a+r /etc/udev/rules.d/51-android.rules
  3. 如何查看device id,root帐号运行lsusb

[root@zlf rules.d]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 413c:2107 Dell Computer Corp.
Bus 001 Device 004: ID 192f:0416 Avago Technologies, Pte.

Bus 002 Device 005: ID 22b8:41da Motorola PCS        

其中红色一行是我们要的目标设备信息,按照步骤a的格式添加到android.rules的配置文件中即可

         d.  重起adb,adb需要配置对应的PATH环境变量,把sdk中对应的platform-tools目录加到PATH环境变量即可



下面是网上别人在ubantu的一篇博文

sdk文档上有推荐方法是:

1. 新建 /etc/udev/rules.d/51-android.rules,该文件内容可模仿下面的内容:

# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600",OWNER=="username"

这个是让系统识别Nexus One android机器的内容,如果要加你自己的机器,只要知道你目标机的 VendorId, ProductId即可。

2. 如何得到VendorId, ProducId?将目标机用usb与电脑相连,在命令行窗口输入lsusb,即可显示与本机相连的所有usb设备。如:

michelle@michelle-ThinkPad-Edge:~$ lsusb

Bus 002 Device 007: ID 0489:c001 Foxconn / Hon Hai

Bus 002 Device 003: ID 17ef:4815 Lenovo Integrated Webcam [R5U877]

其中 Bus 002 Device 007: ID 0489:c001 Foxconn / Hon Hai
是我的android设备. 它的VendorId是0489,ProductId是c001。

3.在 /etc/udev/rules.d/51-android.rules文件中加入刚才lsusb中查到的内容既可。如:

# adb protocol on FM6 (Foxconn FM6)
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", ATTR{idProduct}=="c001", MODE="0666", OWNER="michelle"

这里的OWNER就是你登录ubuntu的用户。

4. 在命令行执行

sudo chmod a+rx 51-android.rules
sudo service udev restart

这样就重启了udev service,让刚才新加的51-android.rules生效

5.执行

adb kill-server

adb devices

即可看到找到对应的设备,adb可用。

6. 如果这样做后还是不能连上adb, 则要在 ~/.android 目录下的adb_usb.ini文件中添加你所查到的设备的vendor id. 如本例中 vendorID = 0489, 则在该文件下添加一行:

0x0489

7.然后重新执行步骤5即可


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值