Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/ps2mouse/ps2mouse.c

    rc657bd7 rb7fd2a0  
    3636#include <stdbool.h>
    3737#include <errno.h>
     38#include <str_error.h>
    3839#include <ddf/log.h>
    3940#include <io/keycode.h>
     
    7677        uint8_t data = 0; \
    7778        size_t nread; \
    78         const int rc = chardev_read((mouse)->chardev, &data, 1, &nread); \
     79        const errno_t rc = chardev_read((mouse)->chardev, &data, 1, &nread); \
    7980        if (rc != EOK) { \
    80                 ddf_msg(LVL_ERROR, "Failed reading byte: %d", rc);\
     81                ddf_msg(LVL_ERROR, "Failed reading byte: %s", str_error_name(rc));\
    8182                return rc; \
    8283        } \
     
    9394        uint8_t data = (value); \
    9495        size_t nwr; \
    95         const int rc = chardev_write((mouse)->chardev, &data, 1, &nwr); \
     96        const errno_t rc = chardev_write((mouse)->chardev, &data, 1, &nwr); \
    9697        if (rc != EOK) { \
    97                 ddf_msg(LVL_ERROR, "Failed writing byte: %d", rc); \
     98                ddf_msg(LVL_ERROR, "Failed writing byte: %s", str_error_name(rc)); \
    9899                return rc; \
    99100        } \
    100101} while (0)
    101102
    102 static int polling_ps2(void *);
    103 static int polling_intellimouse(void *);
    104 static int probe_intellimouse(ps2_mouse_t *, bool);
     103static errno_t polling_ps2(void *);
     104static errno_t polling_intellimouse(void *);
     105static errno_t probe_intellimouse(ps2_mouse_t *, bool);
    105106static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *);
    106107
     
    119120 * @return EOK on success or non-zero error code
    120121 */
    121 int ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev)
     122errno_t ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev)
    122123{
    123124        async_sess_t *parent_sess;
    124125        bool bound = false;
    125         int rc;
     126        errno_t rc;
    126127
    127128        mouse->client_sess = NULL;
     
    164165
    165166        /* Probe IntelliMouse extensions. */
    166         int (*polling_f)(void*) = polling_ps2;
     167        errno_t (*polling_f)(void*) = polling_ps2;
    167168        if (probe_intellimouse(mouse, false) == EOK) {
    168169                ddf_msg(LVL_NOTE, "Enabled IntelliMouse extensions");
     
    222223 * @return EOK on success or non-zero error code
    223224 */
    224 static int ps2_mouse_read_packet(ps2_mouse_t *mouse, void *pbuf, size_t psize)
    225 {
    226         int rc;
     225static errno_t ps2_mouse_read_packet(ps2_mouse_t *mouse, void *pbuf, size_t psize)
     226{
     227        errno_t rc;
    227228        size_t pos;
    228229        size_t nread;
     
    247248 * @return Never.
    248249 */
    249 int polling_ps2(void *arg)
     250errno_t polling_ps2(void *arg)
    250251{
    251252        ps2_mouse_t *mouse = (ps2_mouse_t *) arg;
    252         int rc;
     253        errno_t rc;
    253254
    254255        bool buttons[PS2_BUTTON_COUNT] = {};
     
    299300 * @return Never.
    300301 */
    301 static int polling_intellimouse(void *arg)
     302static errno_t polling_intellimouse(void *arg)
    302303{
    303304        ps2_mouse_t *mouse = (ps2_mouse_t *) arg;
    304         int rc;
     305        errno_t rc;
    305306
    306307        bool buttons[INTELLIMOUSE_BUTTON_COUNT] = {};
     
    372373 * See http://www.computer-engineering.org/ps2mouse/ for details.
    373374 */
    374 static int probe_intellimouse(ps2_mouse_t *mouse, bool buttons)
     375static errno_t probe_intellimouse(ps2_mouse_t *mouse, bool buttons)
    375376{
    376377        MOUSE_WRITE_BYTE(mouse, PS2_MOUSE_SET_SAMPLE_RATE);
Note: See TracChangeset for help on using the changeset viewer.