diff --git a/flight/pios/stm32f4xx/pios_usb_hid.c b/flight/pios/stm32f4xx/pios_usb_hid.c index c6862eb18..92fb8d898 100644 --- a/flight/pios/stm32f4xx/pios_usb_hid.c +++ b/flight/pios/stm32f4xx/pios_usb_hid.c @@ -218,12 +218,12 @@ static bool PIOS_USB_HID_SendReport(struct pios_usb_hid_dev *usb_hid_dev) #ifdef PIOS_USB_BOARD_BL_HID_HAS_NO_LENGTH_BYTE PIOS_USBHOOK_EndpointTx(usb_hid_dev->cfg->data_tx_ep, usb_hid_dev->tx_packet_buffer, - bytes_to_tx + 1); + sizeof(usb_hid_dev->tx_packet_buffer)); #else usb_hid_dev->tx_packet_buffer[1] = bytes_to_tx; PIOS_USBHOOK_EndpointTx(usb_hid_dev->cfg->data_tx_ep, usb_hid_dev->tx_packet_buffer, - bytes_to_tx + 2); + sizeof(usb_hid_dev->tx_packet_buffer)); #endif #if defined(PIOS_INCLUDE_FREERTOS) diff --git a/flight/pios/stm32f4xx/pios_usbhook.c b/flight/pios/stm32f4xx/pios_usbhook.c index cc8907e2f..259861b14 100644 --- a/flight/pios/stm32f4xx/pios_usbhook.c +++ b/flight/pios/stm32f4xx/pios_usbhook.c @@ -402,8 +402,7 @@ static uint8_t PIOS_USBHOOK_CLASS_DataIn(void *pdev, uint8_t epnum) if ((epnum_idx < NELEMENTS(usb_epin_table)) && usb_epin_table[epnum_idx].cb) { struct usb_ep_entry *ep = &(usb_epin_table[epnum_idx]); - uint16_t rxcount = USBD_GetRxCount(pdev, epnum); - if (!ep->cb(ep->context, epnum_idx, rxcount)) { + if (!ep->cb(ep->context, epnum_idx, ep->max_len)) { /* NOTE: use real endpoint number including direction bit */ DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_TX_NAK); }