From patchwork Wed Sep 9 04:32:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 515683 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A14E7140134 for ; Wed, 9 Sep 2015 14:35:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=L0blKCMZ; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3EBEB4B7AF; Wed, 9 Sep 2015 06:34:55 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XICw_OvW1-yC; Wed, 9 Sep 2015 06:34:55 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C0BB64B7C9; Wed, 9 Sep 2015 06:33:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A9AB04B7CC for ; Wed, 9 Sep 2015 06:33:35 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UF8T1itIS7My for ; Wed, 9 Sep 2015 06:33:35 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by theia.denx.de (Postfix) with ESMTPS id 3EC194B7BC for ; Wed, 9 Sep 2015 06:33:27 +0200 (CEST) Received: by igbni9 with SMTP id ni9so5793723igb.0 for ; Tue, 08 Sep 2015 21:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=U2eW+cp10mjTIxLiYDnA2nnUNkvPgvzHZZ9mPD0OttU=; b=L0blKCMZ2tykeSuZnDPO/kjK4SRmNMancEpSQseOyy4FSezo01bRkWlwcP/MJoB7Yz B3aSaN2jgtNKj6l3MNOOl9VRKRO8eRt0Jc55XPWpU/QkIopwtjUTtHyy66GZSjtvYjbd og9G0O3HevGwl7F/q8vDJp5NtWgNTdRFnxsjqcKhwvpkl3YyXlikSteK8hBlgiVRCost /GC0bdj++qUQ+yz9fkoyOv6g9HqxcoVD4fmK1T77i6GEQTFOngB8XL8PrzK+v/b8zbXL sZtEiV1R9JP/IKYdkavO90bZNhHvezhhNMmq5Q29FLN5mxNfUrZ8qnMPdbWqZBg5gn7c V8ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=U2eW+cp10mjTIxLiYDnA2nnUNkvPgvzHZZ9mPD0OttU=; b=N4r0xFtnnN4K3GgKqxthRXmc/GSWj5a+pd9OnQIiIeYIeRRgJnkDpQeMHXCq83/8Bq SfJNKDcsvCieq3MP30udJ4nc+d0+AdsgKD3WgI0DheVuAycRizISEFplT1nKreYskAVE DWLIaC8FoT9x27b61d/WfKP8aTtMHl5rgoeudytvoqHAEaiIACjbk1Q3ZxdInNOG33vf Mft9/0XtGntLxIdIzN85rsnmDmb3PY4juK+91tlnUzswe3VKk3k7Y9vA+ptVYSX5b9qC ayEQgE8dLj+nYbBnEVFUu05AAHsxCENl0JlG412r4SpGLWFFSz8YNBGrMCn7jpAH/QZz pY7A== X-Gm-Message-State: ALoCoQlrVS3KxjGaCKoaLVLFqEWV5p7QlKOc3soEnvohY5JFwURLTGj2E0TF1J0/NJMA7H4AVngx X-Received: by 10.50.66.198 with SMTP id h6mr29667108igt.31.1441773205947; Tue, 08 Sep 2015 21:33:25 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id 3sm900746igy.10.2015.09.08.21.33.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 21:33:25 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id DD1782209A7; Tue, 8 Sep 2015 22:33:19 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 8 Sep 2015 22:32:40 -0600 Message-Id: <1441773171-4575-18-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc0.131.gf624c3d In-Reply-To: <1441773171-4575-1-git-send-email-sjg@chromium.org> References: <1441773171-4575-1-git-send-email-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 17/28] input: Allow repeat filtering to be disabled X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Generally the input library handles processing of a list of scanned keys. Repeated keys need to be generated based on a timer in this case, since all that is provided is a list of keys current depressed. Keyboards which do their own scanning will resend codes when they want to inject a repeating key. Provide a function which tells the input library to accept repeating keys and not to try to second-guess the caller. Signed-off-by: Simon Glass --- drivers/input/input.c | 9 +++++++-- include/input.h | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index c7b6d52..c488f3a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -413,8 +413,8 @@ static int _input_send_keycodes(struct input_config *config, int keycode[], * insert another character if we later realise that we * have missed a repeat slot. */ - is_repeat = config->repeat_rate_ms && - (int)get_timer(config->next_repeat_ms) >= 0; + is_repeat = config->allow_repeats || (config->repeat_rate_ms && + (int)get_timer(config->next_repeat_ms) >= 0); if (!is_repeat) return 0; } @@ -495,6 +495,11 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms, config->repeat_rate_ms = repeat_rate_ms; } +void input_allow_repeats(struct input_config *config, bool allow_repeats) +{ + config->allow_repeats = allow_repeats; +} + int input_add_tables(struct input_config *config) { input_add_table(config, -1, -1, diff --git a/include/input.h b/include/input.h index 9942d6f..e56f500 100644 --- a/include/input.h +++ b/include/input.h @@ -57,6 +57,7 @@ struct input_config { * unknown */ int (*read_keys)(struct input_config *config); + bool allow_repeats; /* Don't filter out repeats */ unsigned int next_repeat_ms; /* Next time we repeat a key */ unsigned int repeat_delay_ms; /* Time before autorepeat starts */ unsigned int repeat_rate_ms; /* Autorepeat rate in ms */ @@ -143,6 +144,24 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms, int repeat_rate_ms); /** + * Tell the input layer whether to allow the caller to determine repeats + * + * Generally the input library handles processing of a list of scanned keys. + * Repeated keys need to be generated based on a timer in this case, since all + * that is provided is a list of keys current depressed. + * + * Keyboards which do their own scanning will resend codes when they want to + * inject a repeating key. This function can be called at start-up to select + * this behaviour. + * + * @param config Input state + * @param allow_repeats true to repeat depressed keys every time + * input_send_keycodes() is called, false to do normal + * keyboard repeat processing with a timer. + */ +void input_allow_repeats(struct input_config *config, bool allow_repeats); + +/** * Set up the key map tables * * This must be called after input_init() or keycode decoding will not work.