Changeset e765ccb in mainline for uspace/lib/drv/generic/remote_usbhid.c
- Timestamp:
- 2011-05-20T10:44:53Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e7079cf
- Parents:
- d1fb591
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhid.c
rd1fb591 re765ccb 71 71 } 72 72 73 int len = hid_iface->get_event_length(fun);73 size_t len = hid_iface->get_event_length(fun); 74 74 if (len == 0) { 75 75 len = EEMPTY; … … 100 100 return; 101 101 } 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 // } 106 106 if (len == 0) { 107 107 async_answer_0(data_callid, EINVAL); … … 111 111 int rc; 112 112 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) { 116 115 async_answer_0(data_callid, ENOMEM); 117 116 async_answer_0(callid, ENOMEM); 118 117 } 119 118 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); 123 121 if (rc != EOK) { 124 free( usage_pages_and_usages);122 free(data); 125 123 async_answer_0(data_callid, rc); 126 124 async_answer_0(callid, rc); 127 125 } 128 if (act_ items >= items) {126 if (act_length >= len) { 129 127 /* This shall not happen. */ 130 128 // FIXME: how about an assert here? 131 act_ items = items;129 act_length = len; 132 130 } 133 131 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); 136 133 137 free( usage_pages_and_usages);134 free(data); 138 135 139 136 async_answer_0(callid, EOK);
Note:
See TracChangeset
for help on using the changeset viewer.