From patchwork Wed Nov 11 17:05: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: 542965 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 E905A140549 for ; Thu, 12 Nov 2015 04:06:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=TqOqk058; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 11AB54B788; Wed, 11 Nov 2015 18:06:36 +0100 (CET) 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 B2PcB5feqx9h; Wed, 11 Nov 2015 18:06:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CB8424B76F; Wed, 11 Nov 2015 18:06:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9C15B4B718 for ; Wed, 11 Nov 2015 18:06:11 +0100 (CET) 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 JO7MdvuIuG5F for ; Wed, 11 Nov 2015 18:06:11 +0100 (CET) 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-f180.google.com (mail-ig0-f180.google.com [209.85.213.180]) by theia.denx.de (Postfix) with ESMTPS id 3C8614B70B for ; Wed, 11 Nov 2015 18:06:07 +0100 (CET) Received: by igcph11 with SMTP id ph11so76280774igc.1 for ; Wed, 11 Nov 2015 09:06:06 -0800 (PST) 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=db5JFr9sIAeJNSbSAVe0bQDFnaJvm0VoiFDeCF3t4Dg=; b=TqOqk058q2tTDLNV8s5Dw9LZZg34pGVfJI56EyUXBnPQco54fPTTJUlSj839CBG7X1 3narjJntUzxQG1b1tu4fnKtvEOi2D+ZG5jsXBib7OcW8XNmRCj4GhZOXBqf+m18k8/D4 9hXHuGKx++/1Zg4EFu/hKzGgG3two/1ENrc0p4+dEFFilnPGks72kNBJAww8PSpG+ssO A1c5Y+22GlwIkL18oIl7OAvSnr6G6bpn4QKtP+sxTn/KVwIGql30pK2RQyhlSFj/lfTs rl5R5t17QHXnOP/nlWu9o53TVI0CrRH9C0LQIHSlxXEXv8C2lb9KYKJM8BSuUmw5vE8E c2wg== 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=db5JFr9sIAeJNSbSAVe0bQDFnaJvm0VoiFDeCF3t4Dg=; b=MR3x1LnCsV1C3JYMQXlJv2ZCuWeadp0ybcVtp73ccZPvg+IccBO5bjsWNS53uF8sun P2kOy+W29EkSQ3MZcRnbxWs7ew5i3yuoNUcg6lF6XSctmA4CXGbgTkubXK5sJXFh5B0y 6FqSLeU+GGkih+aqzCOypfXDLQM2CR9n5U9TdfQPLIbtOOsRxSonxfmGmtRiPDl/tAPj QEz+BLR3VMtfAYpeO6BY2HNL4rAK+5DhiovZQqeI1q1gyCSgCgaIg4KHujDYAKlFmmKJ kkg3mwY0lJ1ly7M8YkWxyEEqFj3jqkLY9a7sE2LQdYKaT/EM08mjhj5LS7G8xxX67SMu JpeA== X-Gm-Message-State: ALoCoQnztECliVnvuDEcTNr35j5Ywz09D43xAkLdkF7UFAfBPZkRGpZ+BHd9IbbuDbIgh+FeCieM X-Received: by 10.50.61.230 with SMTP id t6mr10657630igr.28.1447261566023; Wed, 11 Nov 2015 09:06:06 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id u12sm8790244igr.22.2015.11.11.09.06.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2015 09:06:04 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 6071A2211F7; Wed, 11 Nov 2015 10:06:03 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Wed, 11 Nov 2015 10:05:40 -0700 Message-Id: <1447261548-14304-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1447261548-14304-1-git-send-email-sjg@chromium.org> References: <1447261548-14304-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v3 04/12] input: Allow updating of keyboard LEDs 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" Add a function which returns a new keyboard LED value when the LEDs need updating. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: None Changes in v2: None drivers/input/input.c | 9 +++++++++ include/input.h | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index a8a15c9..bf1acdc 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -276,6 +276,7 @@ static struct input_key_xlate *process_modifier(struct input_config *config, if (config->flags & FLAG_SCROLL_LOCK) leds |= INPUT_LED_SCROLL; config->leds = leds; + config->leds_changed = flip; } } @@ -587,6 +588,14 @@ void input_allow_repeats(struct input_config *config, bool allow_repeats) config->allow_repeats = allow_repeats; } +int input_leds_changed(struct input_config *config) +{ + if (config->leds_changed) + return config->leds; + + return -1; +} + int input_add_tables(struct input_config *config, bool german) { struct kbd_entry *entry; diff --git a/include/input.h b/include/input.h index c1af259..ad120e4 100644 --- a/include/input.h +++ b/include/input.h @@ -43,7 +43,8 @@ struct input_config { /* Which modifiers are active (1 bit for each MOD_... value) */ uchar modifiers; uchar flags; /* active state keys (FLAGS_...) */ - uchar leds; /* active LEDS (INPUT_LED_...) */ + uchar leds; /* active LEDs (INPUT_LED_...) */ + uchar leds_changed; /* LEDs that just changed */ uchar num_tables; /* number of modifier tables */ int prev_keycodes[INPUT_BUFFER_LEN]; /* keys held last time */ int num_prev_keycodes; /* number of prev keys */ @@ -162,6 +163,17 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms, void input_allow_repeats(struct input_config *config, bool allow_repeats); /** + * Check if keyboard LEDs need to be updated + * + * This can be called after input_tstc() to see if keyboard LEDs need + * updating. + * + * @param config Input state + * @return -1 if no LEDs need updating, other value if they do + */ +int input_leds_changed(struct input_config *config); + +/** * Set up the key map tables * * This must be called after input_init() or keycode decoding will not work.