More docu

This commit is contained in:
Ingo Ruhnke 2009-01-07 07:07:42 +01:00
parent bcfbf595ed
commit 4a3e3973ce
5 changed files with 108 additions and 34 deletions

2
NEWS
View file

@ -1,4 +1,4 @@
xboxdrv 0.4 - (??/Jan/2009)
xboxdrv 0.4 - (08/Jan/2009)
===========================
* added --square-axis option

View file

@ -79,7 +79,7 @@ Interface 0:
Interface 1:
Endpoint 3(in): Headset mic
Endpoint 4(out): Headset phone
Endpoint 5(in): UNKNOWN (maybe headset)
Endpoint 5(in): UNKNOWN
Endpoint 5(out): Information comes in when Headset gets plugged in
Interface 2:
Endpoint 6(in): Chatpad
@ -213,11 +213,11 @@ usb_control_msg()'s
| '------------ request
| | ,-------- value
v v v v-- index
0x41 0x0 0x8 0x02 # light capslock
0x41 0x0 0x9 0x02 # light square
0x41 0x0 0xa 0x02 # light circle
0x41 0x0 0xb 0x02 # light people
0x41 0x0 0xc 0x02 # light backlight leds
0x41 0x0 0x08 0x02 # light capslock
0x41 0x0 0x09 0x02 # light square
0x41 0x0 0x0a 0x02 # light circle
0x41 0x0 0x0b 0x02 # light people
0x41 0x0 0x0c 0x02 # light backlight leds
0x41 0x0 0x11 0x02 # light capslock
0x41 0x0 0x12 0x02 # light square
0x41 0x0 0x13 0x02 # light square and capslock

62
README
View file

