aboutsummaryrefslogtreecommitdiff
path: root/stand/common/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'stand/common/console.c')
-rw-r--r--stand/common/console.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/stand/common/console.c b/stand/common/console.c
index 82cb552b4ef2..65ab7ffad622 100644
--- a/stand/common/console.c
+++ b/stand/common/console.c
@@ -44,6 +44,8 @@ static int twiddle_set(struct env_var *ev, int flags, const void *value);
#endif
int module_verbose = MODULE_VERBOSE;
+static uint32_t print_delay_usec = 0;
+
static int
module_verbose_set(struct env_var *ev, int flags, const void *value)
{
@@ -66,6 +68,23 @@ module_verbose_set(struct env_var *ev, int flags, const void *value)
}
/*
+ * Hook to set the print delay
+ */
+int
+setprint_delay(struct env_var *ev, int flags, const void *value)
+{
+ char *end;
+ int usec = strtol(value, &end, 10);
+
+ if (*(char *)value == '\0' || *end != '\0')
+ return (EINVAL);
+ if (usec < 0)
+ return (EINVAL);
+ print_delay_usec = usec;
+ return (0);
+}
+
+/*
* Detect possible console(s) to use. If preferred console(s) have been
* specified, mark them as active. Else, mark the first probed console
* as active. Also create the console variable.
@@ -178,6 +197,10 @@ putchar(int c)
(C_PRESENTOUT | C_ACTIVEOUT))
consoles[cons]->c_out(c);
}
+
+ /* Pause after printing newline character if a print delay is set */
+ if (print_delay_usec != 0 && c == '\n')
+ delay(print_delay_usec);
}
/*