2

I already managed to map the input of a joystick to keyboard inputs by writing a file in my xorg.conf.d/ directory (the file is named 51-joystick.conf).

Now I would like to map the inputs of a second joystick (same model) to use them together. So I wrote a second file in xorg.conf.d/; roughly the same content, only differing by device path and mapping.

Unfortunately, it doesn't work this way:

  • if I call the file for the second joystick 51-joystick2.conf, no joystick work any more

  • if I call the file for the second joystick 52-joystick2.conf, only the second one works

Can someone explain me how to proceed?

edit: the content of 51-joystick.conf is

Section "InputClass"
    Identifier "Joystick 1 mapping"
    Option "device" "/dev/input/js0"
    Option "path" "/dev/input/js0"
    Option "StartKeyEnabled" "False"
    Option "StartMouseEnabled" "False"
    #MatchIsJoystick on
    #Option "MapAxis1" "keylow=113 keyhigh=114"
    #Option "MapAxis2" "keylow=111 keyhigh=116"
    Option "MapButton1" "key=52"
    Option "MapButton2" "key=53"
    Option "MapButton3" "key=38"
    Option "MapButton4" "key=39"
    Option "MapButton5" "key=40"
    Option "MapButton6" "key=54"
    Option "MapButton7" "key=14"
    Option "MapButton8" "key=10"
EndSection

edit (11/03/15): - both of my joysticks are shown with the command xinput ; each of them have two entries (two different IDs) and are marked as slave to the keyboard. The four entries have exactly the same name ("Logitech Gamepad F310 (keys)") - if I give a higher number to the config file of the first joystick ("52-joystick1.conf" and "51-joystick2.conf"), only the first joystick's inputs are mapped to keyboard inputs

  • this is now what is written to the xorg log when I plug the first joystick

  • this is now what is written to the xorg log when I plug the second joystick

I note that in both cases, InputClasses "Joystick 1" and "Joystick 2" seems to be applied to the two joysticks, and in the end, only the mapping to /dev/input/js0 is applied.

  • Could you share the contents of your joystick configuration files? – Stephen Kitt Mar 9 '15 at 21:36
  • I suspect it is a precedence issue: see man xorg.conf.d "When the same information is supplied in more than one way, the highest precedence mechanism is used." – jasonwryan Mar 9 '15 at 21:48
  • if two joystick mappings on two different paths are considered as the same information, is it actually possible to map the inputs of two different joysticks with xorg config files afterall? – SLakx Mar 11 '15 at 6:50
0

I got this idea from using controller mate on osx...

Map both in the same config. You may want to change the keyboard mappings so they don't both have the same key press, or you can actually change the input type to an HID class input that your system supports. Either way, if you have multiple configs, only one will be used. Run a check to see if js1 is on, if not, use config 1 with only js0, otherwise use config with both mapped.

Section "InputClass"
Identifier "Joystick 1 mapping"
    Option "device" "/dev/input/js0"
    Option "path" "/dev/input/js0"
    Option "StartKeyEnabled" "False"
    Option "StartMouseEnabled" "False"
    #MatchIsJoystick on
    #Option "MapAxis1" "keylow=113 keyhigh=114"
    #Option "MapAxis2" "keylow=111 keyhigh=116"
    Option "MapButton1" "key=52"
    Option "MapButton2" "key=53"
    Option "MapButton3" "key=38"
    Option "MapButton4" "key=39"
    Option "MapButton5" "key=40"
    Option "MapButton6" "key=54"
    Option "MapButton7" "key=14"
    Option "MapButton8" "key=10"
Identifier "Joystick 2 mapping"
    Option "device" "/dev/input/js1"
    Option "path" "/dev/input/js1"
    Option "StartKeyEnabled" "False"
    Option "StartMouseEnabled" "False"
    #MatchIsJoystick on
    #Option "MapAxis1" "keylow=113 keyhigh=114"
    #Option "MapAxis2" "keylow=111 keyhigh=116"
    Option "MapButton1" "key=52"
    Option "MapButton2" "key=53"
    Option "MapButton3" "key=38"
    Option "MapButton4" "key=39"
    Option "MapButton5" "key=40"
    Option "MapButton6" "key=54"
    Option "MapButton7" "key=14"
    Option "MapButton8" "key=10"
EndSection
  • Please review the help files about how to format posts. – Tom Zych Jan 1 '16 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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