1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

OP-1536 Send only the available bytes, not the entire buffer, to the USB CDC RX callback function

This commit is contained in:
Stefan Karlsson 2014-10-10 23:51:04 +02:00
parent 9fd4fb26b9
commit 3285519380

View File

@ -418,7 +418,9 @@ static uint8_t PIOS_USBHOOK_CLASS_DataOut(void *pdev, uint8_t epnum)
if ((epnum_idx < NELEMENTS(usb_epout_table)) && usb_epout_table[epnum_idx].cb) {
struct usb_ep_entry *ep = &(usb_epout_table[epnum_idx]);
if (!ep->cb(ep->context, epnum_idx, ep->max_len)) {
uint16_t len = USBD_GetRxCount(pdev, epnum);
PIOS_Assert(ep->max_len >= len);
if (!ep->cb(ep->context, epnum_idx, len)) {
/* NOTE: use real endpoint number including direction bit */
DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_RX_NAK);
}