2008-04-13 12:09:02 -06:00
|
|
|
[[ XBox/XBox360 USB Gamepad Driver for Userspace ]]
|
|
|
|
===================================================
|
2008-04-11 05:43:15 -06:00
|
|
|
|
2008-04-13 14:21:19 -06:00
|
|
|
This is a XBox/XBox360 gamepad driver for Linux that works in userspace. It
|
2008-04-11 05:43:15 -06:00
|
|
|
is a alternative to the xpad kernel driver.
|
|
|
|
|
|
|
|
|
|
|
|
[[ Compilation ]]
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
Required libraries and tools:
|
|
|
|
|
|
|
|
* libusb
|
|
|
|
* boost
|
|
|
|
* scons
|
|
|
|
* uinput
|
|
|
|
|
|
|
|
You can compile by typing:
|
|
|
|
|
|
|
|
% scons
|
|
|
|
|
|
|
|
|
|
|
|
[[ Running ]]
|
|
|
|
--------------
|
|
|
|
|
|
|
|
First make sure that the xpad kernel module does not get loaded,
|
|
|
|
either by deleting or renaming it. rmmod might not be enough since it
|
|
|
|
might be automatically loaded.
|
|
|
|
|
2008-04-13 12:09:02 -06:00
|
|
|
Next you have to load the uinput kernel module, which allows userspace
|
|
|
|
programms to create input devices, via:
|
|
|
|
|
|
|
|
% modprobe uinput
|
|
|
|
|
|
|
|
You also have to make sure that you have access rights to
|
|
|
|
/dev/input/uinput, either add yourself to the appropriate group,
|
2008-04-13 14:21:19 -06:00
|
|
|
adjust the permissions or run xboxdrv as root.
|
2008-04-13 12:09:02 -06:00
|
|
|
|
|
|
|
Once ensured that xpad is out of the way and everything is in palce
|
|
|
|
plug in your XBox360 gamepad and start the userspace driver with:
|
2008-04-11 05:43:15 -06:00
|
|
|
|
2008-04-13 14:21:19 -06:00
|
|
|
% ./xboxdrv
|
2008-04-11 05:43:15 -06:00
|
|
|
|
|
|
|
This will create a /dev/input/js0 and allow you to access the gamepad
|
2008-04-13 12:09:02 -06:00
|
|
|
from any game. To exit the driver press Ctrl-c.
|
2008-04-11 05:43:15 -06:00
|
|
|
|
2008-04-11 13:03:43 -06:00
|
|
|
If you have multiple controllers you need to start multiple instances
|
2008-04-13 14:21:19 -06:00
|
|
|
of the xboxdrv driver and append the -i argument like this:
|
2008-04-11 13:03:43 -06:00
|
|
|
|
2008-04-13 14:21:19 -06:00
|
|
|
% ./xboxdrv -i 1
|
2008-04-11 13:03:43 -06:00
|
|
|
|
2008-04-13 08:43:30 -06:00
|
|
|
This will then use the second detected controller, see to see which id
|
|
|
|
your controller has:
|
2008-04-11 13:03:43 -06:00
|
|
|
|
2008-04-13 14:21:19 -06:00
|
|
|
% ./xboxdrv --list-controller
|
2008-04-11 13:03:43 -06:00
|
|
|
|
2008-04-13 08:43:30 -06:00
|
|
|
If you want to abuse the led or rumble of the gamepad for notification
|
|
|
|
in scripts you can do see via:
|
|
|
|
|
2008-04-13 14:21:19 -06:00
|
|
|
% ./xboxdrv --led 10 --rumble 30,30 --quit
|
2008-04-13 08:43:30 -06:00
|
|
|
|
|
|
|
This will cause a mild rumble and the led to rotate, you can stop it
|
|
|
|
again via:
|
|
|
|
|
2008-04-13 14:21:19 -06:00
|
|
|
% ./xboxdrv -q
|
2008-04-13 08:43:30 -06:00
|
|
|
|
2008-04-11 13:03:43 -06:00
|
|
|
|
2008-04-11 07:33:11 -06:00
|
|
|
[[ SDL Notes ]]
|
|
|
|
---------------
|
|
|
|
|
|
|
|
To let SDL know which axis act as a hat and which act as normal axis
|
|
|
|
you have to set an environment variable:
|
|
|
|
|
|
|
|
% SDL_LINUX_JOYSTICK="'XBox360 Gamepad (userspace driver)' 6 1 0"
|
|
|
|
% export SDL_LINUX_JOYSTICK
|
|
|
|
|
2008-04-11 19:49:33 -06:00
|
|
|
This will let the DPad act as Hat in case you need that for any
|
|
|
|
game. For most games the driver should work as-is.
|
2008-04-11 07:33:11 -06:00
|
|
|
|
|
|
|
See ftp://ptah.lnf.kth.se/pub/misc/sdl-env-vars for more information.
|
|
|
|
|
2008-04-13 08:56:31 -06:00
|
|
|
|
2008-04-11 05:43:15 -06:00
|
|
|
# EOF #
|