首页 > 代码库 > ubuntu ???????????? no permissions 问题解决

ubuntu ???????????? no permissions 问题解决

近期的一个项目须要用到linux开发android程序! 发现ubuntu有小米开发连接不上!  搞了一个下午才搞成功! 看看吧!

小米手机利用USB连接到Ubuntu 10.04系统。执行以下的命令:

rico@ricopad:~$ lsusb

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 002: ID 17ef:1003 Lenovo 

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 003: ID 046d:c06c Logitech, Inc. 

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 003: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 005: ID 18d1:9025  

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

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

rico@ricopad:~$ lsusb

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 002: ID 17ef:1003 Lenovo 

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 003: ID 046d:c06c Logitech, Inc. 

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 003 Device 003: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

对照发现,Bus 001 Device 005: ID 18d1:9025   就是小米手机的


sudo gedit  /etc/udev/rules.d/53-android.rules在打开的文件里添加?下面文本:
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="685e", SYMLINK+="android_adb"
sudo chmod a+rx /etc/udev/rules.d/53-android.rules
rico@ricopad:/etc/udev/rules.d$ sudo service udev restart    //or restart udev

udev start/running, process 7147

在 android sdk 的 tools 文件夹下执行 (这一步非常重要,必需要sudo,否则没效果)

rico@ricopad:~/star2011/SDK/android-sdk-linux/platform-tools$ sudo ./adb kill-server

rico@ricopad:~/star2011/SDK/android-sdk-linux/platform-tools$ sudo ./adb devices

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

* daemon started successfully *

List of devices attached 

然后,就能够直接用adb  shell操作了.也能够用Eclipse来调试。


---------------------------------------------------------------------------------------------------------------------------------------------

近期发现了一个更好用的方法在此贡献出来


在/etc/udev/reles.d 目录下新建51-android.rules 文件  写入 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0666"

保存对出就能够了 以后仅仅要插上手机就会自己主动连接了 

 

ubuntu ???????????? no permissions 问题解决