@ -5,14 +5,16 @@ This is a Xbox/Xbox360 gamepad driver for Linux that works in
userspace. It is an alternative to the xpad kernel driver and has
support for Xbox1 gamepads, Xbox360 USB gamepads and Xbox360 wireless
gamepads. The Xbox360 guitar and some Xbox1 dancemats might work too.
The Xbox 360 racing wheel is not supported, but shouldn't be to hard
to add if somebody is interested.
The Xbox360 chatpad does currently not work and the headset does
neither. There has been some work on reverse enginiering, but no
usable results.
This driver is only of interest if the xpad kernel driver doesn't work
for you or if you want some more configurabity, if the xpad kernel
driver works for you there is no need to try this driver.
for you or if you want more configurabity. If the xpad kernel driver
works for you there is no need to try this driver.
Newest version of the driver can be found at:
@ -34,7 +36,7 @@ Required libraries and tools:
* uinput (userspace input kernel module)
* git (only to download the development version)
Once installed, you can compile by typing:
Once everything installed, you can compile by typing:
% scons
@ -54,9 +56,14 @@ slightly different.
[[ Running XboxDrv ]]
---------------------
First make sure that the xpad kernel module is not loaded, either by
deleting, renaming it or blacklisting it. rmmod might not be enough
since it might be automatically loaded again.
Plug in your Xbox360 gamepad and then unload the xpad driver via:
% rmmod xpad
If you want to permanently unload it add the following line to
/etc/modprobe.d/blacklist:
blacklist xpad
Next you have to load the uinput kernel module which allows userspace
programms to create input devices and the joydev module which gives
@ -70,7 +77,7 @@ You also have to make sure that you have access rights to
adjust the permissions or run xboxdrv as root.
Once ensured that xpad is out of the way and everything is in place
plug in your Xbox360 gamepad and start the userspace driver with:
start the userspace driver with:
% ./xboxdrv
@ -116,7 +123,7 @@ This will cause a mild rumble and the led to rotate, you can stop it
again via, which also happens to be the command you can use to stop
your Xbox360 controller from blinking:
% ./xboxdrv -q
% ./xboxdrv ---led 0 --rumble 0,0 --quit
For rumble to work make sure you have connected the controller to a
USB port that has enough power, i.e. an unpowered USB hub might not
@ -147,17 +154,19 @@ given frequency in miliseconds:
Combining --autofire with button map allows you to have one button act
as autofire while another one, emitting the same signal, acts normally.
% ./xboxdrv --autofire B=250 --buttonmap B=A
[[ Relative Axis Mapping ]]
The function --relative-axis allows you to change the behaviour of an
axis so that your movement of it moves its value up or down instead of
applying it instantly. This is mostly useful for flightsim games that
applying it directly. This is mostly useful for flightsim games that
make use of a throttle control, which you can emulate by using the
relative axis mapping. Since the axis might be upside down, you might want
to use the --axismap function to reverse it.
relative axis mapping. Since the axis might be upside down, you might
want to use the --axismap function to reverse it.
% ./xboxdrv --relative-axis y2=64000
% ./xboxdrv --relative-axis y2=64000 --axismap -y2=y2
[[ Button Remapping ]]
----------------------
@ -202,7 +211,8 @@ If you want to swap the left and right stick start with:
Possible axis names are: x1, y1, x2, y2, lt, rt
Swaping lt or rt with x1, y1, x2, y2 will not work properly.
Swaping lt or rt with x1, y1, x2, y2 will not work properly, since
their range is different.
[[ UInput Mapping ]]
--------------------
@ -242,7 +252,7 @@ optional:
[[ Running InputDrv ]]
----------------------
The programs inputdrv and gui/inputcfg.py are part of an experiment to
The programs src/inputdrv and gui/inputcfg.py are part of an experiment to
create a very flexible input configuration framework. They are still
in development and not of any use unless you want to hack the
source. Their compilation is disabled by default.
@ -305,8 +315,6 @@ And insert the following lines:
<match key="input.product" string="Xbox Gamepad (userspace driver)">
<remove key="input.x11_driver" />
</match>
Note: The exact string will differ depending on the type of controller you use.
[[ Mouse Emulation ]]
---------------------
@ -325,7 +333,7 @@ This will map the dpad to cursor keys, left analogstick to mouse
cursor and right analogstick to mouse wheel.
Note that if you have your mouse buttons switched you must adjust the
above to match your mouse or the button events come out wrong.
above to match your mouse or the button events will come out wrong.
[[ Wacom Trouble ]]
-------------------
@ -358,8 +366,8 @@ not work properly or not at all.
It is currently unknown if this can be fixed by xboxdrv or if it
requires patches to Wine.
[[ Examples ]]
--------------
[[ Example Configurations ]]
----------------------------
Prince of Persia: Sands of Time (in Wine)
Prince of Persia: Warrior Within (in Wine)
@ -367,6 +375,7 @@ Prince of Persia: The Two Thrones (in Wine)
Tomb Raider Anniversary (in Wine)
Tomb Raider Legend (in Wine)
----------------------------
% xboxdrv --trigger-as-button -s
The triggers are not regonized in these games when they are analog, so
@ -375,6 +384,7 @@ we have to handle them as buttons.
CH Flightstick emulation in Dosbox:
-----------------------------------
In dosbox.conf set:
[joystick]
@ -387,6 +397,7 @@ Start xboxdrv with:
Your right analog stick will act as trottle control, the trigger as
rudder.
Sauerbraten
-----------
@ -399,6 +410,19 @@ First analogstick gets mapped te cursor keys, second analogstick gets mapped to
--ui-buttonmap y=KEY_ENTER,dl=KEY_4,dr=KEY_2,du=KEY_1,dd=KEY_3,back=KEY_TAB,start=KEY_ESC \
-s --deadzone 6000 --dpad-as-button --trigger-as-button
Warsow
------
% ./xboxdrv \
--ui-axismap x2=REL_X:10,y2=REL_Y:-10,x1=KEY_A:KEY_D,y1=KEY_W:KEY_S \
--ui-buttonmap a=KEY_LEFTSHIFT,b=BTN_C,x=BTN_EXTRA,y=KEY_C \
--ui-buttonmap lb=BTN_RIGHT,rb=KEY_SPACE \
--ui-buttonmap lt=KEY_Z,rt=BTN_LEFT \
--ui-buttonmap dl=KEY_4,dr=KEY_2,du=REL_WHEEL:-1:150,dd=REL_WHEEL:1:150 \
--ui-buttonmap back=KEY_TAB,start=KEY_ESC \
-s --deadzone 6000 --dpad-as-button --trigger-as-button
[[ Testing ]]
-------------

