aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-05-26 16:55:04 -0400
committerJiri Kosina <jkosina@suse.cz>2013-06-03 05:07:06 -0400
commitee286c2e80547d87ed4e55c00709783aa2261848 (patch)
tree31db38fccc68a42a69e05882af9e0f11fbd5ece5
parent77a7480992844d506a62f866f0824aec429d7658 (diff)
HID: wiimote: fix classic controller parsing
I finally got a "Classic Controller" and "Classic Controller Pro" in my hands and noticed that all analog data was incorrectly parsed. Fix this up so we report the data that we pretend we do. I really doubt that this breaks any backwards compatibility, but if we get any reports, we only need to revert this single patch. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-wiimote-modules.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c
index e2afe065991d..8229d0ad14fd 100644
--- a/drivers/hid/hid-wiimote-modules.c
+++ b/drivers/hid/hid-wiimote-modules.c
@@ -1062,12 +1062,12 @@ static void wiimod_classic_in_ext(struct wiimote_data *wdata, const __u8 *ext)
1062 * With motionp enabled it changes slightly to this: 1062 * With motionp enabled it changes slightly to this:
1063 * Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 1063 * Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
1064 * -----+-----+-----+-----+-----+-----+-----+-----+-----+ 1064 * -----+-----+-----+-----+-----+-----+-----+-----+-----+
1065 * 1 | RX <4:3> | LX <5:1> | BDU | 1065 * 1 | RX <5:4> | LX <5:1> | BDU |
1066 * 2 | RX <2:1> | LY <5:1> | BDL | 1066 * 2 | RX <3:2> | LY <5:1> | BDL |
1067 * -----+-----+-----+-----+-----------------------+-----+ 1067 * -----+-----+-----+-----+-----------------------+-----+
1068 * 3 |RX<0>| LT <4:3> | RY <4:0> | 1068 * 3 |RX<1>| LT <5:4> | RY <5:1> |
1069 * -----+-----+-----------+-----------------------------+ 1069 * -----+-----+-----------+-----------------------------+
1070 * 4 | LT <2:0> | RT <4:0> | 1070 * 4 | LT <3:1> | RT <5:1> |
1071 * -----+-----+-----+-----+-----+-----+-----+-----+-----+ 1071 * -----+-----+-----+-----+-----+-----+-----+-----+-----+
1072 * 5 | BDR | BDD | BLT | B- | BH | B+ | BRT | EXT | 1072 * 5 | BDR | BDD | BLT | B- | BH | B+ | BRT | EXT |
1073 * -----+-----+-----+-----+-----+-----+-----+-----+-----+ 1073 * -----+-----+-----+-----+-----+-----+-----+-----+-----+
@@ -1079,13 +1079,13 @@ static void wiimod_classic_in_ext(struct wiimote_data *wdata, const __u8 *ext)
1079 1079
1080 if (wdata->state.flags & WIIPROTO_FLAG_MP_ACTIVE) { 1080 if (wdata->state.flags & WIIPROTO_FLAG_MP_ACTIVE) {
1081 lx = ext[0] & 0x3e; 1081 lx = ext[0] & 0x3e;
1082 ly = ext[0] & 0x3e; 1082 ly = ext[1] & 0x3e;
1083 } else { 1083 } else {
1084 lx = ext[0] & 0x3f; 1084 lx = ext[0] & 0x3f;
1085 ly = ext[0] & 0x3f; 1085 ly = ext[1] & 0x3f;
1086 } 1086 }
1087 1087
1088 rx = (ext[0] >> 3) & 0x14; 1088 rx = (ext[0] >> 3) & 0x18;
1089 rx |= (ext[1] >> 5) & 0x06; 1089 rx |= (ext[1] >> 5) & 0x06;
1090 rx |= (ext[2] >> 7) & 0x01; 1090 rx |= (ext[2] >> 7) & 0x01;
1091 ry = ext[2] & 0x1f; 1091 ry = ext[2] & 0x1f;
@@ -1103,8 +1103,8 @@ static void wiimod_classic_in_ext(struct wiimote_data *wdata, const __u8 *ext)
1103 input_report_abs(wdata->extension.input, ABS_HAT1Y, ly - 0x20); 1103 input_report_abs(wdata->extension.input, ABS_HAT1Y, ly - 0x20);
1104 input_report_abs(wdata->extension.input, ABS_HAT2X, rx - 0x20); 1104 input_report_abs(wdata->extension.input, ABS_HAT2X, rx - 0x20);
1105 input_report_abs(wdata->extension.input, ABS_HAT2Y, ry - 0x20); 1105 input_report_abs(wdata->extension.input, ABS_HAT2Y, ry - 0x20);
1106 input_report_abs(wdata->extension.input, ABS_HAT3X, rt - 0x20); 1106 input_report_abs(wdata->extension.input, ABS_HAT3X, rt);
1107 input_report_abs(wdata->extension.input, ABS_HAT3Y, lt - 0x20); 1107 input_report_abs(wdata->extension.input, ABS_HAT3Y, lt);
1108 1108
1109 input_report_key(wdata->extension.input, 1109 input_report_key(wdata->extension.input,
1110 wiimod_classic_map[WIIMOD_CLASSIC_KEY_RIGHT], 1110 wiimod_classic_map[WIIMOD_CLASSIC_KEY_RIGHT],