public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow
Date: Sat, 21 Apr 2012 07:46:00 +0200	[thread overview]
Message-ID: <4F924998.2010603@googlemail.com> (raw)
In-Reply-To: <1334604834-8489-1-git-send-email-eric.nelson@boundarydevices.com>

Dear Eric,

On 16.04.2012 21:33, Eric Nelson wrote:
> Uses the 'magic_keys' idiom as described in doc/README.kbd:
> 	http://lists.denx.de/pipermail/u-boot/2012-April/122502.html
>
> Signed-off-by: Eric Nelson<eric.nelson@boundarydevices.com>
> ---
> V2 based on suggestion by Wolfgang to follow prior implementations.
> V3 fixes style issues highlighted by Marek Vasut.
>
>   board/freescale/mx6qsabrelite/mx6qsabrelite.c |  121 ++++++++++++++++++++++++-
>   include/configs/mx6qsabrelite.h               |    3 +
>   2 files changed, 122 insertions(+), 2 deletions(-)
>
> diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> index 1d09a72..3684216 100644
> --- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
> +++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
...
> +#ifdef CONFIG_PREBOOT
> +static char const kbd_magic_prefix[] = "key_magic";
> +static char const kbd_command_prefix[] = "key_cmd";
> +
> +static void preboot_keys(void)
> +{
> +	int i, numpressed;

mx6qsabrelite.c: In function 'preboot_keys':
mx6qsabrelite.c:408: warning: unused variable 'i'

> +	char keypress[ARRAY_SIZE(buttons)+1];
> +	numpressed = read_keys(keypress);
> +	if (numpressed) {
> +		char *kbd_magic_keys = getenv("magic_keys");
> +		char *suffix;
> +		/*
> +		 * loop over all magic keys
> +		 */
> +		for (suffix = kbd_magic_keys; *suffix; ++suffix) {
> +			char *keys;
> +			char magic[sizeof(kbd_magic_prefix) + 1];
> +			sprintf(magic, "%s%c", kbd_magic_prefix, *suffix);
> +			keys = getenv(magic);
> +			if (keys) {
> +				if (!strcmp(keys, keypress))
> +					break;
> +			}
> +		}
> +		if (*suffix) {
> +			char cmd_name[sizeof(kbd_command_prefix) + 1];
> +			char *cmd;
> +			sprintf(cmd_name, "%s%c", kbd_command_prefix, *suffix);
> +			cmd = getenv(cmd_name);
> +			if (cmd) {
> +				setenv("preboot", cmd);
> +				return;
> +			}
> +		}
> +	}
> +}
> +#endif
> +
> +int misc_init_r(void)
> +{
> +#ifdef CONFIG_PREBOOT
> +	preboot_keys();
> +#endif
> +}

mx6qsabrelite.c: In function 'misc_init_r':
mx6qsabrelite.c:446: warning: control reaches end of non-void function

Best regards

Dirk

      parent reply	other threads:[~2012-04-21  5:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 19:33 [U-Boot] [PATCH V3] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow Eric Nelson
2012-04-16 22:24 ` Marek Vasut
2012-04-21  5:46 ` Dirk Behme [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F924998.2010603@googlemail.com \
    --to=dirk.behme@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox