* [PATCH 1/3] console_countdown: width to of countdown to 4 digits
@ 2017-03-09 17:05 Oleksij Rempel
2017-03-09 17:05 ` [PATCH 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-09 17:05 UTC (permalink / raw)
To: barebox
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch increases the displayed width of the countdown to 4 digits,
otherwise waiting for more then 99 seconds doesn't look good.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
common/console_countdown.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/console_countdown.c b/common/console_countdown.c
index c0c8c9502..b2eec72b2 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -35,7 +35,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
countdown = timeout_s;
if (!(flags & CONSOLE_COUNTDOWN_SILENT))
- printf("%2d", countdown--);
+ printf("%4d", countdown--);
do {
if (tstc()) {
@@ -50,7 +50,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
- printf("\b\b%2d", countdown--);
+ printf("\b\b\b\b%4d", countdown--);
second += SECOND;
}
} while (!is_timeout(start, timeout_s * SECOND));
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/3] console_countdown: add possibility to abort countdown by external commands
2017-03-09 17:05 [PATCH 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
@ 2017-03-09 17:05 ` Oleksij Rempel
2017-03-09 17:05 ` [PATCH 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-09 17:05 UTC (permalink / raw)
To: barebox
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch makes it possible to abort a console countdown by an external
command, for example when fastboot is used. This requires additional
modifications in the external commands, a call to "console_countdown_abort()"
has to be inserted.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
commands/timeout.c | 8 ++++++--
common/console_countdown.c | 15 +++++++++++++++
include/console_countdown.h | 2 ++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/commands/timeout.c b/commands/timeout.c
index ef1a037c1..d197cedd8 100644
--- a/commands/timeout.c
+++ b/commands/timeout.c
@@ -32,7 +32,7 @@ static int do_timeout(int argc, char *argv[])
char str[2] = { };
const char *varname = NULL;
- while((opt = getopt(argc, argv, "crsav:")) > 0) {
+ while ((opt = getopt(argc, argv, "crsav:e")) > 0) {
switch(opt) {
case 'r':
flags |= CONSOLE_COUNTDOWN_RETURN;
@@ -46,6 +46,9 @@ static int do_timeout(int argc, char *argv[])
case 's':
flags |= CONSOLE_COUNTDOWN_SILENT;
break;
+ case 'e':
+ flags |= CONSOLE_COUNTDOWN_EXTERN;
+ break;
case 'v':
varname = optarg;
break;
@@ -73,6 +76,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
+BAREBOX_CMD_HELP_OPT("-e", "interrupt on external commands (i.e. fastboot")
BAREBOX_CMD_HELP_OPT("-s", "silent mode")
BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
BAREBOX_CMD_HELP_END
@@ -80,7 +84,7 @@ BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(timeout)
.cmd = do_timeout,
BAREBOX_CMD_DESC("wait for a specified timeout")
- BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
+ BAREBOX_CMD_OPTS("[-acrsev] SECONDS")
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_timeout_help)
BAREBOX_CMD_END
diff --git a/common/console_countdown.c b/common/console_countdown.c
index b2eec72b2..594d3d879 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -23,6 +23,13 @@
#include <console_countdown.h>
#include <stdio.h>
+static int console_countdown_timeout_abort;
+
+void console_countdown_abort(void)
+{
+ console_countdown_timeout_abort = true;
+}
+
int console_countdown(int timeout_s, unsigned flags, char *out_key)
{
uint64_t start, second;
@@ -48,6 +55,9 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
goto out;
key = 0;
}
+ if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
+ console_countdown_timeout_abort)
+ goto out;
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
printf("\b\b\b\b%4d", countdown--);
@@ -55,6 +65,10 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
} while (!is_timeout(start, timeout_s * SECOND));
+ if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
+ console_countdown_timeout_abort)
+ goto out;
+
ret = 0;
out:
@@ -62,6 +76,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
printf("\n");
if (key && out_key)
*out_key = key;
+ console_countdown_timeout_abort = false;
return ret;
}
diff --git a/include/console_countdown.h b/include/console_countdown.h
index cb46964bc..c6c2d5c00 100644
--- a/include/console_countdown.h
+++ b/include/console_countdown.h
@@ -5,7 +5,9 @@
#define CONSOLE_COUNTDOWN_ANYKEY (1 << 1)
#define CONSOLE_COUNTDOWN_RETURN (1 << 3)
#define CONSOLE_COUNTDOWN_CTRLC (1 << 4)
+#define CONSOLE_COUNTDOWN_EXTERN (1 << 5)
int console_countdown(int timeout_s, unsigned flags, char *out_key);
+void console_countdown_abort(void);
#endif /* __CONSOLE_COUNTDOWN_H */
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated
2017-03-09 17:05 [PATCH 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-09 17:05 ` [PATCH 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
@ 2017-03-09 17:05 ` Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-09 21:44 ` [PATCH 1/3] console_countdown: width to of countdown to 4 digits Sam Ravnborg
3 siblings, 0 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-09 17:05 UTC (permalink / raw)
To: barebox
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch adds a call to "console_countdown_abort()" to abort a currently or
upcoming running console timeout.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/usb/gadget/f_fastboot.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a6192b9eb..cdf806de4 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -36,6 +36,7 @@
#include <environment.h>
#include <globalvar.h>
#include <restart.h>
+#include <console_countdown.h>
#include <usb/ch9.h>
#include <usb/gadget.h>
#include <usb/fastboot.h>
@@ -814,6 +815,8 @@ static void fb_run_command(struct usb_ep *ep, struct usb_request *req, const cha
struct f_fastboot *f_fb = req->context;
int i;
+ console_countdown_abort();
+
for (i = 0; i < num_commands; i++) {
if (!strcmp_l1(cmds[i].cmd, cmd)) {
func_cb = cmds[i].cb;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 1/3] console_countdown: width to of countdown to 4 digits
2017-03-09 17:05 [PATCH 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-09 17:05 ` [PATCH 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
2017-03-09 17:05 ` [PATCH 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
@ 2017-03-09 17:58 ` Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
2017-03-09 21:44 ` [PATCH 1/3] console_countdown: width to of countdown to 4 digits Sam Ravnborg
3 siblings, 2 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-09 17:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch increases the displayed width of the countdown to 4 digits,
otherwise waiting for more then 99 seconds doesn't look good.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
common/console_countdown.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/console_countdown.c b/common/console_countdown.c
index c0c8c9502..b2eec72b2 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -35,7 +35,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
countdown = timeout_s;
if (!(flags & CONSOLE_COUNTDOWN_SILENT))
- printf("%2d", countdown--);
+ printf("%4d", countdown--);
do {
if (tstc()) {
@@ -50,7 +50,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
- printf("\b\b%2d", countdown--);
+ printf("\b\b\b\b%4d", countdown--);
second += SECOND;
}
} while (!is_timeout(start, timeout_s * SECOND));
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands
2017-03-09 17:58 ` [PATCH v2 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
@ 2017-03-09 17:58 ` Oleksij Rempel
2017-03-09 18:18 ` Marc Kleine-Budde
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
1 sibling, 2 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-09 17:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch makes it possible to abort a console countdown by an external
command, for example when fastboot is used. This requires additional
modifications in the external commands, a call to "console_countdown_abort()"
has to be inserted.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
commands/timeout.c | 8 ++++++--
common/console_countdown.c | 15 +++++++++++++++
include/console_countdown.h | 2 ++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/commands/timeout.c b/commands/timeout.c
index ef1a037c1..d197cedd8 100644
--- a/commands/timeout.c
+++ b/commands/timeout.c
@@ -32,7 +32,7 @@ static int do_timeout(int argc, char *argv[])
char str[2] = { };
const char *varname = NULL;
- while((opt = getopt(argc, argv, "crsav:")) > 0) {
+ while ((opt = getopt(argc, argv, "crsav:e")) > 0) {
switch(opt) {
case 'r':
flags |= CONSOLE_COUNTDOWN_RETURN;
@@ -46,6 +46,9 @@ static int do_timeout(int argc, char *argv[])
case 's':
flags |= CONSOLE_COUNTDOWN_SILENT;
break;
+ case 'e':
+ flags |= CONSOLE_COUNTDOWN_EXTERN;
+ break;
case 'v':
varname = optarg;
break;
@@ -73,6 +76,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
+BAREBOX_CMD_HELP_OPT("-e", "interrupt on external commands (i.e. fastboot")
BAREBOX_CMD_HELP_OPT("-s", "silent mode")
BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
BAREBOX_CMD_HELP_END
@@ -80,7 +84,7 @@ BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(timeout)
.cmd = do_timeout,
BAREBOX_CMD_DESC("wait for a specified timeout")
- BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
+ BAREBOX_CMD_OPTS("[-acrsev] SECONDS")
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_timeout_help)
BAREBOX_CMD_END
diff --git a/common/console_countdown.c b/common/console_countdown.c
index b2eec72b2..594d3d879 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -23,6 +23,13 @@
#include <console_countdown.h>
#include <stdio.h>
+static int console_countdown_timeout_abort;
+
+void console_countdown_abort(void)
+{
+ console_countdown_timeout_abort = true;
+}
+
int console_countdown(int timeout_s, unsigned flags, char *out_key)
{
uint64_t start, second;
@@ -48,6 +55,9 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
goto out;
key = 0;
}
+ if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
+ console_countdown_timeout_abort)
+ goto out;
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
printf("\b\b\b\b%4d", countdown--);
@@ -55,6 +65,10 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
} while (!is_timeout(start, timeout_s * SECOND));
+ if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
+ console_countdown_timeout_abort)
+ goto out;
+
ret = 0;
out:
@@ -62,6 +76,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
printf("\n");
if (key && out_key)
*out_key = key;
+ console_countdown_timeout_abort = false;
return ret;
}
diff --git a/include/console_countdown.h b/include/console_countdown.h
index cb46964bc..c6c2d5c00 100644
--- a/include/console_countdown.h
+++ b/include/console_countdown.h
@@ -5,7 +5,9 @@
#define CONSOLE_COUNTDOWN_ANYKEY (1 << 1)
#define CONSOLE_COUNTDOWN_RETURN (1 << 3)
#define CONSOLE_COUNTDOWN_CTRLC (1 << 4)
+#define CONSOLE_COUNTDOWN_EXTERN (1 << 5)
int console_countdown(int timeout_s, unsigned flags, char *out_key);
+void console_countdown_abort(void);
#endif /* __CONSOLE_COUNTDOWN_H */
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated
2017-03-09 17:58 ` [PATCH v2 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
@ 2017-03-09 17:58 ` Oleksij Rempel
1 sibling, 0 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-09 17:58 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch adds a call to "console_countdown_abort()" to abort a currently or
upcoming running console timeout.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/usb/gadget/f_fastboot.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a6192b9eb..cdf806de4 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -36,6 +36,7 @@
#include <environment.h>
#include <globalvar.h>
#include <restart.h>
+#include <console_countdown.h>
#include <usb/ch9.h>
#include <usb/gadget.h>
#include <usb/fastboot.h>
@@ -814,6 +815,8 @@ static void fb_run_command(struct usb_ep *ep, struct usb_request *req, const cha
struct f_fastboot *f_fb = req->context;
int i;
+ console_countdown_abort();
+
for (i = 0; i < num_commands; i++) {
if (!strcmp_l1(cmds[i].cmd, cmd)) {
func_cb = cmds[i].cb;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands
2017-03-09 17:58 ` [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
@ 2017-03-09 18:18 ` Marc Kleine-Budde
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
1 sibling, 0 replies; 15+ messages in thread
From: Marc Kleine-Budde @ 2017-03-09 18:18 UTC (permalink / raw)
To: Oleksij Rempel, barebox
[-- Attachment #1.1.1: Type: text/plain, Size: 4474 bytes --]
On 03/09/2017 06:58 PM, Oleksij Rempel wrote:
> From: Marc Kleine-Budde <mkl@pengutronix.de>
>
> This patch makes it possible to abort a console countdown by an external
> command, for example when fastboot is used. This requires additional
> modifications in the external commands, a call to "console_countdown_abort()"
> has to be inserted.
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> commands/timeout.c | 8 ++++++--
> common/console_countdown.c | 15 +++++++++++++++
> include/console_countdown.h | 2 ++
> 3 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/commands/timeout.c b/commands/timeout.c
> index ef1a037c1..d197cedd8 100644
> --- a/commands/timeout.c
> +++ b/commands/timeout.c
> @@ -32,7 +32,7 @@ static int do_timeout(int argc, char *argv[])
> char str[2] = { };
> const char *varname = NULL;
>
> - while((opt = getopt(argc, argv, "crsav:")) > 0) {
> + while ((opt = getopt(argc, argv, "crsav:e")) > 0) {
> switch(opt) {
> case 'r':
> flags |= CONSOLE_COUNTDOWN_RETURN;
> @@ -46,6 +46,9 @@ static int do_timeout(int argc, char *argv[])
> case 's':
> flags |= CONSOLE_COUNTDOWN_SILENT;
> break;
> + case 'e':
> + flags |= CONSOLE_COUNTDOWN_EXTERN;
> + break;
> case 'v':
> varname = optarg;
> break;
> @@ -73,6 +76,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
> BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
> BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
> BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
> +BAREBOX_CMD_HELP_OPT("-e", "interrupt on external commands (i.e. fastboot")
> BAREBOX_CMD_HELP_OPT("-s", "silent mode")
> BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
> BAREBOX_CMD_HELP_END
> @@ -80,7 +84,7 @@ BAREBOX_CMD_HELP_END
> BAREBOX_CMD_START(timeout)
> .cmd = do_timeout,
> BAREBOX_CMD_DESC("wait for a specified timeout")
> - BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
> + BAREBOX_CMD_OPTS("[-acrsev] SECONDS")
> BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
> BAREBOX_CMD_HELP(cmd_timeout_help)
> BAREBOX_CMD_END
> diff --git a/common/console_countdown.c b/common/console_countdown.c
> index b2eec72b2..594d3d879 100644
> --- a/common/console_countdown.c
> +++ b/common/console_countdown.c
> @@ -23,6 +23,13 @@
> #include <console_countdown.h>
> #include <stdio.h>
>
> +static int console_countdown_timeout_abort;
static bool
> +
> +void console_countdown_abort(void)
> +{
> + console_countdown_timeout_abort = true;
> +}
> +
> int console_countdown(int timeout_s, unsigned flags, char *out_key)
> {
> uint64_t start, second;
> @@ -48,6 +55,9 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
> goto out;
> key = 0;
> }
> + if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
> + console_countdown_timeout_abort)
> + goto out;
> if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
> is_timeout(second, SECOND)) {
> printf("\b\b\b\b%4d", countdown--);
> @@ -55,6 +65,10 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
> }
> } while (!is_timeout(start, timeout_s * SECOND));
>
> + if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
> + console_countdown_timeout_abort)
> + goto out;
> +
> ret = 0;
>
> out:
> @@ -62,6 +76,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
> printf("\n");
> if (key && out_key)
> *out_key = key;
> + console_countdown_timeout_abort = false;
>
> return ret;
> }
> diff --git a/include/console_countdown.h b/include/console_countdown.h
> index cb46964bc..c6c2d5c00 100644
> --- a/include/console_countdown.h
> +++ b/include/console_countdown.h
> @@ -5,7 +5,9 @@
> #define CONSOLE_COUNTDOWN_ANYKEY (1 << 1)
> #define CONSOLE_COUNTDOWN_RETURN (1 << 3)
> #define CONSOLE_COUNTDOWN_CTRLC (1 << 4)
> +#define CONSOLE_COUNTDOWN_EXTERN (1 << 5)
>
> int console_countdown(int timeout_s, unsigned flags, char *out_key);
> +void console_countdown_abort(void);
>
> #endif /* __CONSOLE_COUNTDOWN_H */
>
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/3] console_countdown: width to of countdown to 4 digits
2017-03-09 17:05 [PATCH 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
` (2 preceding siblings ...)
2017-03-09 17:58 ` [PATCH v2 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
@ 2017-03-09 21:44 ` Sam Ravnborg
3 siblings, 0 replies; 15+ messages in thread
From: Sam Ravnborg @ 2017-03-09 21:44 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
Hi Oleksij.
On Thu, Mar 09, 2017 at 06:05:43PM +0100, Oleksij Rempel wrote:
> From: Marc Kleine-Budde <mkl@pengutronix.de>
>
> This patch increases the displayed width of the countdown to 4 digits,
> otherwise waiting for more then 99 seconds doesn't look good.
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Since this was originally authored bu Marc, and then the
patch is handled by you - you are supposed to "Sign-off" the patch.
The idea is that the "Signed-off-by:" tell the path the patch
took from the original author until applied.
So in this case:
Marc Kleine-Budde => Oleksij Rempel => Sascha
Where Sascha will only "Signed-off" if applying as a patch, not when pulling a git tree.
All the above is my understanding - if I am mistaken then I hope
someone on the list will correct me.
Sam
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 0/3] upstream console_countdown related work
2017-03-09 17:58 ` [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
2017-03-09 18:18 ` Marc Kleine-Budde
@ 2017-03-10 6:05 ` Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
` (3 more replies)
1 sibling, 4 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-10 6:05 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
changes v3:
- make console_countdown_timeout_abort static bool
changes v2:
- add my Signed-of-by
Marc Kleine-Budde (3):
console_countdown: width to of countdown to 4 digits
console_countdown: add possibility to abort countdown by external
commands
fastboot: abort autoboot timeout when fastboot gadget is activated
commands/timeout.c | 8 ++++++--
common/console_countdown.c | 19 +++++++++++++++++--
drivers/usb/gadget/f_fastboot.c | 3 +++
include/console_countdown.h | 2 ++
4 files changed, 28 insertions(+), 4 deletions(-)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/3] console_countdown: width to of countdown to 4 digits
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
@ 2017-03-10 6:05 ` Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-10 6:05 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch increases the displayed width of the countdown to 4 digits,
otherwise waiting for more then 99 seconds doesn't look good.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
common/console_countdown.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/console_countdown.c b/common/console_countdown.c
index c0c8c9502..b2eec72b2 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -35,7 +35,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
countdown = timeout_s;
if (!(flags & CONSOLE_COUNTDOWN_SILENT))
- printf("%2d", countdown--);
+ printf("%4d", countdown--);
do {
if (tstc()) {
@@ -50,7 +50,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
- printf("\b\b%2d", countdown--);
+ printf("\b\b\b\b%4d", countdown--);
second += SECOND;
}
} while (!is_timeout(start, timeout_s * SECOND));
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
@ 2017-03-10 6:05 ` Oleksij Rempel
2017-03-10 9:14 ` Jean-Christophe PLAGNIOL-VILLARD
2017-03-10 6:05 ` [PATCH v3 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
2017-03-10 7:49 ` [PATCH v3 0/3] upstream console_countdown related work Sascha Hauer
3 siblings, 1 reply; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-10 6:05 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch makes it possible to abort a console countdown by an external
command, for example when fastboot is used. This requires additional
modifications in the external commands, a call to "console_countdown_abort()"
has to be inserted.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
commands/timeout.c | 8 ++++++--
common/console_countdown.c | 15 +++++++++++++++
include/console_countdown.h | 2 ++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/commands/timeout.c b/commands/timeout.c
index ef1a037c1..d197cedd8 100644
--- a/commands/timeout.c
+++ b/commands/timeout.c
@@ -32,7 +32,7 @@ static int do_timeout(int argc, char *argv[])
char str[2] = { };
const char *varname = NULL;
- while((opt = getopt(argc, argv, "crsav:")) > 0) {
+ while ((opt = getopt(argc, argv, "crsav:e")) > 0) {
switch(opt) {
case 'r':
flags |= CONSOLE_COUNTDOWN_RETURN;
@@ -46,6 +46,9 @@ static int do_timeout(int argc, char *argv[])
case 's':
flags |= CONSOLE_COUNTDOWN_SILENT;
break;
+ case 'e':
+ flags |= CONSOLE_COUNTDOWN_EXTERN;
+ break;
case 'v':
varname = optarg;
break;
@@ -73,6 +76,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
+BAREBOX_CMD_HELP_OPT("-e", "interrupt on external commands (i.e. fastboot")
BAREBOX_CMD_HELP_OPT("-s", "silent mode")
BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
BAREBOX_CMD_HELP_END
@@ -80,7 +84,7 @@ BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(timeout)
.cmd = do_timeout,
BAREBOX_CMD_DESC("wait for a specified timeout")
- BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
+ BAREBOX_CMD_OPTS("[-acrsev] SECONDS")
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_timeout_help)
BAREBOX_CMD_END
diff --git a/common/console_countdown.c b/common/console_countdown.c
index b2eec72b2..03b9b3353 100644
--- a/common/console_countdown.c
+++ b/common/console_countdown.c
@@ -23,6 +23,13 @@
#include <console_countdown.h>
#include <stdio.h>
+static bool console_countdown_timeout_abort;
+
+void console_countdown_abort(void)
+{
+ console_countdown_timeout_abort = true;
+}
+
int console_countdown(int timeout_s, unsigned flags, char *out_key)
{
uint64_t start, second;
@@ -48,6 +55,9 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
goto out;
key = 0;
}
+ if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
+ console_countdown_timeout_abort)
+ goto out;
if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
is_timeout(second, SECOND)) {
printf("\b\b\b\b%4d", countdown--);
@@ -55,6 +65,10 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
}
} while (!is_timeout(start, timeout_s * SECOND));
+ if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
+ console_countdown_timeout_abort)
+ goto out;
+
ret = 0;
out:
@@ -62,6 +76,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
printf("\n");
if (key && out_key)
*out_key = key;
+ console_countdown_timeout_abort = false;
return ret;
}
diff --git a/include/console_countdown.h b/include/console_countdown.h
index cb46964bc..c6c2d5c00 100644
--- a/include/console_countdown.h
+++ b/include/console_countdown.h
@@ -5,7 +5,9 @@
#define CONSOLE_COUNTDOWN_ANYKEY (1 << 1)
#define CONSOLE_COUNTDOWN_RETURN (1 << 3)
#define CONSOLE_COUNTDOWN_CTRLC (1 << 4)
+#define CONSOLE_COUNTDOWN_EXTERN (1 << 5)
int console_countdown(int timeout_s, unsigned flags, char *out_key);
+void console_countdown_abort(void);
#endif /* __CONSOLE_COUNTDOWN_H */
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
@ 2017-03-10 6:05 ` Oleksij Rempel
2017-03-10 7:49 ` [PATCH v3 0/3] upstream console_countdown related work Sascha Hauer
3 siblings, 0 replies; 15+ messages in thread
From: Oleksij Rempel @ 2017-03-10 6:05 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
From: Marc Kleine-Budde <mkl@pengutronix.de>
This patch adds a call to "console_countdown_abort()" to abort a currently or
upcoming running console timeout.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/usb/gadget/f_fastboot.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a6192b9eb..cdf806de4 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -36,6 +36,7 @@
#include <environment.h>
#include <globalvar.h>
#include <restart.h>
+#include <console_countdown.h>
#include <usb/ch9.h>
#include <usb/gadget.h>
#include <usb/fastboot.h>
@@ -814,6 +815,8 @@ static void fb_run_command(struct usb_ep *ep, struct usb_request *req, const cha
struct f_fastboot *f_fb = req->context;
int i;
+ console_countdown_abort();
+
for (i = 0; i < num_commands; i++) {
if (!strcmp_l1(cmds[i].cmd, cmd)) {
func_cb = cmds[i].cb;
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 0/3] upstream console_countdown related work
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
` (2 preceding siblings ...)
2017-03-10 6:05 ` [PATCH v3 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
@ 2017-03-10 7:49 ` Sascha Hauer
3 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2017-03-10 7:49 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
On Fri, Mar 10, 2017 at 07:05:20AM +0100, Oleksij Rempel wrote:
> changes v3:
> - make console_countdown_timeout_abort static bool
>
> changes v2:
> - add my Signed-of-by
>
> Marc Kleine-Budde (3):
> console_countdown: width to of countdown to 4 digits
> console_countdown: add possibility to abort countdown by external
> commands
> fastboot: abort autoboot timeout when fastboot gadget is activated
Applied, thanks
We might add a patch which adds the -e option to the environment.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands
2017-03-10 6:05 ` [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
@ 2017-03-10 9:14 ` Jean-Christophe PLAGNIOL-VILLARD
2017-03-13 8:07 ` Sascha Hauer
0 siblings, 1 reply; 15+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2017-03-10 9:14 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
> On Mar 10, 2017, at 2:05 PM, Oleksij Rempel <o.rempel@pengutronix.de> wrote:
>
> From: Marc Kleine-Budde <mkl@pengutronix.de>
>
> This patch makes it possible to abort a console countdown by an external
> command, for example when fastboot is used. This requires additional
> modifications in the external commands, a call to "console_countdown_abort()"
> has to be inserted.
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> commands/timeout.c | 8 ++++++--
> common/console_countdown.c | 15 +++++++++++++++
> include/console_countdown.h | 2 ++
> 3 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/commands/timeout.c b/commands/timeout.c
> index ef1a037c1..d197cedd8 100644
> --- a/commands/timeout.c
> +++ b/commands/timeout.c
> @@ -32,7 +32,7 @@ static int do_timeout(int argc, char *argv[])
> char str[2] = { };
> const char *varname = NULL;
>
> - while((opt = getopt(argc, argv, "crsav:")) > 0) {
> + while ((opt = getopt(argc, argv, "crsav:e")) > 0) {
> switch(opt) {
> case 'r':
> flags |= CONSOLE_COUNTDOWN_RETURN;
> @@ -46,6 +46,9 @@ static int do_timeout(int argc, char *argv[])
> case 's':
> flags |= CONSOLE_COUNTDOWN_SILENT;
> break;
> + case 'e':
> + flags |= CONSOLE_COUNTDOWN_EXTERN;
> + break;
> case 'v':
> varname = optarg;
> break;
> @@ -73,6 +76,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
> BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
> BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
> BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
> +BAREBOX_CMD_HELP_OPT("-e", "interrupt on external commands (i.e. fastboot")
> BAREBOX_CMD_HELP_OPT("-s", "silent mode")
> BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
> BAREBOX_CMD_HELP_END
> @@ -80,7 +84,7 @@ BAREBOX_CMD_HELP_END
> BAREBOX_CMD_START(timeout)
> .cmd = do_timeout,
> BAREBOX_CMD_DESC("wait for a specified timeout")
> - BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
> + BAREBOX_CMD_OPTS("[-acrsev] SECONDS")
> BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
> BAREBOX_CMD_HELP(cmd_timeout_help)
> BAREBOX_CMD_END
> diff --git a/common/console_countdown.c b/common/console_countdown.c
> index b2eec72b2..03b9b3353 100644
> --- a/common/console_countdown.c
> +++ b/common/console_countdown.c
> @@ -23,6 +23,13 @@
> #include <console_countdown.h>
> #include <stdio.h>
>
> +static bool console_countdown_timeout_abort;
> +
> +void console_countdown_abort(void)
> +{
> + console_countdown_timeout_abort = true;
Nack
this break the security support
If we enable password you can not activate it by default
Best Regards,
J.
> +}
> +
> int console_countdown(int timeout_s, unsigned flags, char *out_key)
> {
> uint64_t start, second;
> @@ -48,6 +55,9 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
> goto out;
> key = 0;
> }
> + if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
> + console_countdown_timeout_abort)
> + goto out;
> if (!(flags & CONSOLE_COUNTDOWN_SILENT) &&
> is_timeout(second, SECOND)) {
> printf("\b\b\b\b%4d", countdown--);
> @@ -55,6 +65,10 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
> }
> } while (!is_timeout(start, timeout_s * SECOND));
>
> + if ((flags & CONSOLE_COUNTDOWN_EXTERN) &&
> + console_countdown_timeout_abort)
> + goto out;
> +
> ret = 0;
>
> out:
> @@ -62,6 +76,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key)
> printf("\n");
> if (key && out_key)
> *out_key = key;
> + console_countdown_timeout_abort = false;
>
> return ret;
> }
> diff --git a/include/console_countdown.h b/include/console_countdown.h
> index cb46964bc..c6c2d5c00 100644
> --- a/include/console_countdown.h
> +++ b/include/console_countdown.h
> @@ -5,7 +5,9 @@
> #define CONSOLE_COUNTDOWN_ANYKEY (1 << 1)
> #define CONSOLE_COUNTDOWN_RETURN (1 << 3)
> #define CONSOLE_COUNTDOWN_CTRLC (1 << 4)
> +#define CONSOLE_COUNTDOWN_EXTERN (1 << 5)
>
> int console_countdown(int timeout_s, unsigned flags, char *out_key);
> +void console_countdown_abort(void);
>
> #endif /* __CONSOLE_COUNTDOWN_H */
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands
2017-03-10 9:14 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2017-03-13 8:07 ` Sascha Hauer
0 siblings, 0 replies; 15+ messages in thread
From: Sascha Hauer @ 2017-03-13 8:07 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: Oleksij Rempel, barebox
On Fri, Mar 10, 2017 at 05:14:37PM +0800, Jean-Christophe PLAGNIOL-VILLARD wrote:
>
> > On Mar 10, 2017, at 2:05 PM, Oleksij Rempel <o.rempel@pengutronix.de> wrote:
> >
> > From: Marc Kleine-Budde <mkl@pengutronix.de>
> >
> > This patch makes it possible to abort a console countdown by an external
> > command, for example when fastboot is used. This requires additional
> > modifications in the external commands, a call to "console_countdown_abort()"
> > has to be inserted.
> >
> > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> > commands/timeout.c | 8 ++++++--
> > common/console_countdown.c | 15 +++++++++++++++
> > include/console_countdown.h | 2 ++
> > 3 files changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/commands/timeout.c b/commands/timeout.c
> > index ef1a037c1..d197cedd8 100644
> > --- a/commands/timeout.c
> > +++ b/commands/timeout.c
> > @@ -32,7 +32,7 @@ static int do_timeout(int argc, char *argv[])
> > char str[2] = { };
> > const char *varname = NULL;
> >
> > - while((opt = getopt(argc, argv, "crsav:")) > 0) {
> > + while ((opt = getopt(argc, argv, "crsav:e")) > 0) {
> > switch(opt) {
> > case 'r':
> > flags |= CONSOLE_COUNTDOWN_RETURN;
> > @@ -46,6 +46,9 @@ static int do_timeout(int argc, char *argv[])
> > case 's':
> > flags |= CONSOLE_COUNTDOWN_SILENT;
> > break;
> > + case 'e':
> > + flags |= CONSOLE_COUNTDOWN_EXTERN;
> > + break;
> > case 'v':
> > varname = optarg;
> > break;
> > @@ -73,6 +76,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
> > BAREBOX_CMD_HELP_OPT("-a", "interrupt on any key")
> > BAREBOX_CMD_HELP_OPT("-c", "interrupt on Ctrl-C")
> > BAREBOX_CMD_HELP_OPT("-r", "interrupt on RETURN")
> > +BAREBOX_CMD_HELP_OPT("-e", "interrupt on external commands (i.e. fastboot")
> > BAREBOX_CMD_HELP_OPT("-s", "silent mode")
> > BAREBOX_CMD_HELP_OPT("-v <VARIABLE>", "export pressed key to environment")
> > BAREBOX_CMD_HELP_END
> > @@ -80,7 +84,7 @@ BAREBOX_CMD_HELP_END
> > BAREBOX_CMD_START(timeout)
> > .cmd = do_timeout,
> > BAREBOX_CMD_DESC("wait for a specified timeout")
> > - BAREBOX_CMD_OPTS("[-acrsv] SECONDS")
> > + BAREBOX_CMD_OPTS("[-acrsev] SECONDS")
> > BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
> > BAREBOX_CMD_HELP(cmd_timeout_help)
> > BAREBOX_CMD_END
> > diff --git a/common/console_countdown.c b/common/console_countdown.c
> > index b2eec72b2..03b9b3353 100644
> > --- a/common/console_countdown.c
> > +++ b/common/console_countdown.c
> > @@ -23,6 +23,13 @@
> > #include <console_countdown.h>
> > #include <stdio.h>
> >
> > +static bool console_countdown_timeout_abort;
> > +
> > +void console_countdown_abort(void)
> > +{
> > + console_countdown_timeout_abort = true;
> Nack
>
> this break the security support
>
> If we enable password you can not activate it by default
This patch only changes anything when the -e option is given to the
timeout command, which is not the case in the current startup scripts.
Also this patch only aborts the autoboot timeout, something you can
always do with a key press, even when password/login is enabled. The
login comes after the timeout and is unaffected by this code.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2017-03-13 8:08 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-09 17:05 [PATCH 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-09 17:05 ` [PATCH 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
2017-03-09 17:05 ` [PATCH 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-09 17:58 ` [PATCH v2 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
2017-03-09 18:18 ` Marc Kleine-Budde
2017-03-10 6:05 ` [PATCH v3 0/3] upstream console_countdown related work Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 1/3] console_countdown: width to of countdown to 4 digits Oleksij Rempel
2017-03-10 6:05 ` [PATCH v3 2/3] console_countdown: add possibility to abort countdown by external commands Oleksij Rempel
2017-03-10 9:14 ` Jean-Christophe PLAGNIOL-VILLARD
2017-03-13 8:07 ` Sascha Hauer
2017-03-10 6:05 ` [PATCH v3 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
2017-03-10 7:49 ` [PATCH v3 0/3] upstream console_countdown related work Sascha Hauer
2017-03-09 17:58 ` [PATCH v2 3/3] fastboot: abort autoboot timeout when fastboot gadget is activated Oleksij Rempel
2017-03-09 21:44 ` [PATCH 1/3] console_countdown: width to of countdown to 4 digits Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox