diff mbox

[3/3] (uu.6cd36bd9ef57) joystick/xpad.c -- Trigger buttons handling

Message ID 4B08FD09.6020800@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Léveillé Nov. 22, 2009, 8:57 a.m. UTC
None
diff mbox

Patch

diff --git a/Documentation/input/xpad.txt b/Documentation/input/xpad.txt
index aae0d40..01c9d1f 100644
--- a/Documentation/input/xpad.txt
+++ b/Documentation/input/xpad.txt
@@ -19,6 +19,9 @@  The number of buttons/axes reported varies based on 3 
things:
  - if using an unknown device (one not listed below), what you set in the
    module configuration for "Map D-PAD to buttons rather than axes for 
unknown
    pads" (module option dpad_to_buttons)
+- if triggers are mapped to buttons or axes. This depends on the device 
and can be forced via module option triggers_to_buttons.
+
+dpad_to_buttons:

  If you set dpad_to_buttons to 0 and you are using an unknown device (one
  not listed below), the driver will map the directional pad to axes (X/Y),
@@ -27,6 +30,15 @@  style games to function correctly.  The default is Y.

  dpad_to_buttons has no effect for known pads.

+triggers_to_buttons:
+
+If you set triggers_to_buttons to 1 and you are using a device
+otherwise configured to map triggers to axes, the module will map them
+to digital buttons.
+
+Setting triggers_to_buttons to 0 does not do anything: it does not
+make sense to map a device digital button's into an axis.
+
  0.1 Normal Controllers
  ----------------------
  With a normal controller, the directional pad is mapped to its own X/Y 
axes.
@@ -139,7 +151,7 @@  It works? Voila, you're done ;)

  I have to thank ITO Takayuki for the detailed info on his site
   http://euc.jp/periphs/xbox-controller.ja.html.
-
+
  His useful info and both the usb-skeleton as well as the iforce input 
driver
  (Greg Kroah-Hartmann; Vojtech Pavlik) helped a lot in rapid prototyping
  the basic functionality.
@@ -173,7 +185,7 @@  I:  If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 
Prot=00 Driver=xpad
  E:  Ad=82(I) Atr=03(Int.) MxPS=  32 Ivl=4ms
  E:  Ad=02(O) Atr=03(Int.) MxPS=  32 Ivl=4ms

---
+--
  Marko Friedemann <mfr@bmx-chemnitz.de>
  2002-07-16
   - original doc
@@ -181,3 +193,7 @@  Marko Friedemann <mfr@bmx-chemnitz.de>
  Dominic Cerquetti <binary1230@yahoo.com>
  2005-03-19
   - added stuff for dance pads, new d-pad->axes mappings
+
+Nicolas Léveillé <nicolas@uucidl.com>
+2009-11-21
+ - added triggers remapping.
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 0d43838..7875494 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -102,6 +102,10 @@  static int dpad_to_buttons;
  module_param(dpad_to_buttons, bool, S_IRUGO);
  MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than 
axes for unknown pads");

+static int triggers_to_buttons;
+module_param(triggers_to_buttons, bool, S_IRUGO);
+MODULE_PARM_DESC(triggers_to_buttons, "Map triggers to buttons rather 
than axes");
+
  static const struct xpad_device {