42,7 → 42,8 |
#include <ipc/ns.h> |
#include <ipc/fb.h> |
#include <ipc/services.h> |
#include <console.h> |
#include <ipc/console.h> |
#include <kbd/kbd.h> |
#include <unistd.h> |
#include <async.h> |
#include <sys/types.h> |
58,13 → 59,17 |
{ |
open_console(); |
if (console_phone >= 0) { |
ipcarg_t r0, r1; |
kbd_event_t ev; |
int rc; |
size_t i = 0; |
|
while (i < count) { |
if (async_req_0_2(console_phone, CONSOLE_GETCHAR, &r0, &r1) < 0) |
return -1; |
((char *) buf)[i++] = r0; |
do { |
rc = kbd_get_event(&ev); |
if (rc < 0) return -1; |
} while (ev.c == 0 || ev.type == KE_RELEASE); |
|
((char *) buf)[i++] = ev.c; |
} |
return i; |
} else { |
110,11 → 115,19 |
(void) __SYSCALL3(SYS_KLOG, 1, NULL, 0); |
} |
|
int get_cons_phone(void) |
int get_console_phone(void) |
{ |
open_console(); |
if (console_phone < 0) |
console_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_CONSOLE, 0, 0); |
|
return console_phone; |
} |
|
void console_wait(void) |
{ |
while (console_phone < 0) |
get_console_phone(); |
} |
|
/** @} |
*/ |