diff options
Diffstat (limited to 'payloads/libpayload/libc/console.c')
-rw-r--r-- | payloads/libpayload/libc/console.c | 16 |
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; +} |