87 lines
1.8 KiB
Text
87 lines
1.8 KiB
Text
[[ XBox360 USB Gamepad Driver for Userspace ]]
|
|
==============================================
|
|
|
|
This is a XBox360 gamepad driver for Linux that works in userspace. It
|
|
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.
|
|
|
|
Once ensured that xpad is out of the way plug in your XBox360 gamepad
|
|
and start the userspace driver:
|
|
|
|
% ./xbox360
|
|
|
|
This will create a /dev/input/js0 and allow you to access the gamepad
|
|
from any game. To exit the driver press Ctrl-c twice
|
|
|
|
If you have multiple controllers you need to start multiple instances
|
|
of the xbox360 driver and append the -i argument like this:
|
|
|
|
% ./xbox360 -i 1
|
|
|
|
This will select the second controller, also see:
|
|
|
|
% ./xbox360 --list-controller
|
|
|
|
|
|
[[ 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
|
|
|
|
This will let the DPad act as Hat.
|
|
|
|
See ftp://ptah.lnf.kth.se/pub/misc/sdl-env-vars for more information.
|
|
|
|
[[ LED Commands ]]
|
|
------------------
|
|
|
|
You can set the LED via:
|
|
|
|
% ./xbox360 --led NUM
|
|
|
|
Valid values for NUM:
|
|
|
|
0: off
|
|
1: all blinking
|
|
2: 1/top-left blink, then on
|
|
3: 2/top-right blink, then on
|
|
4: 3/bottom-left blink, then on
|
|
5: 4/bottom-right blink, then on
|
|
6: 1/top-left on
|
|
7: 2/top-right on
|
|
8: 3/bottom-left on
|
|
9: 4/bottom-right on
|
|
10: rotate
|
|
11: blink
|
|
12: blink slower
|
|
13: rotate with two lights
|
|
14: blink
|
|
15: blink once
|
|
|
|
# EOF #
|