0

I have a gamepad that I am interested in using with the Pi. When I plug it into my development laptop running Lubuntu 13.04, I get the following:

418476 crw-rw-r--+ 1 root root 13,  0 Oct 12 22:55 js0

However, when I plug the same gamepad into the Pi, I get this:

5188 crw-rw---T 1 root input 13,  0 Oct 13 06:01 js0

I am able to both change the group of the device and the permissions, but whenever the gamepad is unplugged and then reinserted it defaults back to what is shown above. How do I preserve permissions for a device file after it has been removed?

fouric
  • 1,809
  • 4
  • 18
  • 26

1 Answers1

3

you should use lsusb command to find the device manufacturer and product code like this:

$ lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 002: ID 045e:0047 Microsoft Corp. IntelliMouse Explorer 3.0
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
$

For example, I can see my mouse has ID 045e:0047, then add the line to the /etc/udev/rules.d/69-gamepad.rules:

ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0047", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev"

replacing the Vendor and Product numbers with the ones you've found with lsusb command.

Finally, you have to add yourself to the group 'plugdev':

sudo adduser user plugdev

where user is your user name (use who to find out if unsure).

After that you might need reboot, relogon or just reinsert your device depending on the settings you've changed.

lenik
  • 11,533
  • 2
  • 32
  • 37