From patchwork Sat Sep 1 19:46:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 1395481 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 2423CDFABE for ; Sat, 1 Sep 2012 19:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755552Ab2IATmF (ORCPT ); Sat, 1 Sep 2012 15:42:05 -0400 Received: from smtprelay-b22.telenor.se ([195.54.99.213]:36922 "EHLO smtprelay-b22.telenor.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754906Ab2IATmE (ORCPT ); Sat, 1 Sep 2012 15:42:04 -0400 Received: from ipb4.telenor.se (ipb4.telenor.se [195.54.127.167]) by smtprelay-b22.telenor.se (Postfix) with ESMTP id DB7EDEAE4D; Sat, 1 Sep 2012 21:42:01 +0200 (CEST) X-SENDER-IP: [85.230.170.20] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnxPAG1kQlBV5qoUPGdsb2JhbABEhRyFI7BfGQEBAQEeGQ0ngiEBBScvEwEPEAhJOQoUBgESiBG6NxSSHAObR4NFiUw X-IronPort-AV: E=Sophos;i="4.80,353,1344204000"; d="scan'208";a="107233549" Received: from c-14aae655.710-13-64736c12.cust.bredbandsbolaget.se (HELO polaris) ([85.230.170.20]) by ipb4.telenor.se with SMTP; 01 Sep 2012 21:41:59 +0200 Received: by polaris (sSMTP sendmail emulation); Sat, 01 Sep 2012 21:48:01 +0200 From: "Henrik Rydberg" To: Dmitry Torokhov , Jiri Kosina Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH v3 03/20] Input: Make sure we follow all EV_KEY events Date: Sat, 1 Sep 2012 21:46:58 +0200 Message-Id: <1346528835-363-4-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346528835-363-1-git-send-email-rydberg@euromail.se> References: <1346528835-363-1-git-send-email-rydberg@euromail.se> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org For some EV_KEY types, sending a larger-than-one value causes the input state to oscillate. This patch makes sure this cannot happen, clearing up the autorepeat bypass logic in the process. Signed-off-by: Henrik Rydberg Acked-by: Dmitry Torokhov --- drivers/input/input.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index 8ebf116..4d64500 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -239,24 +239,30 @@ static void input_handle_event(struct input_dev *dev, break; case EV_KEY: - if (is_event_supported(code, dev->keybit, KEY_MAX) && - !!test_bit(code, dev->key) != value) { + if (is_event_supported(code, dev->keybit, KEY_MAX)) { + + /* auto-repeat bypasses state updates */ + if (value == 2) { + disposition = INPUT_PASS_TO_HANDLERS; + break; + } + + if (!!test_bit(code, dev->key) != !!value) { - if (value != 2) { __change_bit(code, dev->key); + disposition = INPUT_PASS_TO_HANDLERS; + if (value) input_start_autorepeat(dev, code); else input_stop_autorepeat(dev); } - - disposition = INPUT_PASS_TO_HANDLERS; } break; case EV_SW: if (is_event_supported(code, dev->swbit, SW_MAX) && - !!test_bit(code, dev->sw) != value) { + !!test_bit(code, dev->sw) != !!value) { __change_bit(code, dev->sw); disposition = INPUT_PASS_TO_HANDLERS; @@ -283,7 +289,7 @@ static void input_handle_event(struct input_dev *dev, case EV_LED: if (is_event_supported(code, dev->ledbit, LED_MAX) && - !!test_bit(code, dev->led) != value) { + !!test_bit(code, dev->led) != !!value) { __change_bit(code, dev->led); disposition = INPUT_PASS_TO_ALL;