From patchwork Sun May 26 20:55:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2616871 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id AA2283FD2B for ; Sun, 26 May 2013 20:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755169Ab3EZU4F (ORCPT ); Sun, 26 May 2013 16:56:05 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:39907 "EHLO mail-bk0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755145Ab3EZU4F (ORCPT ); Sun, 26 May 2013 16:56:05 -0400 Received: by mail-bk0-f45.google.com with SMTP id je9so2713939bkc.32 for ; Sun, 26 May 2013 13:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=ivGXquPTv339FFSdp1bEV7BZBVLQQTXpnfaOIKdks5E=; b=y3eCVfW7P9wMOYA7gQZ0bSeuaXebW03efZxB5tvR8pyLcsXMUDjy4c2iPQKAXFinmI MU+QVy2Fqgn7ZpgO8bRXPw2TzYKdzeMxFfumCLJvUOeG5Gy4+oyFrZz3XnJTzvwNKnM9 dAExqdLq1/11Tdjf1yStN1C5wV4r1x3Wf0EkThP2H+Dr4EA321xG+wDFc9xYom6Iay5I Wke7AkW4MHj+jfKWHUN6SX57Tcc66zc4j+xI1eI4n3YSBkb/I0jS28jHad7Wwm6CamUB ZmBBTLd2kACW1op51NSV9ngFv8F9UAJn2PBEVtyVK6wYvwtjvUHRlVr629SFDyphM489 eDeg== X-Received: by 10.205.10.10 with SMTP id oy10mr11359189bkb.89.1369601763824; Sun, 26 May 2013 13:56:03 -0700 (PDT) Received: from localhost.localdomain (stgt-5f71b863.pool.mediaWays.net. [95.113.184.99]) by mx.google.com with ESMTPSA id og1sm3531965bkb.16.2013.05.26.13.56.02 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 26 May 2013 13:56:03 -0700 (PDT) From: David Herrmann To: linux-input@vger.kernel.org Cc: Jiri Kosina , David Herrmann Subject: [PATCH 29/26] HID: wiimote: fix classic controller parsing Date: Sun, 26 May 2013 22:55:04 +0200 Message-Id: <1369601704-2311-3-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1369601704-2311-1-git-send-email-dh.herrmann@gmail.com> References: <1367788390-29835-1-git-send-email-dh.herrmann@gmail.com> <1369601704-2311-1-git-send-email-dh.herrmann@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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 --- drivers/hid/hid-wiimote-modules.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c index 25483aa..c7a2c6b 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) * With motionp enabled it changes slightly to this: * Byte | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ - * 1 | RX <4:3> | LX <5:1> | BDU | - * 2 | RX <2:1> | LY <5:1> | BDL | + * 1 | RX <5:4> | LX <5:1> | BDU | + * 2 | RX <3:2> | LY <5:1> | BDL | * -----+-----+-----+-----+-----------------------+-----+ - * 3 |RX<0>| LT <4:3> | RY <4:0> | + * 3 |RX<1>| LT <5:4> | RY <5:1> | * -----+-----+-----------+-----------------------------+ - * 4 | LT <2:0> | RT <4:0> | + * 4 | LT <3:1> | RT <5:1> | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ * 5 | BDR | BDD | BLT | B- | BH | B+ | BRT | EXT | * -----+-----+-----+-----+-----+-----+-----+-----+-----+ @@ -1079,13 +1079,13 @@ static void wiimod_classic_in_ext(struct wiimote_data *wdata, const __u8 *ext) if (wdata->state.flags & WIIPROTO_FLAG_MP_ACTIVE) { lx = ext[0] & 0x3e; - ly = ext[0] & 0x3e; + ly = ext[1] & 0x3e; } else { lx = ext[0] & 0x3f; - ly = ext[0] & 0x3f; + ly = ext[1] & 0x3f; } - rx = (ext[0] >> 3) & 0x14; + rx = (ext[0] >> 3) & 0x18; rx |= (ext[1] >> 5) & 0x06; rx |= (ext[2] >> 7) & 0x01; ry = ext[2] & 0x1f; @@ -1103,8 +1103,8 @@ static void wiimod_classic_in_ext(struct wiimote_data *wdata, const __u8 *ext) input_report_abs(wdata->extension.input, ABS_HAT1Y, ly - 0x20); input_report_abs(wdata->extension.input, ABS_HAT2X, rx - 0x20); input_report_abs(wdata->extension.input, ABS_HAT2Y, ry - 0x20); - input_report_abs(wdata->extension.input, ABS_HAT3X, rt - 0x20); - input_report_abs(wdata->extension.input, ABS_HAT3Y, lt - 0x20); + input_report_abs(wdata->extension.input, ABS_HAT3X, rt); + input_report_abs(wdata->extension.input, ABS_HAT3Y, lt); input_report_key(wdata->extension.input, wiimod_classic_map[WIIMOD_CLASSIC_KEY_RIGHT],