[U-Boot] [PATCH] i.MX6: mx6qsabrelite: Add keypress support

Eric Nelson eric.nelson at boundarydevices.com
Sat Mar 3 01:11:01 CET 2012


On 03/02/2012 05:00 PM, Eric Nelson wrote:
> This patch adds support for the GPIO keyboard used on MX6Q SabreLite.
>
> This is generally used for invoking Android "recovery mode" in
> response to a long press of volume key down during boot.
>
> This can be tested by a boot script like so:
>      if keypress voldown&&  sleep 1&&  keypress voldown ; then
>            echo "do recovery thing" ;
>      fi
>
> Key values can be seen by issuing keypress with no arguments:
>
> 	MX6QSABRELITE U-Boot>  keypress
> 	keys: !menu	!back	!search	!home	!volup	!voldown
> ---
>   board/freescale/mx6qsabrelite/mx6qsabrelite.c |   76 +++++++++++++++++++++++++
>   1 files changed, 76 insertions(+), 0 deletions(-)
>
 > <snip>

I didn't want to litter the commit message with a lot of extraneous
discussion, but it appears that Android recovery mode can be invoked
either by Android itself or by a user pressing keys.

When Android wants to invoke recovery mode, it creates a special
"recovery" file and then re-boots.

The Freescale U-Boot release accomplishes this by having special
code to detect the keypress or the presence of the magic file.

http://opensource.freescale.com/git?p=imx/uboot-imx.git;a=blob;f=board/freescale/common/recovery.c;h=16e0be479ba543a8ceb865c3c2eee55379186bda;hb=imx_v2009.08_11.11.01

http://opensource.freescale.com/git?p=imx/uboot-imx.git;a=blob;f=board/freescale/mx53_loco/mx53_loco.c;h=fda52dc4abff6482d6cb102002529a3f2edd3bbb;hb=imx_v2009.08_11.11.01#l733

Since U-Boot can test files using the hush parser, it seems cleaner to just
enable keyboard detection and allow express the boot flow in boot commands.

I looked for, but didn't find precedent for testing keys.

Please advise if there's a more standard way to accomplish keypress
detection.

Regards,


Eric


More information about the U-Boot mailing list