User Tools

Site Tools


cs:linux_any_to_x360c

This is an old revision of the document!


go back

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.

xboxdrv

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:

  1. Find the evdev controller name.
  2. Find how evdev calls the various joystick actions.
  3. Tell xboxdrv how the various joystick actions map in the virtual Xbox controller.
  4. Save the configuration in a script or ini file to set up easily the controller in the future.

Find the controller name

  1. $ ls /dev/input/by-id/
  2. Plug the joystick
  3. $ 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.
  4. $ 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.

Find how evdev calls the various joystick actions

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

Configure xboxdrv

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.

cs/linux_any_to_x360c.1740895763.txt.gz · Last modified: 2025/03/02 06:09 by paolo_bolzoni