Android Adb/Linux/udev/rules for specified user

版权声明:hushui版权所有 https://blog.csdn.net/hushui/article/details/83413668

### This is a HTC Android phone connected to Linux/X86 host

lake@localhost:~/Android$ lsusb

................
Bus 003 Device 010: ID 0bb4:0cac HTC (High Tech Computer Corp.)   ************
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

lake@localhost:~/Android/android-sdk-linux$ ./platform-tools/adb  shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
error: insufficient permissions for device
See [http://developer.android.com/tools/device.html] for more information
lake@localhost:~/Android/android-sdk-linux$ sudo  ./platform-tools/adb  shell
[sudo] password for lake: 
error: insufficient permissions for device
See [http://developer.android.com/tools/device.html] for more information

lake@localhost:~/Android$ cat   /etc/udev/rules.d/51-android.rules 
# udev rules file for Android 
## copy to /etc/udev/rules.d/51-android.rules

# Update 2013 04 22 
#
#
# RK3066 android normal 
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", OWNER="lake", GROUP="sys"
# RK3066 recovery mode usb connection  / Google Nexus7
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", OWNER="lake", GROUP="sys"

lake@localhost:~/Android$ lsusb

................
Bus 003 Device 010: ID 0bb4:0cac HTC (High Tech Computer Corp.)   ************
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

######################  Update 
lake@localhost:~$ sudo  vim  /etc/udev/rules.d/51-android.rules
lake@localhost:~$ cat /etc/udev/rules.d/51-android.rules 
# udev rules file for Android 
## copy to /etc/udev/rules.d/51-android.rules

# Update 2013 04 22 for HTC phone 
#
#
# RK3066 android normal 
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", OWNER="lake", GROUP="sys"
# RK3066 recovery mode usb connection  / Google Nexus7
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", OWNER="lake", GROUP="sys"
# HTC G11
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0cac", OWNER="lake", GROUP="sys"
lake@localhost:~$ 


######################  Restart adb  
lake@localhost:~/Android$ sudo  android-sdk-linux/platform-tools/adb  shell
error: insufficient permissions for device
See [http://developer.android.com/tools/device.html] for more information
lake@localhost:~/Android$ sudo  android-sdk-linux/platform-tools/adb   kill-server 
lake@localhost:~/Android$ sudo  android-sdk-linux/platform-tools/adb  shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
shell@android:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats)
shell@android:/ $ 

 

扫描二维码关注公众号,回复: 3999659 查看本文章

猜你喜欢

转载自blog.csdn.net/hushui/article/details/83413668
今日推荐