[PATCH 2/2] joystick/xpad: Advertise the triggers as throttle/break

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

 



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

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