linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xpad - Allow mapping D-pad to buttons for all pads
@ 2008-05-05 10:34 Michael Gruber
  2008-05-07 15:19 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Gruber @ 2008-05-05 10:34 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input

From: Michael Gruber <lists.mg@googlemail.com>

If the new module option force_dpad_to_buttons is set, the directional pad will
be mapped to 4buttons instead of 2axes for all controllers. This includes those
in the list of known controllers which are not affected by the existing option
dpad_to_buttons.

Signed-off-by: Michael Gruber <lists.mg@googlemail.com>

---

The ability to switch between axes and buttons mode is already present in the
driver but it is only possible if the connected controller is not known by the
driver. This patch makes the feature available for all pads.

 Documentation/input/xpad.txt  |    4 +++-
 drivers/input/joystick/xpad.c |    7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

--- a/Documentation/input/xpad.txt	2008-04-14 01:50:14.000000000 +0200
+++ b/Documentation/input/xpad.txt	2008-04-30 16:04:23.000000000 +0200
@@ -25,7 +25,9 @@ not listed below), the driver will map t
 if you said N it will map the d-pad to buttons, which is needed for dance
 style games to function correctly.  The default is Y.
 
-dpad_to_buttons has no effect for known pads.
+dpad_to_buttons has no effect for known pads. If you want to override the
+d-pad mapping to use buttons instead of axes for a known controller you
+should set force_dpad_to_buttons to Y. The default is N.
 
 0.1 Normal Controllers
 ----------------------
--- a/drivers/input/joystick/xpad.c	2008-04-15 10:41:42.000000000 +0200
+++ b/drivers/input/joystick/xpad.c	2008-04-30 15:11:14.000000000 +0200
@@ -98,6 +98,9 @@
 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 force_dpad_to_buttons;
+module_param(force_dpad_to_buttons, bool, S_IRUGO);
+MODULE_PARM_DESC(force_dpad_to_buttons, "Map D-PAD to buttons rather than axes for all pads");
 
 static const struct xpad_device {
 	u16 idVendor;
@@ -742,7 +745,9 @@ static int xpad_probe(struct usb_interfa
 	xpad->udev = udev;
 	xpad->dpad_mapping = xpad_device[i].dpad_mapping;
 	xpad->xtype = xpad_device[i].xtype;
-	if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN)
+	if (force_dpad_to_buttons)
+		xpad->dpad_mapping = MAP_DPAD_TO_BUTTONS;
+	else if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN)
 		xpad->dpad_mapping = !dpad_to_buttons;
 	if (xpad->xtype == XTYPE_UNKNOWN) {
 		if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) {

-- 
249 Spiele für nur 1 Preis. Die GMX Spieleflatrate schon ab 9,90 Euro.
Neu: Asterix bei den Olympischen Spielen: http://flat.games.gmx.de
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-09  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-05 10:34 [PATCH 1/2] xpad - Allow mapping D-pad to buttons for all pads Michael Gruber
2008-05-07 15:19 ` Dmitry Torokhov
2008-05-09  0:20   ` Michael Gruber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).