ADB, Fastboot and USB permissions

2011-06-08 04:53 by Ian

You will at some point need to be able to use ADB with a device attached to USB. Unless you are sinning, and working as root, you will be denied permission to do this. Here is a quick guide for fixing it. This guide is intended for android tinkering, but will apply to any USB device.

First, plug in your device. Then run the command “lsusb”. You should get output that looks similar to this…

You will need to make an educated guess about which device on the USB bus is your android device. In this case, it’s pretty obvious. But if you have many peripherals attached, it might be more difficult. If you are unsure, unplug your device, run lsusb again, and find the missing entry. That will be your device. Note the 32-bit hex number (22b8:70a9). The vendorId is the 16-bit hex number on the left-hand side of the colon. The productId is the right-hand number. Every USB device in existence will have a unique number of this sort.

Now… we need to edit the permissions for the udev daemon to allow non-root users to communicate with this device directly. Edit the appropriate udev file…

My file looks like this:

Please note that there are several entries for each model. The convention in the android world seems to be that there are different USB identifiers for each mode that the device can be in. The bootloader (fastboot) will need a different rule than the operating mode (ADB). To find the bootloader vendor:product, you will need to enter the bootloader and run lsusb again.

Replace the values as appropriate. Once you save it, add your user as a member of the “plugdev” group, if it isn’t already. Then restart the udev service with this command:

You should now be able to talk to the USB port without being root.

Now… Ensure that the device is listening. In android, go to…
Settings -> Applications -> Development
...and enable USB Debugging.

Once you’ve done that, test everything by running…

If you were successful, you should see something like this:

Previous:
Next: