Skip to contentSkip to conversation

ctrl-c detection (on 4xx platforms)

U-Boot Matthias Fuchs 2 participants 6 messages Sep 11, 2008 – Sep 13, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine. The command waits for a condition and displays a rotating cursor (see board/esd/common/cmd_loadpci.c):

...
int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])

{
	...
	char str[] = "\\|/-";
	...

	while(1) {
		...
		*ptr = 0xffffffff;
		puts("\nWaiting for action from pci host -");

		/*
		 * Wait for host to write the start address
		 */
		while (*ptr == 0xffffffff) {
			count++;
			if (!(count % 100)) {
				count2++;
				putc(0x08); /* backspace */
				putc(str[count2 % 4]);
			}

			/* Abort if ctrl-c was pressed */
			if (ctrlc()) {
				puts("\nAbort\n");
				return 0;
			}

			udelay(1000);
		}
	}
	...
}

But when I call this bsp command as bootcmd CTRL-C does not stop the while loop. So CTRL-C is not detected. Any idea?

Matthias

#1 lore raw

Dear Matthias Fuchs,

Quoted 3 lines · In message <[email protected]> you wrote:

I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine.

...

Quoted 2 lines

But when I call this bsp command as bootcmd CTRL-C does not stop the while loop. So CTRL-C is not detected. Any idea?

Do you happen to have CONFIG_AUTOBOOT_KEYED set in your board configuration?

Best regards,

Wolfgang Denk

Signature · 6 lines
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
Program maintenance is an entropy-increasing process,  and  even  its
most skilfull execution only delays the subsidence of the system into
unfixable obsolescence.       - Fred Brooks, "The Mythical Man Month"
#2 lore raw

Hi Wolfgang,

yes I do have CONFIG_AUTOBOOT_KEYED enabled. It's the PMC440 board:

include/configs/PMC440.h:
...
#define CONFIG_AUTOBOOT_KEYED 1
#define CONFIG_AUTOBOOT_PROMPT \
"Press SPACE to abort autoboot in %d seconds\n", bootdelay
#undef CONFIG_AUTOBOOT_DELAY_STR
#define CONFIG_AUTOBOOT_STOP_STR " "
...

Matthias

Quoted 17 lines · Wolfgang Denk

Dear Matthias Fuchs,

Quoted 3 lines · In message <[email protected]> you wrote:

I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine.

...

Quoted 2 lines

But when I call this bsp command as bootcmd CTRL-C does not stop the while loop. So CTRL-C is not detected. Any idea?

Do you happen to have CONFIG_AUTOBOOT_KEYED set in your board configuration?

Best regards,

Wolfgang Denk

#3 lore raw

Hi,

when I disable CONFIG_AUTOBOOT_KEYED ctrl-c checking is not disabled. We are using CONFIG_AUTOBOOT_KEYED to have a special key (SPACE) to abort autoboot and not the 'any' key.

Is there any special reason why ctrl-c checking is disabled for CONFIG_AUTOBOOT_KEYED?

Matthias

Quoted 40 lines · Matthias Fuchs

Hi Wolfgang,

yes I do have CONFIG_AUTOBOOT_KEYED enabled. It's the PMC440 board:

include/configs/PMC440.h:
...
#define CONFIG_AUTOBOOT_KEYED 1
#define CONFIG_AUTOBOOT_PROMPT \
"Press SPACE to abort autoboot in %d seconds\n", bootdelay
#undef CONFIG_AUTOBOOT_DELAY_STR
#define CONFIG_AUTOBOOT_STOP_STR " "
...

Matthias

Quoted 10 lines · Wolfgang Denk

Dear Matthias Fuchs,

Quoted 3 lines · In message <[email protected]> you wrote:

I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine.

...

Quoted 2 lines

But when I call this bsp command as bootcmd CTRL-C does not stop the while loop. So CTRL-C is not detected. Any idea?

Quoted 7 lines

Do you happen to have CONFIG_AUTOBOOT_KEYED set in your board configuration?

Best regards,

Wolfgang Denk

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 13 lines
-------------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs
Head of System Design

esd electronic system design gmbh
Vahrenwalder Str. 207 - 30165 Hannover - GERMANY
Phone: +49-511-37298-0 - Fax: +49-511-37298-68
Please visit our homepage http://www.esd.eu
Quality Products - Made in Germany
-------------------------------------------------------------------------
Gesch?ftsf?hrer: Klaus Detering, Dr. Werner Schulze
Amtsgericht Hannover HRB 51373 - VAT-ID DE 115672832
-------------------------------------------------------------------------
#4 lore raw

Dear Matthias Fuchs,

Quoted 2 lines · In message <[email protected]> you wrote:

when I disable CONFIG_AUTOBOOT_KEYED ctrl-c checking is not disabled.

I think there is one "dis" ot "not" too many.

Quoted 2 lines

We are using CONFIG_AUTOBOOT_KEYED to have a special key (SPACE) to abort autoboot and not the 'any' key.

I thought so.

Quoted 1 line

Is there any special reason why ctrl-c checking is disabled for CONFIG_AUTOBOOT_KEYED?

Excellent question. Next question, please.

I think the rationale behind this is to prevent users from getting an
interactive prompt by just pressing ^C - the intention of
CONFIG_AUTOBOOT_KEYED is similar to a login with password - without the correct password you are denied access to an interactive inter- face.

But if you could use ^C as soon as the bootcmd has started - what should happen next? We cannot simply drop you into the interactive shell?

Best regards,

Wolfgang Denk

Signature · 5 lines
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
When the ax entered the forest, the trees said, "The handle is one of
us!"                                               -- Turkish proverb
#5 lore raw

Hi Wolfgang,

Quoted 3 lines · On Friday 12 September 2008 11:08:51 Wolfgang Denk wrote:

Dear Matthias Fuchs,

In message <[email protected]> you

Quoted 3 lines · wrote:
Quoted 1 line

when I disable CONFIG_AUTOBOOT_KEYED ctrl-c checking is not disabled.

I think there is one "dis" ot "not" too many.

:-)

Quoted 9 lines
Quoted 3 lines

We are using CONFIG_AUTOBOOT_KEYED to have a special key (SPACE) to abort autoboot and not the 'any' key.

I thought so.

Quoted 2 lines

Is there any special reason why ctrl-c checking is disabled for CONFIG_AUTOBOOT_KEYED?

Quoted 8 lines

Excellent question. Next question, please.

I think the rationale behind this is to prevent users from getting an
interactive prompt by just pressing ^C - the intention of
CONFIG_AUTOBOOT_KEYED is similar to a login with password - without the correct password you are denied access to an interactive inter- face.

I see. This makes sense.

Quoted 4 lines

But if you could use ^C as soon as the bootcmd has started - what should happen next? We cannot simply drop you into the interactive shell?

Ok, this will cancel the whole mechanism.

I only want to allow the space key to abort autoboot. With serial console cables connected (with no PC on the other side) you sometimes receive some noise characters because of crosstalk. These chars will stop autoboot -> not good! We did never see this when restricting the stopkey to the space key.

Because I only need to abort my special bootcmd during testing I reenabled ctrl-c checking in my loadpci command.

Thanks for pointing out the ..KEYED philosophy.

Matthias

Quoted 4 lines

Best regards,

Wolfgang Denk