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

* Re: [PATCH 1/2] xpad - Allow mapping D-pad to buttons for all pads
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2008-05-07 15:19 UTC (permalink / raw)
  To: Michael Gruber; +Cc: linux-input

Hi Michael,

On Mon, May 05, 2008 at 12:34:00PM +0200, Michael Gruber wrote:
> 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.
>

The option was there to adapt mappings for the new controllers we
don'ty know about yet. Coudl you explain why one would want to map
axes to buttons on a controller that is known to be not a d-pad?

Thanks!

-- 
Dmitry

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

* Re: [PATCH 1/2] xpad - Allow mapping D-pad to buttons for all pads
  2008-05-07 15:19 ` Dmitry Torokhov
@ 2008-05-09  0:20   ` Michael Gruber
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Gruber @ 2008-05-09  0:20 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input

On Wed, May 7, 2008 at 5:19 PM, Dmitry Torokhov wrote:
> Hi Michael,
>
> On Mon, May 05, 2008 at 12:34:00PM +0200, Michael Gruber wrote:
>> 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.
>>
>
> The option was there to adapt mappings for the new controllers we
> don'ty know about yet. Coudl you explain why one would want to map
> axes to buttons on a controller that is known to be not a d-pad?
>
> Thanks!
>
> --
> Dmitry


For me being able to choose between 2axis or 4buttons is an additional feature.
Currently this feature is only offered if the controller is unknown which means
that if you have a known controller you end up with less features, which is
paradox.
Possible usage scenario: A user wants to play a first person shooter; he needs
2axes to look around and 2axes to move. Those 4axes are provided by the two
thumbsticks; the dpad and the trigger axes are useless for this player but he
might need a lot of buttons: fire, zoom, jump, duck, sprint, reload, switch
weapons, grenades, flashlight, and more; hence he would profit from having more
buttons; if the triggers acted as buttons then he could bind fire to the
trigger and if the directional pad acted as 4 buttons then he could for example
use them as shortcuts to his four favourite weapons.
A lot of Xbox360 games use the triggers and dpad axes for actions that can
usually only be bound to buttons in PC games. Thus a Xbox-user might be
expecting an easy way to get the same functionality with the linux driver.

^ 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).