From patchwork Mon Feb 18 00:47:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2154721 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5BC72DF283 for ; Mon, 18 Feb 2013 00:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756915Ab3BRAqV (ORCPT ); Sun, 17 Feb 2013 19:46:21 -0500 Received: from mail-bk0-f43.google.com ([209.85.214.43]:63591 "EHLO mail-bk0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756762Ab3BRAqV (ORCPT ); Sun, 17 Feb 2013 19:46:21 -0500 Received: by mail-bk0-f43.google.com with SMTP id jm19so2294823bkc.2 for ; Sun, 17 Feb 2013 16:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=NG8BnLJJ8bWrc55HN+vloNRXmcDU3d90dn894BkJSo0=; b=yArv1zDV6nvZGZyByUeXbktxRL+Cax3DsaeYeyyF2vPUM4P0VohUp/RW9ofdpX25ef 2ssJ+cqGflxS96u8dg16JPgGQ4C2SFOGcy6rTpSR2IESVnZp+02Tj7j8u28T7ir0hbud tAl+mSsOcVG5UUietMaELPn6xzT2e2MOXPs8TR6gvkUeiFx9FfEnITuvo+OcR2y/KfMY qv8QY24CFe8XPz1RJDmxh9OA83ogtGkmt8NIhcnop+k4FHyvpVwGX1X1KMvFypZzTIg6 rIhsajKXp0RDL9XYh/Up/0k7pijygVSIGfzC8F9mf6IT0Q/TlUI/GJTsdnMD2obRvsr+ zDAA== X-Received: by 10.204.150.140 with SMTP id y12mr3891227bkv.35.1361148379313; Sun, 17 Feb 2013 16:46:19 -0800 (PST) Received: from localhost.localdomain (stgt-5f71b832.pool.mediaWays.net. [95.113.184.50]) by mx.google.com with ESMTPS id fw3sm4135328bkc.9.2013.02.17.16.46.17 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 16:46:18 -0800 (PST) From: David Herrmann To: linux-input@vger.kernel.org Cc: Jiri Kosina , Victor Quicksilver , David Herrmann , stable@vger.kernel.org Subject: [PATCH] HID: wiimote: fix nunchuck button parser Date: Mon, 18 Feb 2013 01:47:15 +0100 Message-Id: <1361148435-25567-1-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.1.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The buttons of the Wii Remote Nunchuck extension are actually active low. Fix the parser to forward the inverted values. The comment in the function always said "0 == pressed" but the implementation was wrong from the beginning. Cc: stable@vger.kernel.org Reported-by: Victor Quicksilver Signed-off-by: David Herrmann --- drivers/hid/hid-wiimote-ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c index 38ae877..0472191 100644 --- a/drivers/hid/hid-wiimote-ext.c +++ b/drivers/hid/hid-wiimote-ext.c @@ -403,14 +403,14 @@ static void handler_nunchuck(struct wiimote_ext *ext, const __u8 *payload) if (ext->motionp) { input_report_key(ext->input, - wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x04)); + wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x04)); input_report_key(ext->input, - wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x08)); + wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x08)); } else { input_report_key(ext->input, - wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x01)); + wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x01)); input_report_key(ext->input, - wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x02)); + wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x02)); } input_sync(ext->input);