[U-Boot] [PATCH V3] i.MX6Q: mx6qsabrelite: Add keypress support to alter boot flow

Dirk Behme dirk.behme at googlemail.com
Sat Apr 21 07:46:00 CEST 2012


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 at 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


More information about the U-Boot mailing list