Remapping an axis on a gamepad to a button on Ubuntu

1

I am trying to use an Xbox 360 MadCatz FightPad on Ubuntu 13.04. The main problem is that two of the buttons, corresponding to the left and right triggers on the Xbox controller, are registering as analog joysticks. While the triggers are analog on a traditional Xbox controller, their only real purpose on this gamepad is to act as buttons.

So far, I have not been able to find any utility that would allow me to remap the axis to gamepad buttons. Qjoypad can only be used to map the controller buttons to keyboard or mouse sequences. There does not appear to be an option to make the mapping in jstest-gtk, either. xboxdrv has the --trigger-as-button option, but it does not recognize the controller as an Xbox controller or even as a compatible controller (which, itself, is odd because the controller works fine on the Xbox).

Michael

Posted 2013-10-06T04:49:23.663

Reputation: 361

Answers

1

After fiddling around with this a little bit more, I was finally able to get it to work. First off, using antimicro or qjoypad worked fine to map the controller to the keyboard commands and use the "keyboard" from within the game. As an observation, this did not always work well in terms of sensitivity.

I eventually got it to work without emulating a keyboard or mouse with xboxdrv. As I noted above, xboxdrv does not detect the controller as being a valid Xbox controller. Instead, I first had to determine the USB device ID by hand, using lsusb.

% lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 10f1:1a34 Importek 
Bus 002 Device 042: ID 1bad:f02e Harmonix Music

After a little trial and error I determined the last item in the list to be my device. I was then able to use this in the following command:

xboxdrv --device-by-id 1bad:f02e --type xbox360 --trigger-as-button --detach-kernel-driver --no-extra-events

Michael

Posted 2013-10-06T04:49:23.663

Reputation: 361