All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] xpad.c - fixed report for dpad and inverted Y and RY axes
@ 2007-06-03 14:14 Jan Kratochvil
  2007-06-11 14:36 ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2007-06-03 14:14 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Brian Magnuson

Fixed input report handling for xbox 360 controller.
Y/RY up is now positive and down negative.
DPAD report fixed.

Reported-by: Brian Magnuson <bdmagnuson@gmail.com>
Signed-off-by: Jan Kratochvil <honza@jikos.cz>
---
  drivers/input/joystick/xpad.c |   16 ++++++++--------
  1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 1651950..f3f2ade 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -283,14 +283,14 @@ static void xpad360_process_packet(struc

  	/* digital pad */
  	if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) {
-		input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x01) - !!((data[2] & 0x08) >> 3));
-		input_report_abs(dev, ABS_HAT0Y, !!((data[2] & 0x02) >> 1) - !!((data[2] & 0x04) >> 2));
+		input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x01) - !!((data[2] & 0x02) >> 1));
+		input_report_abs(dev, ABS_HAT0Y, !!((data[2] & 0x08) >> 3) - !!((data[2] & 0x04) >> 2));
  	} else if ( xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS ) {
  		/* dpad as buttons (right, left, down, up) */
-		input_report_key(dev, BTN_RIGHT, (data[2] & 0x01));
-		input_report_key(dev, BTN_LEFT, (data[2] & 0x08) >> 3);
-		input_report_key(dev, BTN_0, (data[2] & 0x02) >> 1);
-		input_report_key(dev, BTN_1, (data[2] & 0x04) >> 2);
+		input_report_key(dev, BTN_0, (data[2] & 0x01));
+		input_report_key(dev, BTN_1, (data[2] & 0x02) >> 1);
+		input_report_key(dev, BTN_LEFT, (data[2] & 0x04) >> 2);
+		input_report_key(dev, BTN_RIGHT, (data[2] & 0x08) >> 3);
  	}

  	/* start/back buttons */
@@ -312,10 +312,10 @@ static void xpad360_process_packet(struc

  	/* left stick */
  	input_report_abs(dev, ABS_X, (__s16) (((__s16)data[7] << 8) | (__s16)data[6]));
-	input_report_abs(dev, ABS_Y, ~(__s16) (((__s16)data[9] << 8) | (__s16)data[8]));
+	input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[9] << 8) | (__s16)data[8]));

  	/* right stick */
-	input_report_abs(dev, ABS_RY, ~(__s16) (((__s16)data[13] << 8) | (__s16)data[12]));
+	input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[13] << 8) | (__s16)data[12]));
  	input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[11] << 8) | (__s16)data[10]));

  	/* triggers left/right */
-- 
1.4.3.4

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

end of thread, other threads:[~2007-06-15  5:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-03 14:14 [PATCH 4/4] xpad.c - fixed report for dpad and inverted Y and RY axes Jan Kratochvil
2007-06-11 14:36 ` Dmitry Torokhov
2007-06-13  1:13   ` Brian Magnuson
2007-06-13  6:26   ` Jan Kratochvil
2007-06-15  5:05     ` Dmitry Torokhov

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.