diff options
| author | hathach <[email protected]> | 2020-05-28 13:48:02 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-05-28 13:48:02 +0700 |
| commit | 10cd3f24bf0af9b7a1f357505ebbb5ef2132e34b (patch) | |
| tree | 36c1c14d5d53651ab32bdc0b08e15278da92ed57 /src/class/vendor | |
| parent | c1db36a15c1e38adc142ec74fd5f3b0320053cc9 (diff) | |
initial transfer failed in open() shouldn't cause the driver open to fail.
Diffstat (limited to 'src/class/vendor')
| -rw-r--r-- | src/class/vendor/vendor_device.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c index 98eafe44c..8f2dfef32 100644 --- a/src/class/vendor/vendor_device.c +++ b/src/class/vendor/vendor_device.c @@ -186,12 +186,15 @@ uint16_t vendord_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, ui TU_ASSERT(usbd_open_edpt_pair(rhport, tu_desc_next(itf_desc), 2, TUSB_XFER_BULK, &p_vendor->ep_out, &p_vendor->ep_in), 0); p_vendor->itf_num = itf_desc->bInterfaceNumber; - uint16_t const drv_len = sizeof(tusb_desc_interface_t) + itf_desc->bNumEndpoints*sizeof(tusb_desc_endpoint_t); // Prepare for incoming data - TU_ASSERT(usbd_edpt_xfer(rhport, p_vendor->ep_out, p_vendor->epout_buf, sizeof(p_vendor->epout_buf)), drv_len); + if ( !usbd_edpt_xfer(rhport, p_vendor->ep_out, p_vendor->epout_buf, sizeof(p_vendor->epout_buf)) ) + { + TU_LOG1_FAILED(); + TU_BREAKPOINT(); + } - return drv_len; + return sizeof(tusb_desc_interface_t) + itf_desc->bNumEndpoints*sizeof(tusb_desc_endpoint_t); } bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes) |
