Changeset b7fd2a0 in mainline for uspace/lib/usbdev/src/request.c
- Timestamp:
- 2018-01-13T03:10:29Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/request.c
r36f0738 rb7fd2a0 68 68 * 69 69 */ 70 int usb_control_request_set(usb_pipe_t *pipe,70 errno_t usb_control_request_set(usb_pipe_t *pipe, 71 71 usb_request_type_t request_type, usb_request_recipient_t recipient, 72 72 uint8_t request, uint16_t value, uint16_t index, … … 127 127 * 128 128 */ 129 int usb_control_request_get(usb_pipe_t *pipe,129 errno_t usb_control_request_get(usb_pipe_t *pipe, 130 130 usb_request_type_t request_type, usb_request_recipient_t recipient, 131 131 uint8_t request, uint16_t value, uint16_t index, … … 170 170 * @return Error code. 171 171 */ 172 int usb_request_get_status(usb_pipe_t *pipe,172 errno_t usb_request_get_status(usb_pipe_t *pipe, 173 173 usb_request_recipient_t recipient, uint16_t index, 174 174 uint16_t *status) … … 184 184 uint16_t status_usb_endianess; 185 185 size_t data_transfered_size; 186 int rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD,186 errno_t rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD, 187 187 recipient, USB_DEVREQ_GET_STATUS, 0, uint16_host2usb(index), 188 188 &status_usb_endianess, 2, &data_transfered_size); … … 208 208 * @return Error code. 209 209 */ 210 int usb_request_clear_feature(usb_pipe_t *pipe,210 errno_t usb_request_clear_feature(usb_pipe_t *pipe, 211 211 usb_request_type_t request_type, usb_request_recipient_t recipient, 212 212 uint16_t feature_selector, uint16_t index) … … 232 232 * @return Error code. 233 233 */ 234 int usb_request_set_feature(usb_pipe_t *pipe,234 errno_t usb_request_set_feature(usb_pipe_t *pipe, 235 235 usb_request_type_t request_type, usb_request_recipient_t recipient, 236 236 uint16_t feature_selector, uint16_t index) … … 260 260 * @return Error code. 261 261 */ 262 int usb_request_get_descriptor(usb_pipe_t *pipe,262 errno_t usb_request_get_descriptor(usb_pipe_t *pipe, 263 263 usb_request_type_t request_type, usb_request_recipient_t recipient, 264 264 uint8_t descriptor_type, uint8_t descriptor_index, … … 298 298 * @return 299 299 */ 300 int usb_request_get_descriptor_alloc(usb_pipe_t * pipe,300 errno_t usb_request_get_descriptor_alloc(usb_pipe_t * pipe, 301 301 usb_request_type_t request_type, usb_request_recipient_t recipient, 302 302 uint8_t descriptor_type, uint8_t descriptor_index, … … 308 308 } 309 309 310 int rc;310 errno_t rc; 311 311 312 312 /* … … 364 364 * @return Error code. 365 365 */ 366 int usb_request_get_device_descriptor(usb_pipe_t *pipe,366 errno_t usb_request_get_device_descriptor(usb_pipe_t *pipe, 367 367 usb_standard_device_descriptor_t *descriptor) 368 368 { … … 373 373 size_t actually_transferred = 0; 374 374 usb_standard_device_descriptor_t descriptor_tmp; 375 int rc = usb_request_get_descriptor(pipe,375 errno_t rc = usb_request_get_descriptor(pipe, 376 376 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 377 377 USB_DESCTYPE_DEVICE, 0, 0, &descriptor_tmp, sizeof(descriptor_tmp), … … 404 404 * @return Error code. 405 405 */ 406 int usb_request_get_bare_configuration_descriptor(usb_pipe_t *pipe,406 errno_t usb_request_get_bare_configuration_descriptor(usb_pipe_t *pipe, 407 407 int index, usb_standard_configuration_descriptor_t *descriptor) 408 408 { … … 417 417 size_t actually_transferred = 0; 418 418 usb_standard_configuration_descriptor_t descriptor_tmp; 419 const int rc = usb_request_get_descriptor(pipe,419 const errno_t rc = usb_request_get_descriptor(pipe, 420 420 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 421 421 USB_DESCTYPE_CONFIGURATION, index, 0, … … 448 448 * @return Error code. 449 449 */ 450 int usb_request_get_full_configuration_descriptor(usb_pipe_t *pipe,450 errno_t usb_request_get_full_configuration_descriptor(usb_pipe_t *pipe, 451 451 int index, void *descriptor, size_t descriptor_size, size_t *actual_size) 452 452 { … … 473 473 * @return Error code. 474 474 */ 475 int usb_request_get_full_configuration_descriptor_alloc(475 errno_t usb_request_get_full_configuration_descriptor_alloc( 476 476 usb_pipe_t *pipe, int index, 477 477 const void **descriptor_ptr, size_t *descriptor_size) 478 478 { 479 int rc;479 errno_t rc; 480 480 481 481 if (descriptor_ptr == NULL) { … … 539 539 * @return Error code. 540 540 */ 541 int usb_request_set_descriptor(usb_pipe_t *pipe,541 errno_t usb_request_set_descriptor(usb_pipe_t *pipe, 542 542 usb_request_type_t request_type, usb_request_recipient_t recipient, 543 543 uint8_t descriptor_type, uint8_t descriptor_index, … … 565 565 * @return Error code. 566 566 */ 567 int usb_request_get_configuration(usb_pipe_t *pipe,567 errno_t usb_request_get_configuration(usb_pipe_t *pipe, 568 568 uint8_t *configuration_value) 569 569 { … … 571 571 size_t actual_size; 572 572 573 const int rc = usb_control_request_get(pipe,573 const errno_t rc = usb_control_request_get(pipe, 574 574 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 575 575 USB_DEVREQ_GET_CONFIGURATION, 0, 0, &value, 1, &actual_size); … … 595 595 * @return Error code. 596 596 */ 597 int usb_request_set_configuration(usb_pipe_t *pipe,597 errno_t usb_request_set_configuration(usb_pipe_t *pipe, 598 598 uint8_t configuration_value) 599 599 { … … 614 614 * @return Error code. 615 615 */ 616 int usb_request_get_interface(usb_pipe_t *pipe,616 errno_t usb_request_get_interface(usb_pipe_t *pipe, 617 617 uint8_t interface_index, uint8_t *alternate_setting) 618 618 { … … 620 620 size_t actual_size; 621 621 622 const int rc = usb_control_request_get(pipe,622 const errno_t rc = usb_control_request_get(pipe, 623 623 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE, 624 624 USB_DEVREQ_GET_INTERFACE, … … 647 647 * @return Error code. 648 648 */ 649 int usb_request_set_interface(usb_pipe_t *pipe,649 errno_t usb_request_set_interface(usb_pipe_t *pipe, 650 650 uint8_t interface_index, uint8_t alternate_setting) 651 651 { … … 666 666 * @return Error code. 667 667 */ 668 int usb_request_get_supported_languages(usb_pipe_t *pipe,668 errno_t usb_request_get_supported_languages(usb_pipe_t *pipe, 669 669 l18_win_locales_t **languages_ptr, size_t *languages_count) 670 670 { … … 675 675 uint8_t *string_descriptor = NULL; 676 676 size_t string_descriptor_size = 0; 677 const int rc = usb_request_get_descriptor_alloc(pipe,677 const errno_t rc = usb_request_get_descriptor_alloc(pipe, 678 678 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 679 679 USB_DESCTYPE_STRING, 0, 0, … … 733 733 * @return Error code. 734 734 */ 735 int usb_request_get_string(usb_pipe_t *pipe,735 errno_t usb_request_get_string(usb_pipe_t *pipe, 736 736 size_t index, l18_win_locales_t lang, char **string_ptr) 737 737 { … … 751 751 } 752 752 753 int rc;753 errno_t rc; 754 754 755 755 /* Prepare dynamically allocated variables. */ … … 824 824 * @return Error code. 825 825 */ 826 int usb_request_clear_endpoint_halt(usb_pipe_t *pipe, uint16_t ep_index)826 errno_t usb_request_clear_endpoint_halt(usb_pipe_t *pipe, uint16_t ep_index) 827 827 { 828 828 return usb_request_clear_feature(pipe, … … 838 838 * @return Error code. 839 839 */ 840 int usb_pipe_clear_halt(usb_pipe_t *ctrl_pipe, usb_pipe_t *target_pipe)840 errno_t usb_pipe_clear_halt(usb_pipe_t *ctrl_pipe, usb_pipe_t *target_pipe) 841 841 { 842 842 if ((ctrl_pipe == NULL) || (target_pipe == NULL)) { … … 854 854 * @return Error code. 855 855 */ 856 int usb_request_get_endpoint_status(usb_pipe_t *ctrl_pipe, usb_pipe_t *pipe,856 errno_t usb_request_get_endpoint_status(usb_pipe_t *ctrl_pipe, usb_pipe_t *pipe, 857 857 uint16_t *status) 858 858 { 859 859 uint16_t status_tmp; 860 860 uint16_t pipe_index = (uint16_t) pipe->endpoint_no; 861 int rc = usb_request_get_status(ctrl_pipe,861 errno_t rc = usb_request_get_status(ctrl_pipe, 862 862 USB_REQUEST_RECIPIENT_ENDPOINT, uint16_host2usb(pipe_index), 863 863 &status_tmp);
Note:
See TracChangeset
for help on using the changeset viewer.