[PATCH 13/37] Input: xpad - fix inverted Y and RY axes

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Anssi Hannula
Date: Thursday, April 3, 2008 - 1:18 pm

The commit ae91d10aab2762f81733e9194cb56eff99c8d808 inverted Y and RY
axes on xbox360 so that up is positive and down is negative.
This is wrong, as axes on game controllers have up as negative per
convention. Also, even xpad itself reports HAT0X with up as negative.

Fix that by inverting them again.

Also, according to http://bugzilla.kernel.org/show_bug.cgi?id=10337 the
original xbox controllers also have the Y and RY axes inverted.
Fix that by inverting them as well.

Cc: Brian Magnuson <bdmagnuson@gmail.com>
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/input/joystick/xpad.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 6288c4f..316d987 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -236,13 +236,13 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
 	input_report_abs(dev, ABS_X,
 			 (__s16) le16_to_cpup((__le16 *)(data + 12)));
 	input_report_abs(dev, ABS_Y,
-			 (__s16) le16_to_cpup((__le16 *)(data + 14)));
+			 ~(__s16) le16_to_cpup((__le16 *)(data + 14)));
 
 	/* right stick */
 	input_report_abs(dev, ABS_RX,
 			 (__s16) le16_to_cpup((__le16 *)(data + 16)));
 	input_report_abs(dev, ABS_RY,
-			 (__s16) le16_to_cpup((__le16 *)(data + 18)));
+			 ~(__s16) le16_to_cpup((__le16 *)(data + 18)));
 
 	/* triggers left/right */
 	input_report_abs(dev, ABS_Z, data[10]);
@@ -330,13 +330,13 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
 	input_report_abs(dev, ABS_X,
 			 (__s16) le16_to_cpup((__le16 *)(data + 6)));
 	input_report_abs(dev, ABS_Y,
-			 (__s16) le16_to_cpup((__le16 *)(data + 8)));
+			 ~(__s16) le16_to_cpup((__le16 *)(data + 8)));
 
 	/* right stick */
 	input_report_abs(dev, ABS_RX,
 			 (__s16) le16_to_cpup((__le16 *)(data + 10)));
 	input_report_abs(dev, ABS_RY,
-			 (__s16) le16_to_cpup((__le16 *)(data + 12)));
+			 ~(__s16) le16_to_cpup((__le16 *)(data + 12)));
 
 	/* triggers left/right */
 	input_report_abs(dev, ABS_Z, data[4]);
-- 
1.5.5.rc2.6.gf58d


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 28/37] Input: add Zhen Hua driver, Martin Kebert, (Mon Mar 10, 5:40 am)
[PATCH 29/37] Input: fix ordering in joystick Makefile, Jiri Kosina, (Mon Mar 10, 5:43 am)
[PATCH 10/37] Input: tosakbd - fix suspend, Dmitry Baryshkov, (Wed Apr 2, 8:22 am)
[PATCH 13/37] Input: xpad - fix inverted Y and RY axes, Anssi Hannula, (Thu Apr 3, 1:18 pm)
[PATCH 19/37] Input: xpad - don't use GFP_ATOMIC, Oliver Neukum, (Thu Apr 3, 1:19 pm)
[PATCH 22/37] Input: add PS/2 serio driver for AVR32 devices, Hans-Christian Egtvedt, (Mon Apr 14, 10:30 pm)
[PATCH 23/37] Input: gpio_keys - irq handling cleanup, David Brownell, (Mon Apr 14, 10:31 pm)
[PATCH 24/37] Input: omap-keypad - fix build warning, David Brownell, (Mon Apr 14, 10:31 pm)
[PATCH 35/37] Input: bf54x-keys - add infrastructure for k ..., Michael Hennerich, (Thu Apr 17, 9:25 pm)
[PATCH 00/37] Input queue for 2.6.26 merge window, Dmitry Torokhov, (Mon Apr 21, 6:14 am)
Re: [PATCH 22/37] Input: add PS/2 serio driver for AVR32 d ..., Hans-Christian Egtvedt, (Mon Apr 21, 6:33 am)
Re: [PATCH 00/37] Input queue for 2.6.26 merge window, Henrique de Moraes H ..., (Mon Apr 21, 8:11 am)
Re: [PATCH 29/37] Input: fix ordering in joystick Makefile, Dmitry Torokhov, (Mon Apr 21, 8:39 am)
Re: [PATCH 00/37] Input queue for 2.6.26 merge window, Dmitry Torokhov, (Mon Apr 21, 8:44 am)
Re: [PATCH 29/37] Input: fix ordering in joystick Makefile, Dmitry Torokhov, (Mon Apr 21, 9:20 am)
Re: [PATCH 00/37] Input queue for 2.6.26 merge window, Henrique de Moraes H ..., (Mon Apr 21, 9:58 am)