Changes in uspace/srv/hid/fb/serial_console.c [4f14e1f8:32e7411] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/fb/serial_console.c
r4f14e1f8 r32e7411 39 39 40 40 #include <stdio.h> 41 #include <ipc/ipc.h> 41 42 #include <async.h> 42 43 #include <ipc/fb.h> … … 46 47 #include <io/style.h> 47 48 #include <str.h> 48 #include <inttypes.h>49 49 #include <io/screenbuffer.h> 50 50 … … 54 54 #define MAX_CONTROL 20 55 55 56 static sysarg_t scr_width;57 static sysarg_t scr_height;56 static ipcarg_t scr_width; 57 static ipcarg_t scr_height; 58 58 static bool color = true; /**< True if producing color output. */ 59 59 static bool utf8 = false; /**< True if producing UTF8 output. */ 60 60 static putc_function_t putc_function; 61 61 62 static sysarg_t lastcol = 0;63 static sysarg_t lastrow = 0;62 static ipcarg_t lastcol = 0; 63 static ipcarg_t lastrow = 0; 64 64 static attrs_t cur_attr = { 65 65 .t = at_style, … … 129 129 } 130 130 131 void serial_goto(const sysarg_t col, const sysarg_t row)131 void serial_goto(const ipcarg_t col, const ipcarg_t row) 132 132 { 133 133 if ((col > scr_width) || (row > scr_height)) … … 135 135 136 136 char control[MAX_CONTROL]; 137 snprintf(control, MAX_CONTROL, "\033[%" PRIun ";%" PRIun "f", 138 row + 1, col + 1); 137 snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1); 139 138 serial_puts(control); 140 139 } … … 251 250 252 251 /** Set scrolling region. */ 253 void serial_set_scroll_region( sysarg_t last_row)252 void serial_set_scroll_region(ipcarg_t last_row) 254 253 { 255 254 char control[MAX_CONTROL]; 256 snprintf(control, MAX_CONTROL, "\033[0;% " PRIun "r", last_row);255 snprintf(control, MAX_CONTROL, "\033[0;%ur", last_row); 257 256 serial_puts(control); 258 257 } … … 268 267 } 269 268 270 void serial_console_init(putc_function_t putc_fn, sysarg_t w, sysarg_t h)269 void serial_console_init(putc_function_t putc_fn, ipcarg_t w, ipcarg_t h) 271 270 { 272 271 scr_width = w; … … 285 284 * 286 285 */ 287 static void draw_text_data(keyfield_t *data, sysarg_t x0, sysarg_t y0,288 sysarg_t width, sysarg_t height)286 static void draw_text_data(keyfield_t *data, ipcarg_t x0, ipcarg_t y0, 287 ipcarg_t width, ipcarg_t height) 289 288 { 290 289 attrs_t *a0 = &data[0].attrs; 291 290 serial_set_attrs(a0); 292 291 293 sysarg_t y;292 ipcarg_t y; 294 293 for (y = 0; y < height; y++) { 295 294 serial_goto(x0, y0 + y); 296 295 297 sysarg_t x;296 ipcarg_t x; 298 297 for (x = 0; x < width; x++) { 299 298 attrs_t *attr = &data[y * width + x].attrs; … … 318 317 319 318 if (client_connected) { 320 async_answer_0(iid, ELIMIT);319 ipc_answer_0(iid, ELIMIT); 321 320 return; 322 321 } 323 322 324 323 client_connected = 1; 325 async_answer_0(iid, EOK);324 ipc_answer_0(iid, EOK); 326 325 327 326 /* Clear the terminal, set scrolling region … … 336 335 337 336 wchar_t c; 338 sysarg_t col;339 sysarg_t row;340 sysarg_t w;341 sysarg_t h;337 ipcarg_t col; 338 ipcarg_t row; 339 ipcarg_t w; 340 ipcarg_t h; 342 341 ssize_t rows; 343 342 344 343 int retval; 345 344 346 switch (IPC_GET_ IMETHOD(call)) {345 switch (IPC_GET_METHOD(call)) { 347 346 case IPC_M_PHONE_HUNGUP: 348 347 client_connected = 0; 349 async_answer_0(callid, EOK);348 ipc_answer_0(callid, EOK); 350 349 351 350 /* Exit thread */ … … 406 405 break; 407 406 case FB_GET_CSIZE: 408 async_answer_2(callid, EOK, scr_width, scr_height);407 ipc_answer_2(callid, EOK, scr_width, scr_height); 409 408 continue; 410 409 case FB_GET_COLOR_CAP: 411 async_answer_1(callid, EOK, color ? FB_CCAP_INDEXED :410 ipc_answer_1(callid, EOK, color ? FB_CCAP_INDEXED : 412 411 FB_CCAP_STYLE); 413 412 continue; … … 441 440 442 441 if (rows >= 0) { 443 if (( sysarg_t) rows > scr_height) {442 if ((ipcarg_t) rows > scr_height) { 444 443 retval = EINVAL; 445 444 break; 446 445 } 447 446 } else { 448 if (( sysarg_t) (-rows) > scr_height) {447 if ((ipcarg_t) (-rows) > scr_height) { 449 448 retval = EINVAL; 450 449 break; … … 477 476 retval = ENOENT; 478 477 } 479 async_answer_0(callid, retval);478 ipc_answer_0(callid, retval); 480 479 } 481 480 }
Note:
See TracChangeset
for help on using the changeset viewer.