Changes in uspace/lib/drv/generic/remote_usb.c [b7fd2a0:90c340fb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usb.c
rb7fd2a0 r90c340fb 79 79 * @return Error code. 80 80 */ 81 errno_t usb_get_my_interface(async_exch_t *exch, int *usb_iface)81 int usb_get_my_interface(async_exch_t *exch, int *usb_iface) 82 82 { 83 83 if (!exch) 84 84 return EBADMEM; 85 85 sysarg_t iface_no; 86 const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),86 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), 87 87 IPC_M_USB_GET_MY_INTERFACE, &iface_no); 88 88 if (ret == EOK && usb_iface) … … 99 99 * 100 100 */ 101 errno_t usb_get_my_device_handle(async_exch_t *exch, devman_handle_t *handle)101 int usb_get_my_device_handle(async_exch_t *exch, devman_handle_t *handle) 102 102 { 103 103 devman_handle_t h = 0; 104 const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),104 const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE), 105 105 IPC_M_USB_GET_MY_DEVICE_HANDLE, &h); 106 106 if (ret == EOK && handle) … … 114 114 * @return Error code. 115 115 */ 116 errno_t usb_reserve_default_address(async_exch_t *exch, usb_speed_t speed)116 int usb_reserve_default_address(async_exch_t *exch, usb_speed_t speed) 117 117 { 118 118 if (!exch) … … 129 129 * 130 130 */ 131 errno_t usb_release_default_address(async_exch_t *exch)131 int usb_release_default_address(async_exch_t *exch) 132 132 { 133 133 if (!exch) … … 145 145 * 146 146 */ 147 errno_t usb_device_enumerate(async_exch_t *exch, unsigned port)148 { 149 if (!exch) 150 return EBADMEM; 151 const errno_t ret = async_req_2_0(exch, DEV_IFACE_ID(USB_DEV_IFACE),147 int usb_device_enumerate(async_exch_t *exch, unsigned port) 148 { 149 if (!exch) 150 return EBADMEM; 151 const int ret = async_req_2_0(exch, DEV_IFACE_ID(USB_DEV_IFACE), 152 152 IPC_M_USB_DEVICE_ENUMERATE, port); 153 153 return ret; … … 162 162 * 163 163 */ 164 errno_t usb_device_remove(async_exch_t *exch, unsigned port)164 int usb_device_remove(async_exch_t *exch, unsigned port) 165 165 { 166 166 if (!exch) … … 177 177 } pack8_t; 178 178 179 errno_t usb_register_endpoint(async_exch_t *exch, usb_endpoint_t endpoint,179 int usb_register_endpoint(async_exch_t *exch, usb_endpoint_t endpoint, 180 180 usb_transfer_type_t type, usb_direction_t direction, 181 181 size_t mps, unsigned packets, unsigned interval) … … 194 194 } 195 195 196 errno_t usb_unregister_endpoint(async_exch_t *exch, usb_endpoint_t endpoint,196 int usb_unregister_endpoint(async_exch_t *exch, usb_endpoint_t endpoint, 197 197 usb_direction_t direction) 198 198 { … … 203 203 } 204 204 205 errno_t usb_read(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup,205 int usb_read(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup, 206 206 void *data, size_t size, size_t *rec_size) 207 207 { … … 233 233 234 234 /* Wait for the answer. */ 235 errno_t data_request_rc;236 errno_t opening_request_rc;235 sysarg_t data_request_rc; 236 sysarg_t opening_request_rc; 237 237 async_wait_for(data_request, &data_request_rc); 238 238 async_wait_for(opening_request, &opening_request_rc); … … 241 241 /* Prefer the return code of the opening request. */ 242 242 if (opening_request_rc != EOK) { 243 return ( errno_t) opening_request_rc;243 return (int) opening_request_rc; 244 244 } else { 245 return ( errno_t) data_request_rc;245 return (int) data_request_rc; 246 246 } 247 247 } 248 248 if (opening_request_rc != EOK) { 249 return ( errno_t) opening_request_rc;249 return (int) opening_request_rc; 250 250 } 251 251 … … 254 254 } 255 255 256 errno_t usb_write(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup,256 int usb_write(async_exch_t *exch, usb_endpoint_t endpoint, uint64_t setup, 257 257 const void *data, size_t size) 258 258 { … … 273 273 /* Send the data if any. */ 274 274 if (size > 0) { 275 const errno_t ret = async_data_write_start(exch, data, size);275 const int ret = async_data_write_start(exch, data, size); 276 276 if (ret != EOK) { 277 277 async_forget(opening_request); … … 281 281 282 282 /* Wait for the answer. */ 283 errno_t opening_request_rc;283 sysarg_t opening_request_rc; 284 284 async_wait_for(opening_request, &opening_request_rc); 285 285 286 return ( errno_t) opening_request_rc;286 return (int) opening_request_rc; 287 287 } 288 288 … … 330 330 331 331 int iface_no; 332 const errno_t ret = usb_iface->get_my_interface(fun, &iface_no);332 const int ret = usb_iface->get_my_interface(fun, &iface_no); 333 333 if (ret != EOK) { 334 334 async_answer_0(callid, ret); … … 349 349 350 350 devman_handle_t handle; 351 const errno_t ret = usb_iface->get_my_device_handle(fun, &handle);351 const int ret = usb_iface->get_my_device_handle(fun, &handle); 352 352 if (ret != EOK) { 353 353 async_answer_0(callid, ret); … … 368 368 369 369 usb_speed_t speed = DEV_IPC_GET_ARG1(*call); 370 const errno_t ret = usb_iface->reserve_default_address(fun, speed);370 const int ret = usb_iface->reserve_default_address(fun, speed); 371 371 async_answer_0(callid, ret); 372 372 } … … 382 382 } 383 383 384 const errno_t ret = usb_iface->release_default_address(fun);384 const int ret = usb_iface->release_default_address(fun); 385 385 async_answer_0(callid, ret); 386 386 } … … 397 397 398 398 const unsigned port = DEV_IPC_GET_ARG1(*call); 399 const errno_t ret = usb_iface->device_enumerate(fun, port);399 const int ret = usb_iface->device_enumerate(fun, port); 400 400 async_answer_0(callid, ret); 401 401 } … … 412 412 413 413 const unsigned port = DEV_IPC_GET_ARG1(*call); 414 const errno_t ret = usb_iface->device_remove(fun, port);414 const int ret = usb_iface->device_remove(fun, port); 415 415 async_answer_0(callid, ret); 416 416 } … … 435 435 unsigned interval = pack.arr[3]; 436 436 437 const errno_t ret = usb_iface->register_endpoint(fun, endpoint,437 const int ret = usb_iface->register_endpoint(fun, endpoint, 438 438 transfer_type, direction, max_packet_size, packets, interval); 439 439 … … 454 454 usb_direction_t direction = (usb_direction_t) DEV_IPC_GET_ARG2(*call); 455 455 456 errno_t rc = usb_iface->unregister_endpoint(fun, endpoint, direction);456 int rc = usb_iface->unregister_endpoint(fun, endpoint, direction); 457 457 458 458 async_answer_0(callid, rc); … … 491 491 } 492 492 493 static void callback_out( errno_t outcome, void *arg)493 static void callback_out(int outcome, void *arg) 494 494 { 495 495 async_transaction_t *trans = arg; … … 500 500 } 501 501 502 static void callback_in( errno_t outcome, size_t actual_size, void *arg)502 static void callback_in(int outcome, size_t actual_size, void *arg) 503 503 { 504 504 async_transaction_t *trans = (async_transaction_t *)arg; … … 563 563 } 564 564 565 const errno_t rc = usb_iface->read(565 const int rc = usb_iface->read( 566 566 fun, ep, setup, trans->buffer, size, callback_in, trans); 567 567 … … 601 601 size_t size = 0; 602 602 if (data_buffer_len > 0) { 603 const errno_t rc = async_data_write_accept(&trans->buffer, false,603 const int rc = async_data_write_accept(&trans->buffer, false, 604 604 1, data_buffer_len, 0, &size); 605 605 … … 611 611 } 612 612 613 const errno_t rc = usb_iface->write(613 const int rc = usb_iface->write( 614 614 fun, ep, setup, trans->buffer, size, callback_out, trans); 615 615
Note:
See TracChangeset
for help on using the changeset viewer.