1. 程式人生 > >Android Adb/Linux/udev/rules for specified user

Android Adb/Linux/udev/rules for specified user

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

[email protected]:~/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

[email protected]:~/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
[email protected]:~/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

[email protected]:~/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"

[email protected]:~/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 
[email protected]:~$ sudo  vim  /etc/udev/rules.d/51-android.rules
[email protected]:~$ 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"
[email protected]:~$ 


######################  Restart adb  
[email protected]:~/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
[email protected]:~/Android$ sudo  android-sdk-linux/platform-tools/adb   kill-server 
[email protected]:~/Android$ sudo  android-sdk-linux/platform-tools/adb  shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
[email protected]:/ $ 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)
[email protected]:/ $