mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-07-26 13:57:59 +00:00
189ce92b4c
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
61 lines
2.1 KiB
Diff
61 lines
2.1 KiB
Diff
From 0842fcae9a509f08c6d540dfa4d3f097c4f3f92d Mon Sep 17 00:00:00 2001
|
|
From: David Herrmann <dh.herrmann@googlemail.com>
|
|
Date: Tue, 8 May 2012 16:52:31 +0200
|
|
Subject: [PATCH 050/117] HID: wiimote: Fix IR data parser
|
|
|
|
commit 74b89e8a3625c17c7452532dfb997ac4f1a38751 upstream.
|
|
|
|
We incorrectly parse incoming IR data. The extra byte contains the upper
|
|
bits and not the lower bits of the x/y coordinates. User-space expects
|
|
absolute position data from us so this patch does not break existing
|
|
applications. On the contrary, it extends the virtual view and fixes
|
|
garbage reports for margin areas of the virtual screen.
|
|
|
|
Reported-by: Peter Bukovsky <bukovsky.peter@gmail.com>
|
|
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
|
|
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
|
[bwh: Backported to 3.2: adjust filename]
|
|
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
|
|
---
|
|
drivers/hid/hid-wiimote.c | 16 +++++-----------
|
|
1 file changed, 5 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c
|
|
index 76739c0..bfa9a27 100644
|
|
--- a/drivers/hid/hid-wiimote.c
|
|
+++ b/drivers/hid/hid-wiimote.c
|
|
@@ -829,7 +829,7 @@ static void __ir_to_input(struct wiimote_data *wdata, const __u8 *ir,
|
|
|
|
/*
|
|
* Basic IR data is encoded into 3 bytes. The first two bytes are the
|
|
- * upper 8 bit of the X/Y data, the 3rd byte contains the lower 2 bits
|
|
+ * lower 8 bit of the X/Y data, the 3rd byte contains the upper 2 bits
|
|
* of both.
|
|
* If data is packed, then the 3rd byte is put first and slightly
|
|
* reordered. This allows to interleave packed and non-packed data to
|
|
@@ -838,17 +838,11 @@ static void __ir_to_input(struct wiimote_data *wdata, const __u8 *ir,
|
|
*/
|
|
|
|
if (packed) {
|
|
- x = ir[1] << 2;
|
|
- y = ir[2] << 2;
|
|
-
|
|
- x |= ir[0] & 0x3;
|
|
- y |= (ir[0] >> 2) & 0x3;
|
|
+ x = ir[1] | ((ir[0] & 0x03) << 8);
|
|
+ y = ir[2] | ((ir[0] & 0x0c) << 6);
|
|
} else {
|
|
- x = ir[0] << 2;
|
|
- y = ir[1] << 2;
|
|
-
|
|
- x |= (ir[2] >> 4) & 0x3;
|
|
- y |= (ir[2] >> 6) & 0x3;
|
|
+ x = ir[0] | ((ir[2] & 0x30) << 4);
|
|
+ y = ir[1] | ((ir[2] & 0xc0) << 2);
|
|
}
|
|
|
|
input_report_abs(wdata->ir, xid, x);
|
|
--
|
|
1.7.9.5
|
|
|