1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

f1 usb cdc: ensure uart state is transmitted on control endpoint

Previously, the IN stage on the CTRL interface would write (and
send) its data via the buffer owned by the DATA endpoint.  This
would probably have overwritten any data being sent at that
moment.  This may have caused data corruption from FC -> GCS.
This commit is contained in:
Stacey Sheldon 2013-02-11 08:21:36 -05:00 committed by Alessio Morale
parent cf14608ebe
commit 590feefd9b

View File

@ -409,10 +409,10 @@ static void PIOS_USB_CDC_CTRL_EP_IN_Callback(void)
uart_state.bmUartState = htousbs(0x0003);
UserToPMABufferCopy((uint8_t *) &uart_state,
GetEPTxAddr(usb_cdc_dev->cfg->data_tx_ep),
GetEPTxAddr(usb_cdc_dev->cfg->ctrl_tx_ep),
sizeof(uart_state));
SetEPTxCount(usb_cdc_dev->cfg->data_tx_ep, PIOS_USB_BOARD_CDC_MGMT_LENGTH);
SetEPTxValid(usb_cdc_dev->cfg->data_tx_ep);
SetEPTxCount(usb_cdc_dev->cfg->ctrl_tx_ep, PIOS_USB_BOARD_CDC_MGMT_LENGTH);
SetEPTxValid(usb_cdc_dev->cfg->ctrl_tx_ep);
}
#endif /* PIOS_INCLUDE_USB_CDC */