From patchwork Sun Aug 12 21:42:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 1310551 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 B52A03FD8C for ; Sun, 12 Aug 2012 21:45:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752707Ab2HLVka (ORCPT ); Sun, 12 Aug 2012 17:40:30 -0400 Received: from smtprelay-b12.telenor.se ([62.127.194.21]:52503 "EHLO smtprelay-b12.telenor.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630Ab2HLVjf (ORCPT ); Sun, 12 Aug 2012 17:39:35 -0400 Received: from ipb3.telenor.se (ipb3.telenor.se [195.54.127.166]) by smtprelay-b12.telenor.se (Postfix) with ESMTP id AE110C9D3; Sun, 12 Aug 2012 23:39:34 +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: Ap1OAA8iKFBV5qoUPGdsb2JhbABEhRiFI68/GQEBAQE3NIIhAQUnLxMBDxAISTkKFAYBEogRtjoUkS8DmzaDQYlF X-IronPort-AV: E=Sophos;i="4.77,756,1336341600"; d="scan'208";a="173154325" Received: from c-14aae655.710-13-64736c12.cust.bredbandsbolaget.se (HELO polaris) ([85.230.170.20]) by ipb3.telenor.se with SMTP; 12 Aug 2012 23:39:33 +0200 Received: by polaris (sSMTP sendmail emulation); Sun, 12 Aug 2012 23:43:12 +0200 From: "Henrik Rydberg" To: Dmitry Torokhov , Jiri Kosina Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH 04/19] Input: Make sure we follow all EV_KEY events Date: Sun, 12 Aug 2012 23:42:22 +0200 Message-Id: <1344807757-2217-5-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1344807757-2217-1-git-send-email-rydberg@euromail.se> References: <1344807757-2217-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 --- 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;