参考博客:点击打开链接

安装adb工具

sudo apt-get install android-tools-adb

确认手机usb的ID

zhouyixing@T6Series:/etc/udev/rules.d$ lsusb
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 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 011: ID 17ef:7513 Lenovo 
Bus 002 Device 008: ID 15d9:0a4e Trust International B.V. 
Bus 002 Device 005: ID 5986:0182 Acer, Inc

配置usb

新建/etc/udev/rules.d/51-android.rules文件并添加如下内容:

SUBSYSTEM=="usb|usb_device", SYSFS{idVendor}=="17ef", MODE="0660",GROUP="plugdev"  
SUBSYSTEM=="usb|usb_device", ATTR{idVendor}=="17ef", ATTR{idProduct}=="7513", SYMLINK+="android_adb"


注意, ATTR{idVendor}=="17ef"和ATTR{idProduct}=="7513"必须与自己的手机USB ID对应。


测试


查看是否能正确识别设备(笔者的手机为高通入门级四核处理器MSM8625QSKUD


zhouyixing@T6Series:/etc/udev/rules.d$ sudo adb kill-server

zhouyixing@T6Series:/etc/udev/rules.d$ sudo adb devices
List of devices attached 
MSM8625QSKUD device


连接手机(确认已经开启usb调试模式)

zhouyixing@T6Series:/etc/udev/rules.d$ sudo adb kill-server
zhouyixing@T6Series:/etc/udev/rules.d$ sudo adb shell
shell@android:/ $

切换根权限

shell@android:/sbin # su root



Logo

更多推荐