Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/console/console.c

    r38d150e r1d6dd2a  
    5151#include <fibril_synch.h>
    5252#include <stdlib.h>
     53#include <str.h>
    5354#include "console.h"
    5455
     
    101102static console_t *active_console = &consoles[0];
    102103
    103 static int input_ev_active(input_t *);
    104 static int input_ev_deactive(input_t *);
    105 static int input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
    106 static int input_ev_move(input_t *, int, int);
    107 static int input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
    108 static int input_ev_button(input_t *, int, int);
     104static errno_t input_ev_active(input_t *);
     105static errno_t input_ev_deactive(input_t *);
     106static errno_t input_ev_key(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t);
     107static errno_t input_ev_move(input_t *, int, int);
     108static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned, unsigned);
     109static errno_t input_ev_button(input_t *, int, int);
    109110
    110111static input_ev_ops_t input_ev_ops = {
     
    117118};
    118119
    119 static int cons_open(con_srvs_t *, con_srv_t *);
    120 static int cons_close(con_srv_t *);
    121 static int cons_read(con_srv_t *, void *, size_t);
    122 static int cons_write(con_srv_t *, void *, size_t);
     120static errno_t cons_open(con_srvs_t *, con_srv_t *);
     121static errno_t cons_close(con_srv_t *);
     122static errno_t cons_read(con_srv_t *, void *, size_t, size_t *);
     123static errno_t cons_write(con_srv_t *, void *, size_t, size_t *);
    123124static void cons_sync(con_srv_t *);
    124125static void cons_clear(con_srv_t *);
    125126static void cons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
    126 static int cons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
    127 static int cons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
    128 static int cons_get_color_cap(con_srv_t *, console_caps_t *);
     127static errno_t cons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
     128static errno_t cons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
     129static errno_t cons_get_color_cap(con_srv_t *, console_caps_t *);
    129130static void cons_set_style(con_srv_t *, console_style_t);
    130131static void cons_set_color(con_srv_t *, console_color_t, console_color_t,
     
    132133static void cons_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
    133134static void cons_set_cursor_visibility(con_srv_t *, bool);
    134 static int cons_get_event(con_srv_t *, cons_event_t *);
     135static errno_t cons_get_event(con_srv_t *, cons_event_t *);
    135136
    136137static con_ops_t con_ops = {
     
    230231}
    231232
    232 static int input_ev_active(input_t *input)
     233static errno_t input_ev_active(input_t *input)
    233234{
    234235        active = true;
     
    239240}
    240241
    241 static int input_ev_deactive(input_t *input)
     242static errno_t input_ev_deactive(input_t *input)
    242243{
    243244        active = false;
     
    247248}
    248249
    249 static int input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,
     250static errno_t input_ev_key(input_t *input, kbd_event_type_t type, keycode_t key,
    250251    keymod_t mods, wchar_t c)
    251252{
     
    274275}
    275276
    276 static int input_ev_move(input_t *input, int dx, int dy)
    277 {
    278         return EOK;
    279 }
    280 
    281 static int input_ev_abs_move(input_t *input, unsigned x , unsigned y,
     277static errno_t input_ev_move(input_t *input, int dx, int dy)
     278{
     279        return EOK;
     280}
     281
     282static errno_t input_ev_abs_move(input_t *input, unsigned x , unsigned y,
    282283    unsigned max_x, unsigned max_y)
    283284{
     
    285286}
    286287
    287 static int input_ev_button(input_t *input, int bnum, int bpress)
     288static errno_t input_ev_button(input_t *input, int bnum, int bpress)
    288289{
    289290        return EOK;
     
    328329}
    329330
    330 static int cons_open(con_srvs_t *srvs, con_srv_t *srv)
    331 {
    332         return EOK;
    333 }
    334 
    335 static int cons_close(con_srv_t *srv)
    336 {
    337         return EOK;
    338 }
    339 
    340 static int cons_read(con_srv_t *srv, void *buf, size_t size)
     331static errno_t cons_open(con_srvs_t *srvs, con_srv_t *srv)
     332{
     333        return EOK;
     334}
     335
     336static errno_t cons_close(con_srv_t *srv)
     337{
     338        return EOK;
     339}
     340
     341static errno_t cons_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
    341342{
    342343        uint8_t *bbuf = buf;
     
    378379        }
    379380       
    380         return size;
    381 }
    382 
    383 static int cons_write(con_srv_t *srv, void *data, size_t size)
     381        *nread = size;
     382        return EOK;
     383}
     384
     385static errno_t cons_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
    384386{
    385387        console_t *cons = srv_to_console(srv);
     
    389391                cons_write_char(cons, str_decode(data, &off, size));
    390392       
    391         return size;
     393        *nwritten = size;
     394        return EOK;
    392395}
    393396
     
    421424}
    422425
    423 static int cons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
     426static errno_t cons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
    424427{
    425428        console_t *cons = srv_to_console(srv);
     
    432435}
    433436
    434 static int cons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
     437static errno_t cons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
    435438{
    436439        console_t *cons = srv_to_console(srv);
     
    444447}
    445448
    446 static int cons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
     449static errno_t cons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
    447450{
    448451        console_t *cons = srv_to_console(srv);
     
    491494}
    492495
    493 static int cons_get_event(con_srv_t *srv, cons_event_t *event)
     496static errno_t cons_get_event(con_srv_t *srv, cons_event_t *event)
    494497{
    495498        console_t *cons = srv_to_console(srv);
     
    526529}
    527530
    528 static int input_connect(const char *svc)
     531static errno_t input_connect(const char *svc)
    529532{
    530533        async_sess_t *sess;
    531534        service_id_t dsid;
    532535       
    533         int rc = loc_service_get_id(svc, &dsid, 0);
     536        errno_t rc = loc_service_get_id(svc, &dsid, 0);
    534537        if (rc != EOK) {
    535538                printf("%s: Input service %s not found\n", NAME, svc);
     
    560563        service_id_t dsid;
    561564       
    562         int rc = loc_service_get_id(svc, &dsid, 0);
     565        errno_t rc = loc_service_get_id(svc, &dsid, 0);
    563566        if (rc == EOK) {
    564567                sess = loc_service_connect(dsid, INTERFACE_OUTPUT, 0);
     
    577580{
    578581        /* Connect to input service */
    579         int rc = input_connect(input_svc);
     582        errno_t rc = input_connect(input_svc);
    580583        if (rc != EOK)
    581584                return false;
Note: See TracChangeset for help on using the changeset viewer.