参考 原文链接:https://blog.csdn.net/qq_31180471/article/details/104486102
1)问题现象:
ator@atorpc:~/workspace$ adb devices
List of devices attached
1234567 no permissions
解决方案:
1. lsusb
以下是我的输出(当前连的是小米手机)
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 062a:0000 Creative Labs Optical mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 007: ID 18d1:9025 Google Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
注意上面输出的蓝色一行:
Bus 001 Device 007: ID 18d1:9025 Google Inc.
创建rules文件
sudo vi/etc/udev/rules.d/51-android.rules
在末尾增加文件内容:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="9025", MODE="0600"
保存后给予权限:
sudo chmod a+rx/etc/udev/rules.d/51-android.rules
sudo /etc/init.d/udev restart 或者 sudo restartudev
插拔USB 数据线
sudo ./adb kill-server
sudo ./adb start-server
sudo ./adb devices
2)问题现象:
ator@atorpc:~/workspace$ fastboot devices
no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]fastboot
解决方案:
Know the USB Vendor Id and Product Id of your android device using lsusb command as,
$ lsusb
Bus 001 Device 019: ID 2e04:c008
As seen above, For Our mobile idVendor is 2e04 and idProduct is c008, add this details to udev rule as, [ Replace idVendor and idProduct as per your device ]
$ sudo vim /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="2e04", ATTR{idProduct}=="c008", MODE="0666", GROUP="plugdev"
$ sudo udevadm control --reload-rules
$ adb kill-server
插拔USB 数据线
$ adb devices
————————————————