Ignore:
Timestamp:
2011-05-20T10:44:53Z (14 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7079cf
Parents:
d1fb591
Message:

Changed HID driver interface and modified mkbd + fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhid.c

    rd1fb591 re765ccb  
    7171        }
    7272
    73         int len = hid_iface->get_event_length(fun);
     73        size_t len = hid_iface->get_event_length(fun);
    7474        if (len == 0) {
    7575                len = EEMPTY;
     
    100100                return;
    101101        }
    102         /* Check that length is even number. Truncate otherwise. */
    103         if ((len % 2) == 1) {
    104                 len--;
    105         }
     102//      /* Check that length is even number. Truncate otherwise. */
     103//      if ((len % 2) == 1) {
     104//              len--;
     105//      }
    106106        if (len == 0) {
    107107                async_answer_0(data_callid, EINVAL);
     
    111111        int rc;
    112112
    113         size_t items = len / 2;
    114         uint16_t *usage_pages_and_usages = malloc(sizeof(uint16_t) * len);
    115         if (usage_pages_and_usages == NULL) {
     113        int32_t *data = malloc(len);
     114        if (data == NULL) {
    116115                async_answer_0(data_callid, ENOMEM);
    117116                async_answer_0(callid, ENOMEM);
    118117        }
    119118
    120         size_t act_items;
    121         int rc = hid_iface->get_event(fun, usage_pages_and_usages,
    122             usage_pages_and_usages + items, items, &act_items, flags);
     119        size_t act_length;
     120        rc = hid_iface->get_event(fun, data, len, &act_length, flags);
    123121        if (rc != EOK) {
    124                 free(usage_pages_and_usages);
     122                free(data);
    125123                async_answer_0(data_callid, rc);
    126124                async_answer_0(callid, rc);
    127125        }
    128         if (act_items >= items) {
     126        if (act_length >= len) {
    129127                /* This shall not happen. */
    130128                // FIXME: how about an assert here?
    131                 act_items = items;
     129                act_length = len;
    132130        }
    133131
    134         async_data_read_finalize(data_callid, usage_pages_and_usages,
    135             act_items * 2 * sizeof(uint16_t));
     132        async_data_read_finalize(data_callid, data, act_length);
    136133
    137         free(usage_pages_and_usages);
     134        free(data);
    138135
    139136        async_answer_0(callid, EOK);
Note: See TracChangeset for help on using the changeset viewer.