forked from mirror/qmk_firmware
Make Control Endpoint stream transfers more reliable by adding in early aborts for unexpected new SETUP tokens, or unexpected status stage during control stream writes.
Fix corruption in Device RNDIS demos TCP stack when too many connections attempted simultaneously, freezing the device when a page was re-fetched before the first connection was closed. Fix incorrect model compatibility information in the Host LowLevel demo overview text files.
This commit is contained in:
@@ -76,7 +76,7 @@ void Endpoint_ClearStatusStage(void)
|
||||
if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST)
|
||||
{
|
||||
while (!(Endpoint_IsOUTReceived()))
|
||||
{
|
||||
{
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
|
||||
|
||||
while (Length)
|
||||
{
|
||||
if (Endpoint_IsSETUPReceived())
|
||||
return ENDPOINT_RWCSTREAM_HostAborted;
|
||||
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
{
|
||||
while (Length && Endpoint_BytesInEndpoint())
|
||||
@@ -13,10 +19,7 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
|
||||
}
|
||||
|
||||
Endpoint_ClearOUT();
|
||||
}
|
||||
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||
}
|
||||
}
|
||||
|
||||
while (!(Endpoint_IsINReady()))
|
||||
|
||||
@@ -6,36 +6,28 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length)
|
||||
if (Length > USB_ControlRequest.wLength)
|
||||
Length = USB_ControlRequest.wLength;
|
||||
|
||||
while (Length && !(Endpoint_IsOUTReceived()))
|
||||
while (Length || LastPacketFull)
|
||||
{
|
||||
while (!(Endpoint_IsINReady()))
|
||||
{
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||
}
|
||||
if (Endpoint_IsSETUPReceived())
|
||||
return ENDPOINT_RWCSTREAM_HostAborted;
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
break;
|
||||
|
||||
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||
|
||||
if (Endpoint_IsINReady())
|
||||
{
|
||||
TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
Length--;
|
||||
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
|
||||
{
|
||||
TEMPLATE_TRANSFER_BYTE(DataStream);
|
||||
Length--;
|
||||
}
|
||||
|
||||
LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
if (Endpoint_IsOUTReceived())
|
||||
return ENDPOINT_RWCSTREAM_HostAborted;
|
||||
|
||||
if (LastPacketFull)
|
||||
{
|
||||
while (!(Endpoint_IsINReady()))
|
||||
{
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
|
||||
}
|
||||
|
||||
Endpoint_ClearIN();
|
||||
}
|
||||
|
||||
while (!(Endpoint_IsOUTReceived()))
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
* - Fixed report data alignment issues in the MouseHostWithParser demo when X and Y movement data size is not a multiple of 8 bits
|
||||
* - Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered
|
||||
* - Fixed incorrect BUTTONS_BUTTON1 for the STK526 target
|
||||
* - Fixed RNDIS demos freezing when more than one connection was attempted simultaneously, causing memory corruption
|
||||
*
|
||||
*
|
||||
* \section Sec_ChangeLog090605 Version 090605
|
||||
|
||||
Reference in New Issue
Block a user