Skip to content

Commit

Permalink
usb: Fix incorrect bmRequestType direction flag in USB Host Library
Browse files Browse the repository at this point in the history
usb_host_transfer_submit_control() uses the incorrect bmRequestType direction
flag. Therefore, when doing a transfer check, all transfers were mistakenly
treated as OUT transfers (only affects transfer check and not actual transfer).
  • Loading branch information
Dazza0 committed Dec 6, 2022
1 parent d69d1aa commit c2bc34e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/usb/usb_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ esp_err_t usb_host_transfer_submit_control(usb_host_client_handle_t client_hdl,
//Check that control transfer is valid
HOST_CHECK(transfer->device_handle != NULL, ESP_ERR_INVALID_ARG); //Target device must be set
usb_device_handle_t dev_hdl = transfer->device_handle;
bool xfer_is_in = ((usb_setup_packet_t *)transfer->data_buffer)->bmRequestType & USB_BM_REQUEST_TYPE_DIR_OUT;
bool xfer_is_in = ((usb_setup_packet_t *)transfer->data_buffer)->bmRequestType & USB_BM_REQUEST_TYPE_DIR_IN;
usb_device_info_t dev_info;
ESP_ERROR_CHECK(usbh_dev_get_info(dev_hdl, &dev_info));
HOST_CHECK(transfer_check(transfer, USB_TRANSFER_TYPE_CTRL, dev_info.bMaxPacketSize0, xfer_is_in), ESP_ERR_INVALID_ARG);
Expand Down

0 comments on commit c2bc34e

Please sign in to comment.