linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anssi Hannula <anssi.hannula@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, Brian Magnuson <bdmagnuson@gmail.com>
Subject: [patch 2/7, rev2] xpad: fix inverted Y and RY axes
Date: Fri, 28 Mar 2008 20:07:45 +0200	[thread overview]
Message-ID: <47ED33F1.4060606@gmail.com> (raw)
In-Reply-To: <20080317192844.411623453@gmail.com>

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>

---

Updated this patch according to info from
http://bugzilla.kernel.org/show_bug.cgi?id=10337


 drivers/input/joystick/xpad.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6.25-rc3-mm1-xpad/drivers/input/joystick/xpad.c
===================================================================
--- linux-2.6.25-rc3-mm1-xpad.orig/drivers/input/joystick/xpad.c	2008-03-05 01:52:52.000000000 +0200
+++ linux-2.6.25-rc3-mm1-xpad/drivers/input/joystick/xpad.c	2008-03-28 19:59:19.000000000 +0200
@@ -236,13 +236,13 @@ static void xpad_process_packet(struct u
 	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(struc
 	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]);

-- 
Anssi Hannula


  reply	other threads:[~2008-03-28 18:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17 19:22 [patch 0/7] updates for xpad Anssi Hannula
2008-03-17 19:22 ` [patch 1/7] xpad: fix dpad handling of unknown devices Anssi Hannula
2008-03-17 19:22 ` [patch 2/7] xpad: fix inverted Y and RY axes on xbox360 devices Anssi Hannula
2008-03-28 18:07   ` Anssi Hannula [this message]
2008-03-17 19:22 ` [patch 3/7] xpad: add more xbox 360 controller ids Anssi Hannula
2008-03-17 19:22 ` [patch 4/7] xpad: do not report nonexistent buttons for xbox360 Anssi Hannula
2008-03-17 19:22 ` [patch 5/7] xpad: enable force feedback on xbox 360 controllers only Anssi Hannula
2008-03-17 19:22 ` [patch 6/7] xpad: drop obsolete driver versioning Anssi Hannula
2008-03-17 19:22 ` [patch 7/7] xpad: add support for wireless xbox360 controllers Anssi Hannula
2008-04-03 20:26 ` [patch 0/7] updates for xpad Dmitry Torokhov
2008-04-03 20:44   ` Anssi Hannula

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=47ED33F1.4060606@gmail.com \
    --to=anssi.hannula@gmail.com \
    --cc=bdmagnuson@gmail.com \
    --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 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).