Udev Rule for Android SDK

Either because I have wanted to use adb commands, or actually use the Android SDK, I find that I not only need to install the SDK from: http://developer.android.com/index.html, but also I need to write a udev rule.

One sign that you need a udev rule is when you execute the command, adb devices, you see output something like:

List of devices attached
???????????? device

First, you need to attach the Android phone with the USB cord, and have the Settings, Applications, Development, USB debugging enabled on the phone. Next execute the command, lsusb. In my case, the line I'm interested in shows my phone like this:

Bus 001 Device 005: ID 0bb4:0c9e High Tech Computer Corp.

Notice the hexadecimal digits that I have bolded from this line. They need to be modified to match the digits of the attached phone in a rule file such as /etc/udev/rules.d/51-android.rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c9e", MODE="0666" SYMLINK+="android_adb"

The location and name of this file is very important!

By the way, I found a great blog entry on how to write udev rules today:

1 comment:

Keith Wright said...

While the rule in my post is for my HTC Droid Incredible, here is another rule I added for my girlfriend's LG Ally:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1004", ATTRS{idProduct}=="618e", MODE="0666" SYMLINK+="android_adb"

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.