# Sticky  uDev Rules for Any Device! (No more starting adb with sudo)



## dustinmj

Ok, so I was hopping along the bunny trail... and realized, nobody has ever posted a set of uDev rules for Ubuntu that work with any device and Ubuntu version > 7.10... (up until now, there's udev results for specific devices, some wrong, some crazy, none all together)... so, I though I'd do the honor









Here's the low down, read and complete all of the steps before telling me it doesn't work, please.


*First, remove any rules you already set up for your Android Device (If any), they'll be very obvious if you look in /etc/udev/rules.d/*



Code:


sudo ls /etc/udev/rules.d/


Now, open an editor for the rules at /etc/udev/rules.d/99-android.rules:



Code:


gksudo gedit /etc/udev/rules.d/99-android.rules


Now, paste all of the rules below:



Code:


#Acer<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"<br />
#Dell<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"<br />
#Foxconn<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"<br />
#Garmin-Asus<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"<br />
#Google<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"<br />
#HTC<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"<br />
#Huawei<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"<br />
#Kyocera<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"<br />
#LG<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"<br />
#Motorola<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"<br />
#Nvidia<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"<br />
#Pantech<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"<br />
#Samsung<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"<br />
#Sharp<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"<br />
#Sony Ericsson<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"<br />
#ZTE<br />
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"


Save and close the file.
Change the file permissions:


Code:


sudo chmod a+r /etc/udev/rules.d/99-android.rules


 Now, unplug all Android Devices...
 Restart the udev service:


Code:


sudo service udev restart


 Kill and restart adb:


Code:


adb kill-server




Code:


adb start-server


Done... you should now be able to work with a device from almost any manufacturer. Plug your phone in to test.

If you're unable to start adb from a command line anywhere (without sudo), you've been lazy with your setup (I am too at times)... you may want to scan my "Dev Box Setup" series of blog posts.

At any rate, just wanted to share these udev rules.

-Dustin


----------



## birdman

This is hands down the most useful thing anyone could have done. Awesome work


----------



## dustinmj

birdman said:


> This is hands down the most useful thing anyone could have done. Awesome work


Thanks bro


----------



## ChainsDD

Great post! This will solve a lot of devs issues. Thank you!


----------



## P3Droid

great info, i'm going to miss typing sudo all the time, LOL, actually i'm not.


----------



## parkjam

Great info, thanks!


----------



## mwaters33

I've been trying to get this to work for 2 days and need help.

If I type lsusb it displays my device, but adb devices returns a blank. No?????? or anything about permissions (I set udev rules already anyway). It just acts like the device isn't there. USB debugging is on, I checked that repeatedly.


----------



## dustinmj

mwaters33 said:


> I've been trying to get this to work for 2 days and need help.
> 
> If I type lsusb it displays my device, but adb devices returns a blank. No?????? or anything about permissions (I set udev rules already anyway). It just acts like the device isn't there. USB debugging is on, I checked that repeatedly.


Based on your explanation, I'm at a loss for answers... I'm going to open up a support thread for my Blog Series, you may wish to post in there and see if anyone else has an answer for you.


----------



## Sniffle

so glad i don't have to support my original how-to guide anymore  it is a lot of work to keep up with it all. you guys are doing a great job!


----------



## JASKRU

Thanks for posting this as well as your dev box guide. Great to see people sharing information.


----------



## Tahl

Updated udev rules according to Google as of 8/14/2011:



Code:


#Acer<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0502, MODE=0666<br />
#ASUS<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0b05, MODE=0666<br />
#Dell<br />
SUBSYSTEM==usb, SYSFS{idVendor}==413c, MODE=0666<br />
#Foxconn<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0489, MODE=0666<br />
#Garmin-Asus<br />
SUBSYSTEM==usb, SYSFS{idVendor}==091E, MODE=0666<br />
#Google<br />
SUBSYSTEM==usb, SYSFS{idVendor}==18d1, MODE=0666<br />
#HTC<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0bb4, MODE=0666<br />
#Huawei<br />
SUBSYSTEM==usb, SYSFS{idVendor}==12d1, MODE=0666<br />
#K-Touch<br />
SUBSYSTEM==usb, SYSFS{idVendor}==24e3, MODE=0666<br />
#KT Tech<br />
SUBSYSTEM==usb, SYSFS{idVendor}==2116, MODE=0666<br />
#Kyocera<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0482, MODE=0666<br />
#Lenevo<br />
SUBSYSTEM==usb, SYSFS{idVendor}==17EF, MODE=0666<br />
#LG<br />
SUBSYSTEM==usb, SYSFS{idVendor}==1004, MODE=0666<br />
#Motorola<br />
SUBSYSTEM==usb, SYSFS{idVendor}==22b8, MODE=0666<br />
#NEC<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0409, MODE=0666<br />
#Nook<br />
SUBSYSTEM==usb, SYSFS{idVendor}==2080, MODE=0666<br />
#Nvidia<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0955, MODE=0666<br />
#OTGV<br />
SUBSYSTEM==usb, SYSFS{idVendor}==2257, MODE=0666<br />
#Pantech<br />
SUBSYSTEM==usb, SYSFS{idVendor}==10A9, MODE=0666<br />
#Philips<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0471, MODE=0666<br />
#PMC-Sierra<br />
SUBSYSTEM==usb, SYSFS{idVendor}==04da, MODE=0666<br />
#Qualcomm<br />
SUBSYSTEM==usb, SYSFS{idVendor}==05c6, MODE=0666<br />
#SK Telesys<br />
SUBSYSTEM==usb, SYSFS{idVendor}==1f53, MODE=0666<br />
#Samsung<br />
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666<br />
#Sharp<br />
SUBSYSTEM==usb, SYSFS{idVendor}==04dd, MODE=0666<br />
#Sony Ericsson<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0fce, MODE=0666<br />
#Toshiba<br />
SUBSYSTEM==usb, SYSFS{idVendor}==0930, MODE=0666<br />
#ZTE<br />
SUBSYSTEM==usb, SYSFS{idVendor}==19D2, MODE=0666


----------



## PalmerCurling

The Setting-Up-a-Dev-Box series has gone 404.... can y'all bring it back? I am getting a new computer soon, and i do *not* want to try to have to remember how i hacked it together on my box now....

The uDev stuff here has been fantastic! thank you very much!


----------



## colonel panic

Awesome! This finally fixed my ADB issues. I wish it had been the first thing that came up in Google!


----------



## Lothinator

Can't seem to get this to work on Linux Mint 11...

Set up the rules, set permissions, etc. Checked "lsusb" and the device exists on the USB connection as:
_Bus 001 Device 007: ID 0bb4:6860 High Tech Computer Corp. _

which is ID 0bb4, that does exist in the rules file.

Yet, I still get the error:
_List of devices attached _

_???????????? no permissions_

Have tried everything.... Restarted Udev, double and triple checked the permissions file and permissions on the file, restarted the entire computer, etc.

It works if I start ADB with root, but the whole point is to not have to do that!

Any ideas anyone?


----------



## aorth

This is a clever idea... thanks.

By the way, the SYSFS syntax is deprecated in favor of ATTRS. You can safely replace them and everything will still work.


----------



## hazard209

PalmerCurling said:


> The Setting-Up-a-Dev-Box series has gone 404.... can y'all bring it back? I am getting a new computer soon, and i do *not* want to try to have to remember how i hacked it together on my box now....
> 
> The uDev stuff here has been fantastic! thank you very much!


I would also like to see the "Setting Up a Dev Box" series. Anyone have it by chance?


----------



## DrMacinyasha

Just to help things out, I've made a little script you can run to quickly and easily add the udev rules. Just run the following:



Code:


sudo su -<br />
wget [URL=http://goo.im/devs/drmacinyasha/wiki/udev-adder.sh]http://goo.im/devs/drmacinyasha/wiki/udev-adder.sh[/URL]; chmod a+x udev-adder.sh; ./udev-adder.sh; rm udev-adder.sh


----------



## jellybellys

Lothinator said:


> Can't seem to get this to work on Linux Mint 11...
> 
> Set up the rules, set permissions, etc. Checked "lsusb" and the device exists on the USB connection as:
> _Bus 001 Device 007: ID 0bb4:6860 High Tech Computer Corp. _
> 
> which is ID 0bb4, that does exist in the rules file.
> 
> Yet, I still get the error:
> _List of devices attached _
> 
> _???????????? no permissions_
> 
> Have tried everything.... Restarted Udev, double and triple checked the permissions file and permissions on the file, restarted the entire computer, etc.
> 
> It works if I start ADB with root, but the whole point is to not have to do that!
> 
> Any ideas anyone?


In the same boat, except I used to have them setup on ubuntu 11.10, then upgraded to 12.04 and lost them. Tried setting them up again, but I am in the same boat as you.

Edit: Hmmm... still getting no permissions when starting with sudo even


----------



## shurane

So 3 things.

1. The OP should update the first post with the updated list that Tahl put up.
2. Is there a difference between SYSFS{idVendor}==1949 and SYSFS{idVendor}=="1949", that is, with the quotes around the number? Just pointing it out.
3. There should also be an entry for the Amazon Kindle Fire. Here is the udev rule:



Code:


<br />
#Amazon<br />
SUBSYSTEM==usb, SYSFS{idVendor}==1949, MODE=0666<br />


----------

