Udev rules are not working for libusb on Ubuntu 12.04

不问归期 提交于 2019-12-04 16:11:40

Unless you have a really old udev, the rule is wrong, it should be :

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="da77", GROUP="plugdev"

Putting the rule in a file in /etc/udev/rules.d/ is the correct way to make it permanent.

Other things you can put in a rule file are in the man page.

OK here are all the steps to get this to work. I had problems with all responses I found online, bits and pieces everywhere without any certain order and no single working solution, (running Android Studio, Jmonkey 3D, and Ubuntu 14.04)

If adb devices shows android device as ????????? (no permissions) follow these instructions:

1) create file /etc/udev/rules.d/51-android.rules

sudo gedit /etc/udev/rules.d/51-android.rules

2) copy and paste contents below:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666", GROUP="plugdev"    
SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666", GROUP="plugdev"  
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666", GROUP="plugdev" 

3) Run the following command to change file permissions:

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

4) connect your phone via usb and run the following command:

lsusb

Look for your device(s) Example (Nexus 5):

Bus 003 Device 074: ID 18d1:4ee7 Google Inc.

For Nexus 5, Vendor ID is 18d1, mine is on Bus "003"

5) Now reload the rules with the following commands:

sudo udevadm control --reload-rules
sudo service udev restart
sudo udevadm trigger

6) Verify device is now allowing plugdev user group access

ls -l /dev/bus/usb/<bus number from step 4>

Example:

ls -l /dev/bus/usb/003

crw-rw-rw- 1 root plugdev 189, 329 Jul  3 18:23 074

7) Run adb devices to confirm permissions are correct and enjoy!

Note: if you haven't created the plugdev group and added your user name to it (if permission denied prepend "sudo" following commands):

1) add plugdev group:

groupadd plugdev

2) add your username to plugdev group (useradd -G {group-name} username):

useradd -G plugdev billy

3) restart udev (you may need to log off and log back in to update user group):

sudo service udev restart

I am also working in more or less the same thing and to do the reload I have the same problem using that function, but if you were to use

udevadm trigger

It will actually reload the rules Also, I don't know if you already did so, I think you have to add the users to the group you created

Sometimes, the user is not part of the group that was granted access by the udev rules. To add the (existing) user, to (existing) group plugdev, you should do this:

sudo usermod -a -G groupName userName
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!