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?

1 Answer 1


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.

  • Is is possible to generalize this to work with any gamepad, regardless of the vendor/model? Also, why do I have to add myself to "plugdev"?
    – fouric
    Commented Oct 14, 2013 at 16:08
  • @InkBlend "plugdev" group has access to the external devices, and this could work with any gamepad, you just have to add the necessary attributes to your "/etc/udev/rules.d/69-gamepad.rules" file
    – lenik
    Commented Oct 14, 2013 at 23:29
  • Sorry, what I meant was "Is it possible to create a single rule that applies to all gamepads?". Also, because I end up setting the permissions to 666 anyway, doesn't that mean that I don't need to either change the group to "plugdev" or add myself to that same group?
    – fouric
    Commented Oct 15, 2013 at 0:53
  • basically you need to specify different rule for every gamepad, because though it's possible to omit "Vendor" or "Product" fields, you generally don't want your digicam or keyboard or mouse or WiFi dongle to be mistakenly treated as gamepad.
    – lenik
    Commented Oct 15, 2013 at 2:45
  • Well, doesn't the file "69-gamepad.rules" only apply to gamepads?
    – fouric
    Commented Oct 15, 2013 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.