This is an old revision of the document!
In Windows one can use x360ce a good way to remap buttons and axis in a virtual 360 controller.
But in Linux, even in wine, the option seems out of the question.
In theory one can use the dll based x360ce version (i.e., version3) in wine (installing with winetricks
dotnet45
and corefonts
) to create the dll file and its ini configuration file; these could be dropped in the game exe directory and used. However I never manage to make it work, and this option it not available to native programs.
https://github.com/xiota/xboxdrv
xboxdrv
as driver for Xbox 360 controllers is considered obsolete and replaced by the kernel drivers xpad
, but it still works fine to read input to an emulated Xbox controller and it is the point of this page.
Unfortunately, it is not as straightforward as x360ce where one has a nice picture of the controller, clicks on the the pictures of the buttons or axis and moves the real controller to map to it.
In xboxdrv
the process is more manual, but at least it has to be done once per controller.
Universal Controller Calibration and Mapping Using ''xboxdrv'' - another text on the argument.
There are 4 steps:
$ ls /dev/input/by-id/
$ ls /dev/input/by-id/
- again and see the new input devices, if there are more than one related to the joystick prefer the one with the word event
in it. As example we assume /dev/input/by-id/usb-0810_usb_gamepad-event-joystick
.$ file /dev/input/by-id/usb-0810_usb_gamepad-event-joystick
will return something like /dev/input/event4
, that's the name of the device.
Call evtest /dev/input/event4
, press each button, move each axis, and write down the BTN_
and ABS_
values the system sees.
Here is an example:
X=BTN_TOP Y=BTN_TOP2 Z=BTN_PINKIE A=BTN_TRIGGER B=BTN_THUMB C=BTN_THUMB2 START=BTN_BASE4 BACK=BTN_BASE3 ABS_Y=0-127-255 ABS_X=0-127-255
Starting from a command like the following, adapt to your needs.
sudo xboxdrv --silent --dbus disable --detach-kernel-driver \ --evdev /dev/input/event4 \ --mimic-xpad \ --axismap -Y1=Y1 \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_THUMB=a,BTN_THUMB2=b,BTN_TOP2=x,BTN_PINKIE=y,BTN_TRIGGER=lb,BTN_TOP=rb,BTN_BASE3=back,BTN_BASE4=start
Of course the manual page is a good reference: man xboxdrv
.