linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Franzke <benjaminfranzke@googlemail.com>
To: linux-input@vger.kernel.org
Cc: Benjamin Franzke <benjaminfranzke@googlemail.com>
Subject: [PATCH 2/2] joystick/xpad: Advertise the triggers as throttle/break
Date: Wed, 11 Dec 2013 09:15:31 +0100	[thread overview]
Message-ID: <1386749731-6500-2-git-send-email-benjaminfranzke@googlemail.com> (raw)
In-Reply-To: <1386749731-6500-1-git-send-email-benjaminfranzke@googlemail.com>

They are considered positive only axes, so userspace and joydev can
handle them correctly.
It also fits semantically better, since these triggers are really intended
for throttle/break.

Signed-off-by: Benjamin Franzke <benjaminfranzke@googlemail.com>
---
 drivers/input/joystick/xpad.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 75e3b10..4e9de34 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -226,7 +226,7 @@ static const signed short xpad_abs_pad[] = {
 
 /* used when triggers are mapped to axes */
 static const signed short xpad_abs_triggers[] = {
-	ABS_Z, ABS_RZ,		/* triggers left/right */
+	ABS_BRAKE, ABS_THROTTLE, /* triggers left/right */
 	-1
 };
 
@@ -327,8 +327,8 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
 		input_report_key(dev, BTN_TL2, data[10]);
 		input_report_key(dev, BTN_TR2, data[11]);
 	} else {
-		input_report_abs(dev, ABS_Z, data[10]);
-		input_report_abs(dev, ABS_RZ, data[11]);
+		input_report_abs(dev, ABS_BRAKE, data[10]);
+		input_report_abs(dev, ABS_THROTTLE, data[11]);
 	}
 
 	/* digital pad */
@@ -429,8 +429,8 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
 		input_report_key(dev, BTN_TL2, data[4]);
 		input_report_key(dev, BTN_TR2, data[5]);
 	} else {
-		input_report_abs(dev, ABS_Z, data[4]);
-		input_report_abs(dev, ABS_RZ, data[5]);
+		input_report_abs(dev, ABS_BRAKE, data[4]);
+		input_report_abs(dev, ABS_THROTTLE, data[5]);
 	}
 
 	input_sync(dev);
@@ -824,8 +824,8 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)
 	case ABS_RY:	/* the two sticks */
 		input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128);
 		break;
-	case ABS_Z:
-	case ABS_RZ:	/* the triggers (if mapped to axes) */
+	case ABS_BRAKE:
+	case ABS_THROTTLE: /* the triggers (if mapped to axes) */
 		input_set_abs_params(input_dev, abs, 0, 255, 0, 0);
 		break;
 	case ABS_HAT0X:
-- 
1.8.1.5


  reply	other threads:[~2013-12-11  8:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  8:15 [PATCH 1/2] joydev: Map ABS_{THROTTLE,GAS,BREAK} to positive values Benjamin Franzke
2013-12-11  8:15 ` Benjamin Franzke [this message]
2013-12-14  5:13 ` Ken Phillis Jr
2013-12-14  6:22   ` Benjamin Franzke
2013-12-14  6:56     ` Ken Phillis Jr
2013-12-14  8:16       ` Benjamin Franzke
2013-12-19 12:50 ` Benjamin Franzke

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=1386749731-6500-2-git-send-email-benjaminfranzke@googlemail.com \
    --to=benjaminfranzke@googlemail.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 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).