aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders/DFU/BootloaderDFU.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-03-10 05:56:17 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-03-10 05:56:17 +0000
commit38039765346c7441208dbcb3fd3cf8f13b7ced58 (patch)
treeaafe05db569ec7a2938b3e7cdbd63e4a5d6a054e /Bootloaders/DFU/BootloaderDFU.c
parent4a09da20989dfe0c41dc1272fa6dce1e11539c15 (diff)
downloadlufa-38039765346c7441208dbcb3fd3cf8f13b7ced58.tar.gz
lufa-38039765346c7441208dbcb3fd3cf8f13b7ced58.tar.bz2
lufa-38039765346c7441208dbcb3fd3cf8f13b7ced58.zip
Fixed incorrect/missing control status stage transfers on demos, bootloaders and applications (thanks to Nate Lawson).
Diffstat (limited to 'Bootloaders/DFU/BootloaderDFU.c')
-rw-r--r--Bootloaders/DFU/BootloaderDFU.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c
index 8cc5fd409..9fff20c12 100644
--- a/Bootloaders/DFU/BootloaderDFU.c
+++ b/Bootloaders/DFU/BootloaderDFU.c
@@ -57,7 +57,7 @@ bool RunBootloader = true;
/** Flag to indicate if the bootloader is waiting to exit. When the host requests the bootloader to exit and
* jump to the application address it specifies, it sends two sequential commands which must be properly
- * acknowedged. Upon reception of the first the RunBootloader flag is cleared and the WaitForExit flag is set,
+ * acknowledged. Upon reception of the first the RunBootloader flag is cleared and the WaitForExit flag is set,
* causing the bootloader to wait for the final exit command before shutting down.
*/
bool WaitForExit = false;
@@ -305,7 +305,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupOUT();
- /* Send ZLP to the host to acknowedge the request */
+ /* Acknowledge status stage */
+ while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
break;
@@ -392,7 +393,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupIN();
- /* Send ZLP to the host to acknowedge the request */
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
@@ -415,6 +416,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupIN();
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
@@ -424,9 +426,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Reset the status value variable to the default OK status */
DFU_Status = OK;
-
- Endpoint_ClearSetupIN();
+ /* Acknowledge status stage */
+ while (!(Endpoint_IsSetupINReady()));
+ Endpoint_ClearSetupIN();
+
break;
case DFU_GETSTATE:
Endpoint_ClearSetupReceived();
@@ -436,6 +440,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupIN();
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
@@ -446,6 +451,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
/* Reset the current state variable to the default idle state */
DFU_State = dfuIDLE;
+ /* Acknowledge status stage */
+ while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
break;