Ubuntu12.04不能连接小米开发

小米手机利用USB连接到Ubuntu 12.04系统。运行下面的命令:

longskywang@bjb0503:~$ 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:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 001 Device 004: ID 138a:0008 Validity Sensors, Inc. VFS300 Fingerprint Reader
Bus 002 Device 007: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 002 Device 008: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 002 Device 025: ID 0461:4d22 Primax Electronics, Ltd 
Bus 002 Device 005: ID 0c45:6481 Microdia 
Bus 001 Device 005: ID 413c:8161 Dell Computer Corp. Integrated Keyboard
Bus 001 Device 006: ID 413c:8162 Dell Computer Corp. Integrated Touchpad [Synaptics]
Bus 002 Device 028: ID 2717:904e  
Bus 001 Device 007: ID 413c:8160 Dell Computer Corp. Wireless 365 Bluetooth

 

拔掉手机的USB连接线,再运行:

longskywang@bjb0503:~$ 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:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 001 Device 004: ID 138a:0008 Validity Sensors, Inc. VFS300 Fingerprint Reader
Bus 002 Device 007: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 002 Device 008: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 002 Device 025: ID 0461:4d22 Primax Electronics, Ltd 
Bus 002 Device 005: ID 0c45:6481 Microdia 
Bus 001 Device 005: ID 413c:8161 Dell Computer Corp. Integrated Keyboard
Bus 001 Device 006: ID 413c:8162 Dell Computer Corp. Integrated Touchpad [Synaptics]
Bus 001 Device 007: ID 413c:8160 Dell Computer Corp. Wireless 365 Bluetooth

 

对比发现,Bus 002 Device 028: ID 2717:904e    就是小米手机的

 

sudo gedit  /etc/udev/rules.d/51-android.rules在打开的文件中增加以下文本,没有就创建一个:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="seven"

 

sudo chmod a+rx /etc/udev/rules.d/50-android.rules

 


longskywang@bjb0503:/etc/udev/rules.d$ sudo service udev restart    //or restart udev

udev start/running, process 7147

在 android sdk 的 tools 目录下运行 (这一步很重要,必须要sudo,否则没效果)

 (有时会出现 no permission的情况)

longskywang@bjb0503:~/android-sdk/platform-tools$ sudo ./adb kill-server

longskywang@bjb0503:~/android-sdk/platform-tools$ sudo ./adb devices

* daemon not running. starting it now on port 5037 *

* daemon started successfully *

List of devices attached 

到这一步了,结果发现 List of devices attached 下面没有设备出现,这就意味着 adb不识别新的USB 设备,纠结了。

 

如果跟我一样悲惨,请执行如下操作

longskywang@bjb0503:~$ cd ~
longskywang@bjb0503:~$ cd .android/

longskywang@bjb0503:~/.android$ ls
adbkey       adb_usb.ini~     avd       debug.keystore     repositories.cfg
adbkey.pub   androidtool.cfg  cache     default.keyset     sites-settings.cfg
adb_usb.ini  androidwin.cfg   ddms.cfg  modem-nv-ram-5554

请注意这个 adb_usb.ini(如果没有,可以自己建立一个)

longskywang@bjb0503:~/.android$ gedit adb_usb.ini

里面的内容一般如下:

# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.

 

我们在其中加一行

# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2717

 

请注意,这个 0x2717 就是我们得到的设备号码

 

保存,关掉,然后

longskywang@bjb0503:~/android-sdk/platform-tools$ sudo ./adb kill-server

longskywang@bjb0503:~/android-sdk/platform-tools$ sudo ./adb devices

List of devices attached 
9109ce53 &n


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值