From: "Nicolas Léveillé" <knos@free.fr>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH 3/3] (uu.6cd36bd9ef57) joystick/xpad.c -- Trigger buttons handling
Date: Sun, 22 Nov 2009 09:57:45 +0100 [thread overview]
Message-ID: <4B08FD09.6020800@free.fr> (raw)
In-Reply-To: <4B08FCD3.2060502@free.fr>
Third patch in a series of three.
--
Added module parameter trigger_to_buttons, to let users force triggers
to behave as buttons.
Signed-off-by: Nicolas Léveillé <nicolas@uucidl.com>
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 {
u16 idVendor;
u16 idProduct;
@@ -781,8 +785,16 @@ static int xpad_probe(struct usb_interface *intf,
const struct usb_device_id *id
xpad->dpad_mapping = xpad_device[i].dpad_mapping;
xpad->trigger_mapping = xpad_device[i].trigger_mapping;
xpad->xtype = xpad_device[i].xtype;
+
if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN)
xpad->dpad_mapping = !dpad_to_buttons;
+
+ /* let module parameters override trigger_mapping */
+ if (triggers_to_buttons) {
+ printk (KERN_INFO "xpad: forcing triggers to map to buttons.\n");
+ xpad->trigger_mapping = MAP_TRIGGERS_TO_BUTTONS;
+ }
+
if (xpad->xtype == XTYPE_UNKNOWN) {
if (intf->cur_altsetting->desc.bInterfaceClass ==
USB_CLASS_VENDOR_SPEC) {
if (intf->cur_altsetting->desc.bInterfaceProtocol == 129)
--
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
next prev parent reply other threads:[~2009-11-22 9:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 8:55 [PATCH 1/3] (uu.6cd36bd9ef57) joystick/xpad.c -- Support HORI RAP.EX/MadCatz Fightpad Nicolas Léveillé
2009-11-22 8:56 ` [PATCH 2/3] " Nicolas Léveillé
2009-11-22 8:57 ` Nicolas Léveillé [this message]
2009-11-26 6:04 ` [PATCH 1/3] " Dmitry Torokhov
2009-11-26 10:27 ` Nicolas Léveillé
2009-12-03 3:13 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B08FD09.6020800@free.fr \
--to=knos@free.fr \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.