Changeset 9dddb3d in mainline for uspace/lib/usbhid/src/hidiface.c
- Timestamp:
- 2011-05-24T21:52:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa8d346
- Parents:
- a28b41d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhid/src/hidiface.c
ra28b41d r9dddb3d 56 56 IPC_M_USBHID_GET_EVENT_LENGTH, &len); 57 57 if (rc == EOK) { 58 *size = (size_t) len; 58 if (size != NULL) { 59 *size = (size_t) len; 60 } 59 61 } 60 62 … … 148 150 int usbhid_dev_get_report_descriptor_length(int dev_phone, size_t *size) 149 151 { 150 /** @todo Implement! */ 151 return ENOTSUP; 152 if (dev_phone < 0) { 153 return EINVAL; 154 } 155 156 sysarg_t arg_size; 157 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(USBHID_DEV_IFACE), 158 IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH, &arg_size); 159 if (rc == EOK) { 160 if (size != NULL) { 161 *size = (size_t) arg_size; 162 } 163 } 164 return rc; 152 165 } 153 166 … … 155 168 size_t *actual_size) 156 169 { 157 /** @todo Implement! */ 158 return ENOTSUP; 170 if (dev_phone < 0) { 171 return EINVAL; 172 } 173 if ((buf == NULL)) { 174 return ENOMEM; 175 } 176 if (size == 0) { 177 return EINVAL; 178 } 179 180 aid_t opening_request = async_send_1(dev_phone, 181 DEV_IFACE_ID(USBHID_DEV_IFACE), IPC_M_USBHID_GET_REPORT_DESCRIPTOR, 182 NULL); 183 if (opening_request == 0) { 184 return ENOMEM; 185 } 186 187 ipc_call_t data_request_call; 188 aid_t data_request = async_data_read(dev_phone, buf, size, 189 &data_request_call); 190 if (data_request == 0) { 191 async_wait_for(opening_request, NULL); 192 return ENOMEM; 193 } 194 195 sysarg_t data_request_rc; 196 sysarg_t opening_request_rc; 197 async_wait_for(data_request, &data_request_rc); 198 async_wait_for(opening_request, &opening_request_rc); 199 200 if (data_request_rc != EOK) { 201 /* Prefer return code of the opening request. */ 202 if (opening_request_rc != EOK) { 203 return (int) opening_request_rc; 204 } else { 205 return (int) data_request_rc; 206 } 207 } 208 209 if (opening_request_rc != EOK) { 210 return (int) opening_request_rc; 211 } 212 213 size_t act_size = IPC_GET_ARG2(data_request_call); 214 215 if (actual_size != NULL) { 216 *actual_size = act_size; 217 } 218 219 return EOK; 159 220 } 160 221
Note:
See TracChangeset
for help on using the changeset viewer.