[PATCH 1/2] xpad - Allow mapping D-pad to buttons for all pads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Gruber <lists.mg@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>

---

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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux