From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Nelson Date: Fri, 02 Mar 2012 17:11:01 -0700 Subject: [U-Boot] [PATCH] i.MX6: mx6qsabrelite: Add keypress support In-Reply-To: <1330732824-15345-1-git-send-email-eric.nelson@boundarydevices.com> References: <1330732824-15345-1-git-send-email-eric.nelson@boundarydevices.com> Message-ID: <4F516195.3060301@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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(-) > > 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