public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED
@ 2008-12-10 15:24 Peter Korsgaard
  2008-12-11 23:38 ` Wolfgang Denk
  2009-01-24  0:24 ` Wolfgang Denk
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Korsgaard @ 2008-12-10 15:24 UTC (permalink / raw)
  To: u-boot

Support bootdelay=0 in abortboot for the CONFIG_AUTOBOOT_KEYED case
similar to the CONFIG_ZERO_BOOTDELAY_CHECK support for the
!CONFIG_AUTOBOOT_KEYED case.

Do this by reversing the loop so we do atleast one iteration before
checking for timeout.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 common/main.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/common/main.c b/common/main.c
index a999a5d..4c4f780 100644
--- a/common/main.c
+++ b/common/main.c
@@ -158,7 +158,19 @@ static __inline__ int abortboot(int bootdelay)
 	/* In order to keep up with incoming data, check timeout only
 	 * when catch up.
 	 */
-	while (!abort && get_ticks() <= etime) {
+	do {
+		if (tstc()) {
+			if (presskey_len < presskey_max) {
+				presskey [presskey_len ++] = getc();
+			}
+			else {
+				for (i = 0; i < presskey_max - 1; i ++)
+					presskey [i] = presskey [i + 1];
+
+				presskey [i] = getc();
+			}
+		}
+
 		for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
 			if (delaykey[i].len > 0 &&
 			    presskey_len >= delaykey[i].len &&
@@ -178,19 +190,8 @@ static __inline__ int abortboot(int bootdelay)
 				abort = 1;
 			}
 		}
+	} while (!abort && get_ticks() <= etime);
 
-		if (tstc()) {
-			if (presskey_len < presskey_max) {
-				presskey [presskey_len ++] = getc();
-			}
-			else {
-				for (i = 0; i < presskey_max - 1; i ++)
-					presskey [i] = presskey [i + 1];
-
-				presskey [i] = getc();
-			}
-		}
-	}
 #  if DEBUG_BOOTKEYS
 	if (!abort)
 		puts("key timeout\n");
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED
  2008-12-10 15:24 [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED Peter Korsgaard
@ 2008-12-11 23:38 ` Wolfgang Denk
  2008-12-11 23:52   ` Peter Korsgaard
  2009-01-24  0:24 ` Wolfgang Denk
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2008-12-11 23:38 UTC (permalink / raw)
  To: u-boot

Dear Peter Korsgaard,

In message <1228922656-27689-1-git-send-email-jacmet@sunsite.dk> you wrote:
> Support bootdelay=0 in abortboot for the CONFIG_AUTOBOOT_KEYED case
> similar to the CONFIG_ZERO_BOOTDELAY_CHECK support for the
> !CONFIG_AUTOBOOT_KEYED case.

Ummm... how do you enter the "password" when you have no time to do
this?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No one wants war.
	-- Kirk, "Errand of Mercy", stardate 3201.7

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED
  2008-12-11 23:38 ` Wolfgang Denk
@ 2008-12-11 23:52   ` Peter Korsgaard
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2008-12-11 23:52 UTC (permalink / raw)
  To: u-boot

>>>>> "Wolfgang" == Wolfgang Denk <wd@denx.de> writes:

 Wolfgang> Dear Peter Korsgaard,
 Wolfgang> In message <1228922656-27689-1-git-send-email-jacmet@sunsite.dk> you wrote:
 >> Support bootdelay=0 in abortboot for the CONFIG_AUTOBOOT_KEYED case
 >> similar to the CONFIG_ZERO_BOOTDELAY_CHECK support for the
 >> !CONFIG_AUTOBOOT_KEYED case.

 Wolfgang> Ummm... how do you enter the "password" when you have no time to do
 Wolfgang> this?

Before the loop starts, just like the CONFIG_ZERO_BOOTDELAY_CHECK
stuff.

E.G. I have:

#define CONFIG_BOOTDELAY        0
#define CONFIG_AUTOBOOT_KEYED   1
#define CONFIG_AUTOBOOT_STOP_STR "c"

And I can stop autoboot if I connect a serial cable to the board and
hold down the 'c' button while powering up the board.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED
  2008-12-10 15:24 [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED Peter Korsgaard
  2008-12-11 23:38 ` Wolfgang Denk
@ 2009-01-24  0:24 ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-01-24  0:24 UTC (permalink / raw)
  To: u-boot

Dear Peter Korsgaard,

In message <1228922656-27689-1-git-send-email-jacmet@sunsite.dk> you wrote:
> Support bootdelay=0 in abortboot for the CONFIG_AUTOBOOT_KEYED case
> similar to the CONFIG_ZERO_BOOTDELAY_CHECK support for the
> !CONFIG_AUTOBOOT_KEYED case.
> 
> Do this by reversing the loop so we do atleast one iteration before
> checking for timeout.
> 
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
> ---
>  common/main.c |   27 ++++++++++++++-------------
>  1 files changed, 14 insertions(+), 13 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It became apparent that one reason why the Ice Giants were  known  as
the  Ice  Giants  was  because they were, well, giants. The other was
that they were made of ice.              -Terry Pratchett, _Sourcery_

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-24  0:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 15:24 [U-Boot] [PATCH] common/main: support bootdelay=0 for CONFIG_AUTOBOOT_KEYED Peter Korsgaard
2008-12-11 23:38 ` Wolfgang Denk
2008-12-11 23:52   ` Peter Korsgaard
2009-01-24  0:24 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox