I'm seeking a way to reorder my gamepads. What I mean is, I have multiple gamepads plugged or wireless and they are affected to /dev/input/js0 (Player 1), /dev/input/js1 (Player 2), ect. and I want to be able to say that one gamepad become /dev/input/js0 (Player 1) and it would switch position with the other gamepad (like on the PS3).

Is there a way with an utility or a command line to do that?

  • This info is quite old but may prove useful: ubuntuforums.org/showthread.php?t=1595666
    – whtyger
    Commented Mar 12, 2016 at 13:26
  • 1
    @whtyger No I don't want to associate one gamepad to a certain jsX, I want to be able to say js0 become jsX and jsX become js0 fast and easly at any given time. Ideally from the controller itselft without having to use a keyboard. Commented Mar 12, 2016 at 14:44
  • I think we can do it with mknode, and some shell scripting. would a panel app work for you as a solultion, or a script that takes user input? Can you show us the output for the devices of ls -l /dev/input/js0 etc?
    – j0h
    Commented Mar 15, 2016 at 19:42

2 Answers 2


There is no way to change device names in /dev directory. Maybe this is not statued for input devices like gamepads. I cant test this because I have no gamepads around.

But this will be necessary for your approach. So, the first answer is: It is impossible.

The second answer is more a hint to a way which may help you to deal with your idea:

As you may assign symbol links to devices using udev rules, maybe you can deal with it that way. I will explain it by means of a usb-stick.

What we do is: - Disconnect the usb stick using a command - create a temporary rule for assigning a symlink - Reconnect the usb stick using a command - delete the temporary rule

For the background read these articles: udev, about udev rules, Authorizing USB devices and sudo echo access denied

As a prerequisite we need some information about the targeting usb stick. Remove the stick and run the command

udevadm monitor

Plug the stick in an you get a lot of information on the screen. I extract the device path on the usb bus from the first line of output:

add      /devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.1 (usb)

With this information run the command

udevadm test /sys/bus/usb/devices/4-1.1

Again there is a lot of output. We are interested in


This is an unique serialnumber to the usb-device.

Now lets give this stick an symlink.

First we have to disconnect our usb stick:

echo 0 | sudo tee /sys/bus/usb/devices/4-1.1/authorized > /dev/null

Now we create a temporary rule for udev:

echo "KERNEL==\"sd?1\", SUBSYSTEMS==\"usb\", ATTRS{serial}==\"08606E5EDA173E6D3F37746D\", SYMLINK+=\"myusb300\"" | sudo tee /etc/udev/rules.d/90-tmp-001.rules > /dev/null

Next step is to reconnect the usb stick:

echo 1 | sudo tee /sys/bus/usb/devices/4-1.1/authorized > /dev/null

Now you find a symlink /dev/myusb300 to /deb/sdb1

The idea behind all this is, even if you can't rename /dev/js0, you can create symlinks, i.e. /dev/js10, to the gamepad controller. This symlinks can be swapped, just on thy fly or by programmatic disconnect and reconnect the controller. The application (the game) itself should be configured to use the gamepads /dev/js10, /dev/js11, and so on.

By the unique serialnumbers of the gamepads you may always assign a specific symlink to a choosen gamepad.

Maybe it is possible to find more possibilities dealing with udev. That depends not only on the concrete solution you are looking for but also on the application, the controllers and other things.


ok, its not a complete solution, but I'm kinda annoyed about the "Theres no way to do it" non-sense.

Right here:

$ sudo mknod /dev/lol b 8 0
$ ls -l /dev/lol
brw-r--r-- 1 root root 8, 0 Mar 15 15:51 /dev/lol
$ sudo rm  /dev/lol
$ ls -l /dev/lol
ls: cannot access /dev/lol: No such file or directory

which says create a block device, with major number 8, minor number 0, named /dev/lol. ls, shows us it is a block device. Then, I deleted it.

what we need to know about your device, is the type: (character or block), permissions, type of input it expects, and such. With the device plugged in,
$ls -l /dev/input/js0 will tell us most of that. It wont tell us if it expects cooked or raw data. Update your question with these details, and I'll try to write a script or something to solve the problem. Rootly power required.

Also, with the controllers connected, show the output of $lsusb

(I'm assuming which ever device is plugged in first, gets enumerated /dev/input/js0 , and that the software isnt doing silly things like explicitly enumerating specific controllers as specific device files)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .