All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Pratyush Yadav <p.yadav@ti.com>,
	Walter Lozano <walter.lozano@collabora.com>
Subject: [PATCH 14/22] cros_ec: Use standard calls for recovery-request checking
Date: Mon,  5 Jul 2021 16:32:52 -0600	[thread overview]
Message-ID: <20210705223300.2139971-13-sjg@chromium.org> (raw)
In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org>

Rather than calling directly into the sandbox SDL code, we can use the
normal U-Boot console handling for this feature. Update the code, to make
it more generic.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/misc/cros_ec_sandbox.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index 6a95a9132a6..17fca0f9f00 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -622,15 +622,19 @@ void cros_ec_check_keyboard(struct udevice *dev)
 	struct ec_state *ec = dev_get_priv(dev);
 	ulong start;
 
-	printf("Press keys for EC to detect on reset (ESC=recovery)...");
+	printf("\nPress keys for EC to detect on reset (ESC=recovery)...");
 	start = get_timer(0);
-	while (get_timer(start) < 1000)
-		;
-	putc('\n');
-	if (!sandbox_sdl_key_pressed(KEY_ESC)) {
-		ec->recovery_req = true;
-		printf("   - EC requests recovery\n");
+	while (get_timer(start) < 2000) {
+		if (tstc()) {
+			int ch = getchar();
+
+			if (ch == 0x1b) {
+				ec->recovery_req = true;
+				printf("EC requests recovery");
+			}
+		}
 	}
+	putc('\n');
 }
 
 /* Return the byte of EC switch states */
-- 
2.32.0.93.g670b81a890-goog


  parent reply	other threads:[~2021-07-05 22:35 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 22:32 [PATCH 00/22] Various fixes and enhancements Simon Glass
2021-07-05 22:32 ` [PATCH 01/22] dm: core: Add logging for DM_SEQ_ALIAS Simon Glass
2021-07-05 22:32 ` [PATCH 02/22] dm: Support lzma in the flashmap Simon Glass
2021-07-05 22:32 ` [PATCH 03/22] test: Allow CONFIG_SPL_LOAD_FIT to be disabled Simon Glass
2021-07-05 22:32 ` [PATCH 04/22] test: Add DM_DMA " Simon Glass
2021-07-05 22:32 ` [PATCH 05/22] test: Avoid a build error with SPL Simon Glass
2021-07-05 22:32 ` [PATCH 06/22] Makefile: Avoid rebuilding .dtb files each time Simon Glass
2021-07-05 22:32 ` [PATCH 07/22] sandbox: Support executables for more phases Simon Glass
2021-07-05 22:32 ` [PATCH 08/22] sandbox: Add work-around for SDL2 display Simon Glass
2021-07-22  6:00   ` Heinrich Schuchardt
2021-07-22 13:28     ` Simon Glass
2021-07-05 22:32 ` [PATCH 09/22] sandbox: Use hinting with the display Simon Glass
2021-07-05 22:32 ` [PATCH 10/22] sandbox: Adjust the bloblist default address Simon Glass
2021-07-05 22:32 ` [PATCH 11/22] cros_ec: Allow reading the battery-charge state Simon Glass
2021-07-05 22:32 ` [PATCH 12/22] cros_ec: Drop cros_ec_entering_mode() Simon Glass
2021-07-05 22:32 ` [PATCH 13/22] cros_ec: Support the full-size vboot context Simon Glass
2021-07-05 22:32 ` Simon Glass [this message]
2021-07-05 22:32 ` [PATCH 15/22] bloblist: Support resizing a blob Simon Glass
2021-07-05 22:32 ` [PATCH 16/22] bloblist: Tidy up a few API comments Simon Glass
2021-07-05 22:32 ` [PATCH 17/22] bloblist: Correct condition in bloblist_addrec() Simon Glass
2021-07-05 22:32 ` [PATCH 18/22] image: Allow @ in node names when not using signatures Simon Glass
2021-07-17 20:40   ` Simon Glass
2021-07-05 22:32 ` [PATCH 19/22] spl: Provide more information on boot failure Simon Glass
2021-07-05 22:32 ` [PATCH 20/22] sandbox: mmc: Support fixed MMC devices Simon Glass
2021-07-06  1:12   ` Jaehoon Chung
2021-07-17 20:39   ` Simon Glass
2021-07-05 22:32 ` [PATCH 21/22] blk: Support iteration Simon Glass
2021-07-05 22:33 ` [PATCH 22/22] log: Allow padding of the function name Simon Glass
2021-07-17 20:39 ` Simon Glass
2021-07-17 20:39 ` [PATCH 21/22] blk: Support iteration Simon Glass
2021-07-17 20:39 ` [PATCH 19/22] spl: Provide more information on boot failure Simon Glass
2021-07-17 20:39 ` [PATCH 17/22] bloblist: Correct condition in bloblist_addrec() Simon Glass
2021-07-17 20:39 ` [PATCH 16/22] bloblist: Tidy up a few API comments Simon Glass
2021-07-17 20:39 ` [PATCH 15/22] bloblist: Support resizing a blob Simon Glass
2021-07-17 20:39 ` [PATCH 14/22] cros_ec: Use standard calls for recovery-request checking Simon Glass
2021-07-17 20:39 ` [PATCH 13/22] cros_ec: Support the full-size vboot context Simon Glass
2021-07-17 20:39 ` [PATCH 12/22] cros_ec: Drop cros_ec_entering_mode() Simon Glass
2021-07-17 20:39 ` [PATCH 11/22] cros_ec: Allow reading the battery-charge state Simon Glass
2021-07-17 20:39 ` [PATCH 10/22] sandbox: Adjust the bloblist default address Simon Glass
2021-07-17 20:39 ` [PATCH 09/22] sandbox: Use hinting with the display Simon Glass
2021-07-17 20:39 ` [PATCH 08/22] sandbox: Add work-around for SDL2 display Simon Glass
2021-07-17 20:39 ` [PATCH 07/22] sandbox: Support executables for more phases Simon Glass
2021-07-17 20:39 ` [PATCH 06/22] Makefile: Avoid rebuilding .dtb files each time Simon Glass
2021-07-18 13:34   ` Masahiro Yamada
2021-07-22  2:13     ` Simon Glass
2021-07-17 20:39 ` [PATCH 05/22] test: Avoid a build error with SPL Simon Glass
2021-07-17 20:39 ` [PATCH 04/22] test: Add DM_DMA to be disabled Simon Glass
2021-07-17 20:39 ` [PATCH 03/22] test: Allow CONFIG_SPL_LOAD_FIT " Simon Glass
2021-07-17 20:39 ` [PATCH 02/22] dm: Support lzma in the flashmap Simon Glass
2021-07-17 20:39 ` [PATCH 01/22] dm: core: Add logging for DM_SEQ_ALIAS Simon Glass

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=20210705223300.2139971-13-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=alpernebiyasak@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=p.yadav@ti.com \
    --cc=u-boot@lists.denx.de \
    --cc=walter.lozano@collabora.com \
    --cc=xypron.glpk@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.