From patchwork Wed Sep 9 04:32:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 515697 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 372E5140497 for ; Wed, 9 Sep 2015 14:43:14 +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=opiyIXc2; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B86FF4B7DD; Wed, 9 Sep 2015 06:42:57 +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 L1qy6BZwP6AF; Wed, 9 Sep 2015 06:42:57 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5839F4B7D5; Wed, 9 Sep 2015 06:42:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D49FE4B71C for ; Wed, 9 Sep 2015 06:42:19 +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 X6wjyBMctsVw for ; Wed, 9 Sep 2015 06:42:19 +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-io0-f172.google.com (mail-io0-f172.google.com [209.85.223.172]) by theia.denx.de (Postfix) with ESMTPS id 7524B4B79B for ; Wed, 9 Sep 2015 06:42:15 +0200 (CEST) Received: by iofh134 with SMTP id h134so9205253iof.0 for ; Tue, 08 Sep 2015 21:42:14 -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=nwGHgkmGIqtj0EyR5qbmQ9AQnLRWhgxH1MvYi6iM5BU=; b=opiyIXc2t9jmhnWYTF6k0ASD+Mi3XELlMB4wNCDUMI3bJs7F5cpPpBZbdoC6srWGLp 19lfGKeYK2UdHJtI7BgTHKr3OH01CYIo4aBQndLoo8uZTJn+9UFjZL55OEfeTfhriDf6 EcQCiZ0Ol7n+VxF2LjrL6mnMhk2HsY2TCTZb7yBQWhi2/OcaRuV0H/dIvwMSJ9Qm84u1 Imons1LnNWYUjGs6XK9i3xoRkIYVl2nw4A3OPupAFFseaPExXLPw0QNv6ouVyVmFyjnV JN788rqnjUAQITJ9oHyv2dsGKb3+WGithgwOXpVnqTOTFTIgK7TSpGPcWSWND6tu3c5y a+3w== 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=nwGHgkmGIqtj0EyR5qbmQ9AQnLRWhgxH1MvYi6iM5BU=; b=eQyC0Rwlkmpg2XMBgFGJGVbYQ3ZwELw6JYg423F5IM3g5n6begcGSl6k6Vk3tScyF+ XVWkXSiY8oGkX3t7k+k/Ylwq8Gpp9BrqOF41yapiR7EJueg4QilNRkjtI93dVp/VE5D/ bHEkWo0oOMmV+jwtcJkWboFVItN5Gi4gl/sgxnyExhnbfufN5HgjFsFO1gyqdoxkM9WL VzX080WDJO/e3Adb/xWej1lffymQWvf88avytIpl97cGsBBKYpGGOyq7j+OnmcB0H0mH rqjNJIhLEF+plcEC9VVa67qw7KLW0cg1/0RnWNEesZeVtz63SHd1pRo7IlxRxmkTzkN9 6RrQ== X-Gm-Message-State: ALoCoQlyK7n4pwKcvfZthVQJ55OEUNwkSwV8MiCwrubddfBzVX4VV7d54CKCiWUO4TeegieU9s3I X-Received: by 10.107.128.145 with SMTP id k17mr47223868ioi.24.1441773733957; Tue, 08 Sep 2015 21:42:13 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:29c2:aacf:f3d3:bb56]) by smtp.gmail.com with ESMTPSA id b5sm3818342iob.39.2015.09.08.21.42.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Sep 2015 21:42:12 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 5FB5C220BB2; Tue, 8 Sep 2015 22:33:20 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 8 Sep 2015 22:32:44 -0600 Message-Id: <1441773171-4575-22-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 21/28] 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 --- 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 c5fd8e9..51d7e8f 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -247,6 +247,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; } } @@ -558,6 +559,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) { if (german) { 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.