3

I recently purchased an Android phone (my first). This is probably not relevant to the question, but it is a Micromax Canvas Hue AQ5000, running Android 4.4.2.

I want to access the phone from my computer, currently running Debian wheezy. ADB was recommended to me. I installed android-tools-adb, and after enabling Developer Options and USB Debugging, I was able to access the phone via adb shell, for example.

However, ADB does not work as user. Here is the corresponding udev file, /lib/udev/rules.d/70-android-tools-adb.rules.

# Set ACLs for console users on adb USB devices
# d001 recovery
# d002 system

ACTION=="add|change", SUBSYSTEM=="usb", \
  ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="d001|d002", \
  TAG+="uaccess"

How should I modify this file in order to give user access? The natural way seems to be to give access to a group. Along those lines, here is one suggestion,namely an answer to "Android Debug Bridge (adb) device - no permissions" which suggests

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"

So, should I add GROUP="plugdev" to that file above, or is there a better way? Also what does the ATTRS{idVendor}=="18d1" part mean, and would that work for any device? Also, what does ATTRS{idProduct}=="d001|d002" mean?

I'll consider forwarding good suggestions to the Debian Bug Tracker.

1

1 Answer 1

3

On my gentoo system, the following udev rules are setup (in /lib64/udev/rules.d for me):

SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0664", GROUP="android"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="android"

These rules give access to USB android devices (22b8 = Motorola, 0bb4 = HTC, 04e8 = Samsung and 18d1 = Google) to anyone in the android group.

The name of the group you decide to use is unimportant as long as your user is a member of that group.


To address your other questions on the USB identifers, the vendor and product ids identify specific devices. You can see your identifiers using dmesg or lsusb. E.g. when I plug in my phone, dmesg reports:

[ 4573.116303] usb 4-5: New USB device found, idVendor=22b8, idProduct=2e63

and lsusb reports:

Bus 004 Device 005: ID 22b8:2e63 Motorola PCS

which tell me that my phone has a vendor id of 22b8 and product id 2e63. The udev rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="android"

will match this device (and all motorola phones since it is not constrained by a product id) and set permissions on the USB device for this phone to:

crw-rw-r--+ 1 root android 189, 388 May  5 19:38 /dev/bus/usb/004/005

You can find your usb device to check its permissions using the usb bus and device number. lsusb reported Bus 004 Device 005 and the device path contains .../004/005. As long as you can read/write to this device you will be able to use adb and other programs that require access to the phone.

Caveat: device naming could be slightly different on your system. I'm running udev 215 and linux kernel 4.0.1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .