landeel
April 21st, 2008, 01:21 AM
http://www.mediafire.com/?msitbdej0ad
http://ubuntuforums.org/attachment.php?attachmentid=66632&d=1208782381
This is patched version of the jscal utility from the joystick package. It will allow the remapping of buttons and axes directly into the driver.
It's compiled for Ubuntu 7.10 AMD64, but you can recompile it to any version by doing a "make clean;make"
I have been looking for something like this for ages. Found it here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444142
I have many joypads / joysticks with many different button layouts, and by using this utility I can reconfigure the button layout by running a simple script, intead of reconfiguring every game and emulator everytime I want to use a different joystick.
Hope you find it useful.
Quoting the patch author:
Package: joystick
Version: 20051019-1
Severity: wishlist
Tags: patch
Motivation
I found no simple tool that would remap the joystick axes
and buttons on the device driver level (joydev module), while the driver
clearly provides the interface for this. My patch extends to
capabilities of jscal in order to remap axes and buttons. While
remapping in the X configuration file is possible, that mapping does not
seem to help in all games.
Detail
I bought a Trust GM-2550 Predator joystick the other day, and I noticed
that the axes were mapped incorrectly: the throttle in place of the
rudder, and the pinky button's axes were shifted up 1 slot in the axis
map. I found no tool to re-map the axes on the device driver (joydev)
level. While remapping is possible in the X config, this did not solve
the problem for - for example - SearchAndRescue.
Also I found no way to remap joystick buttons on the device driver
level. This is quite necessary for example for tuxkart, because some of
the buttons the game uses are unfortunately unreachable while holding
the joystick comfortably (some buttons are too far on the stick).
I found that the joydev kernel module does provide the API for axes and
button remapping. I added two command line options to jscal and two
corresponding functions that utilize the API and remap buttons and axes.
I have tested the axes and button remapping, and it works as intended. I
can swap buttons and axes as I wish.
Implementation
Please find the diff of jscal.c in joystick attached (joystick.diff).
The modified jscal.c adds two command line arguments:
-q --print-mappings Print the current axis and button
mappings as a jscal command line
and
-u <n_of_axes,axmap1,axmap2,...,
n_of_buttons,btnmap1,btnmap2,
...> --set-mappings Sets axis and button mappings to the
specified values
An example output of -q looks like this (./jscal -q /dev/input/js0):
jscal -u
10,0,1,2,5,6,16,17,40,41,42,13,288,289,290,291,292 ,293,294,295,296,297,298,299,300
/dev/input/js0
The joystick has 10 axes and 13 buttons. If now one is to switch axes 2
and 5 (to get the rudder and the throttle right), one has to execute:
jscal -u
10,0,1,5,2,6,16,17,40,41,42,13,288,289,290,291,292 ,293,294,295,296,297,298,299,300
/dev/input/js0
changing 2,5 to 5,2 on the line.
Remapping buttons is done the same way.
http://ubuntuforums.org/attachment.php?attachmentid=66632&d=1208782381
This is patched version of the jscal utility from the joystick package. It will allow the remapping of buttons and axes directly into the driver.
It's compiled for Ubuntu 7.10 AMD64, but you can recompile it to any version by doing a "make clean;make"
I have been looking for something like this for ages. Found it here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444142
I have many joypads / joysticks with many different button layouts, and by using this utility I can reconfigure the button layout by running a simple script, intead of reconfiguring every game and emulator everytime I want to use a different joystick.
Hope you find it useful.
Quoting the patch author:
Package: joystick
Version: 20051019-1
Severity: wishlist
Tags: patch
Motivation
I found no simple tool that would remap the joystick axes
and buttons on the device driver level (joydev module), while the driver
clearly provides the interface for this. My patch extends to
capabilities of jscal in order to remap axes and buttons. While
remapping in the X configuration file is possible, that mapping does not
seem to help in all games.
Detail
I bought a Trust GM-2550 Predator joystick the other day, and I noticed
that the axes were mapped incorrectly: the throttle in place of the
rudder, and the pinky button's axes were shifted up 1 slot in the axis
map. I found no tool to re-map the axes on the device driver (joydev)
level. While remapping is possible in the X config, this did not solve
the problem for - for example - SearchAndRescue.
Also I found no way to remap joystick buttons on the device driver
level. This is quite necessary for example for tuxkart, because some of
the buttons the game uses are unfortunately unreachable while holding
the joystick comfortably (some buttons are too far on the stick).
I found that the joydev kernel module does provide the API for axes and
button remapping. I added two command line options to jscal and two
corresponding functions that utilize the API and remap buttons and axes.
I have tested the axes and button remapping, and it works as intended. I
can swap buttons and axes as I wish.
Implementation
Please find the diff of jscal.c in joystick attached (joystick.diff).
The modified jscal.c adds two command line arguments:
-q --print-mappings Print the current axis and button
mappings as a jscal command line
and
-u <n_of_axes,axmap1,axmap2,...,
n_of_buttons,btnmap1,btnmap2,
...> --set-mappings Sets axis and button mappings to the
specified values
An example output of -q looks like this (./jscal -q /dev/input/js0):
jscal -u
10,0,1,2,5,6,16,17,40,41,42,13,288,289,290,291,292 ,293,294,295,296,297,298,299,300
/dev/input/js0
The joystick has 10 axes and 13 buttons. If now one is to switch axes 2
and 5 (to get the rudder and the throttle right), one has to execute:
jscal -u
10,0,1,5,2,6,16,17,40,41,42,13,288,289,290,291,292 ,293,294,295,296,297,298,299,300
/dev/input/js0
changing 2,5 to 5,2 on the line.
Remapping buttons is done the same way.