summaryrefslogtreecommitdiff
path: root/payloads/libpayload/libc
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/libc')
-rw-r--r--payloads/libpayload/libc/console.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/payloads/libpayload/libc/console.c b/payloads/libpayload/libc/console.c
index b2b115b835..73e2644cd4 100644
--- a/payloads/libpayload/libc/console.c
+++ b/payloads/libpayload/libc/console.c
@@ -101,3 +101,19 @@ int getchar(void)
#endif
}
}
+
+int getchar_timeout(int *ms)
+{
+ while (*ms > 0) {
+ if (havekey())
+ return getchar();
+
+ mdelay(100);
+ *ms -= 100;
+ }
+
+ if (*ms < 0)
+ *ms = 0;
+
+ return 0;
+}