48,6 → 48,7 |
#include <screenbuffer.h> |
#include <sys/mman.h> |
#include <stdio.h> |
#include <string.h> |
#include <sysinfo.h> |
#include <event.h> |
|
103,7 → 104,7 |
/** Buffer for receiving data via the CONSOLE_WRITE call from the client. */ |
static char cwrite_buf[CWRITE_BUF_SIZE]; |
|
static void fb_putchar(char c, int row, int col); |
static void fb_putchar(wchar_t c, int row, int col); |
|
|
/** Find unused virtual console. |
197,6 → 198,7 |
} |
|
if (rc != 0) { |
/* |
attrs = &conn->screenbuffer.attrs; |
|
for (j = 0; j < h; j++) { |
209,7 → 211,7 |
|
fb_putchar(field->character, y + j, x + i); |
} |
} |
}*/ |
} |
} |
|
251,18 → 253,18 |
|
|
/** Print a character to the active VC with buffering. */ |
static void fb_putchar(char c, int row, int col) |
static void fb_putchar(wchar_t c, int row, int col) |
{ |
async_msg_3(fb_info.phone, FB_PUTCHAR, c, row, col); |
} |
|
/** Process a character from the client (TTY emulation). */ |
static void write_char(int console, char key) |
static void write_char(int console, wchar_t ch) |
{ |
bool flush_cursor = false; |
screenbuffer_t *scr = &(connections[console].screenbuffer); |
|
switch (key) { |
switch (ch) { |
case '\n': |
fb_pending_flush(); |
flush_cursor = true; |
287,7 → 289,7 |
if (console == active_console) |
cell_mark_changed(scr->position_y, scr->position_x); |
|
screenbuffer_putchar(scr, key); |
screenbuffer_putchar(scr, ch); |
scr->position_x++; |
} |
|
434,7 → 436,7 |
conn = &connections[active_console]; |
|
if ((ev.key >= KC_F1) && (ev.key < KC_F1 + |
CONSOLE_COUNT)) { |
CONSOLE_COUNT) && ((ev.mods & KM_CTRL) == 0)) { |
if (ev.key == KC_F12) |
change_console(KERNEL_CONSOLE); |
else |
465,25 → 467,28 |
static void cons_write(int consnum, ipc_callid_t rid, ipc_call_t *request) |
{ |
ipc_callid_t callid; |
size_t len; |
size_t i; |
size_t size; |
wchar_t ch; |
size_t off; |
|
if (!ipc_data_write_receive(&callid, &len)) { |
if (!ipc_data_write_receive(&callid, &size)) { |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
} |
|
if (len > CWRITE_BUF_SIZE) |
len = CWRITE_BUF_SIZE; |
if (size > CWRITE_BUF_SIZE) |
size = CWRITE_BUF_SIZE; |
|
(void) ipc_data_write_finalize(callid, cwrite_buf, len); |
(void) ipc_data_write_finalize(callid, cwrite_buf, size); |
|
for (i = 0; i < len; i++) { |
write_char(consnum, cwrite_buf[i]); |
off = 0; |
while (off < size) { |
ch = str_decode(cwrite_buf, &off, size); |
write_char(consnum, ch); |
} |
|
gcons_notify_char(consnum); |
ipc_answer_1(rid, EOK, len); |
ipc_answer_1(rid, EOK, size); |
} |
|
/** Default thread for new connections */ |