View file

@ -441,6 +441,17 @@ void print_led_help()
<< std::endl;
}
void print_version()
{
std::cout
<< "xboxdrv 0.4\n"
<< "Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>\n"
<< "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
<< "This is free software: you are free to change and redistribute it.\n"
<< "There is NO WARRANTY, to the extent permitted by law."
<< std::endl;
}
void parse_command_line(int argc, char** argv, CommandLineOptions& opts)
{
for(int i = 1; i < argc; ++i)
@ -459,13 +470,7 @@ void parse_command_line(int argc, char** argv, CommandLineOptions& opts)
else if (strcmp(argv[i], "-V") == 0 ||
strcmp(argv[i], "--version") == 0)
{
std::cout
<< "xboxdrv 0.3\n"
<< "Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>\n"
<< "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
<< "This is free software: you are free to change and redistribute it.\n"
<< "There is NO WARRANTY, to the extent permitted by law."
<< std::endl;
print_version();
exit(EXIT_SUCCESS);
}
else if (strcmp(argv[i], "-s") == 0 ||
@ -566,6 +571,7 @@ void parse_command_line(int argc, char** argv, CommandLineOptions& opts)
}
else if (strcmp(argv[i], "--force-feedback") == 0)
{
std::cout << "Warrning: force-feedback support is not yet implemented" << std::endl;
opts.uinput_config.force_feedback = true;
}
else if (strcmp(argv[i], "-b") == 0 ||
@ -1201,6 +1207,9 @@ void on_sigint(int)
void run_main(CommandLineOptions& opts)
{
print_version();
std::cout << std::endl;
usb_init();
usb_find_busses();
usb_find_devices();
@ -1269,7 +1278,7 @@ void run_main(CommandLineOptions& opts)
uInput* uinput = 0;
if (!opts.no_uinput)
{
std::cout << "Starting with uinput... " << std::flush;
std::cout << "\nStarting with uinput... " << std::flush;
uinput = new uInput(dev_type.type, opts.uinput_config);
std::cout << "done" << std::endl;
}

View file

@ -64,6 +64,22 @@ public:
usb_close(handle);
}
void clear_halt(int ep)
{
if (usb_clear_halt(handle, ep) != 0)
{
std::cout << "Failure to reset_ep: " << ep << std::endl;
}
}
void reset()
{
if (usb_reset(handle) != 0)
{
std::cout << "Failure to reset" << std::endl;
}
}
void detach_kernel_driver(int iface)
{
if (usb_detach_kernel_driver_np(handle, iface) < 0)
@ -625,6 +641,23 @@ void console_ctrlreq_cmd(const std::vector<std::string>& args)
}
}
void console_reset_ep_cmd(const std::vector<std::string>& args)
{
if (args.size() != 2)
{
std::cout << "Usage: clear_halt ENDPOINT" << std::endl;
}
else
{
USBDevice::current()->clear_halt(atoi(args[1].c_str()));
}
}
void console_reset_cmd(const std::vector<std::string>& args)
{
USBDevice::current()->reset();
}
void console_ctrl_cmd(const std::vector<std::string>& args)
{
if (args.size() < 5)
@ -732,6 +765,14 @@ void dispatch_command(const std::vector<std::string>& args)
{
console_send_cmd(args);
}
else if (args[0] == "reset")
{
console_reset_cmd(args);
}
else if (args[0] == "clear_halt")
{
console_reset_ep_cmd(args);
}
else if (args[0] == "quit")
{
std::cout << "Exiting" << std::endl;