Rev 3747 | Rev 3923 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3747 | Rev 3905 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | #include <ipc/ipc.h> |
41 | #include <ipc/ipc.h> |
42 | #include <ipc/ns.h> |
42 | #include <ipc/ns.h> |
43 | #include <ipc/fb.h> |
43 | #include <ipc/fb.h> |
44 | #include <ipc/services.h> |
44 | #include <ipc/services.h> |
45 | #include <ipc/console.h> |
45 | #include <ipc/console.h> |
- | 46 | #include <kbd/kbd.h> |
|
46 | #include <unistd.h> |
47 | #include <unistd.h> |
47 | #include <async.h> |
48 | #include <async.h> |
48 | #include <sys/types.h> |
49 | #include <sys/types.h> |
49 | 50 | ||
50 | static int console_phone = -1; |
51 | static int console_phone = -1; |
Line 56... | Line 57... | ||
56 | 57 | ||
57 | ssize_t read_stdin(void *buf, size_t count) |
58 | ssize_t read_stdin(void *buf, size_t count) |
58 | { |
59 | { |
59 | open_console(); |
60 | open_console(); |
60 | if (console_phone >= 0) { |
61 | if (console_phone >= 0) { |
- | 62 | kbd_event_t ev; |
|
61 | ipcarg_t r0, r1; |
63 | int rc; |
62 | size_t i = 0; |
64 | size_t i = 0; |
63 | 65 | ||
64 | while (i < count) { |
66 | while (i < count) { |
- | 67 | do { |
|
65 | if (async_req_0_2(console_phone, CONSOLE_GETCHAR, &r0, &r1) < 0) |
68 | rc = kbd_get_event(&ev); |
66 | return -1; |
69 | if (rc < 0) return -1; |
- | 70 | } while (ev.c == 0); |
|
- | 71 | ||
67 | ((char *) buf)[i++] = r0; |
72 | ((char *) buf)[i++] = ev.c; |
68 | } |
73 | } |
69 | return i; |
74 | return i; |
70 | } else { |
75 | } else { |
71 | return -1; |
76 | return -1; |
72 | } |
77 | } |