[U-Boot] ctrl-c detection (on 4xx platforms)

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

Dear Matthias Fuchs,
In message 200809111723.54133.matthias.fuchs@esd-electronics.com you wrote:
I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine.
...
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

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
On Thursday 11 September 2008 22:55, Wolfgang Denk wrote:
Dear Matthias Fuchs,
In message 200809111723.54133.matthias.fuchs@esd-electronics.com you wrote:
I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine.
...
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

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
On Friday 12 September 2008 09:00, Matthias Fuchs wrote:
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
On Thursday 11 September 2008 22:55, Wolfgang Denk wrote:
Dear Matthias Fuchs,
In message 200809111723.54133.matthias.fuchs@esd-electronics.com you wrote:
I noticed some strange CTRL-C behavior in a BSP command. When I run my bsp command interactively everything is fine.
...
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
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Dear Matthias Fuchs,
In message 200809120955.10866.matthias.fuchs@esd-electronics.com you wrote:
when I disable CONFIG_AUTOBOOT_KEYED ctrl-c checking is not disabled.
I think there is one "dis" ot "not" too many.
We are using CONFIG_AUTOBOOT_KEYED to have a special key (SPACE) to abort autoboot and not the 'any' key.
I thought so.
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

Hi Wolfgang,
On Friday 12 September 2008 11:08:51 Wolfgang Denk wrote:
Dear Matthias Fuchs,
In message 200809120955.10866.matthias.fuchs@esd-electronics.com you
wrote:
when I disable CONFIG_AUTOBOOT_KEYED ctrl-c checking is not disabled.
I think there is one "dis" ot "not" too many.
:-)
We are using CONFIG_AUTOBOOT_KEYED to have a special key (SPACE) to abort autoboot and not the 'any' key.
I thought so.
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.
I see. This makes sense.
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
Best regards,
Wolfgang Denk
participants (2)
-
Matthias Fuchs
-
Wolfgang Denk