aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders
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
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')
-rw-r--r--Bootloaders/CDC/BootloaderCDC.c3
-rw-r--r--Bootloaders/DFU/BootloaderDFU.c17
-rw-r--r--Bootloaders/TeensyHID/TeensyHID.c4
3 files changed, 16 insertions, 8 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c
index 60fe4a4bc..0add977ce 100644
--- a/Bootloaders/CDC/BootloaderCDC.c
+++ b/Bootloaders/CDC/BootloaderCDC.c
@@ -167,6 +167,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupIN();
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupOUTReceived()));
Endpoint_ClearSetupOUT();
}
@@ -184,6 +185,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupOUT();
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
}
@@ -194,6 +196,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
{
Endpoint_ClearSetupReceived();
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
Endpoint_ClearSetupIN();
}
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;
diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c
index fe20702cd..93f062195 100644
--- a/Bootloaders/TeensyHID/TeensyHID.c
+++ b/Bootloaders/TeensyHID/TeensyHID.c
@@ -144,10 +144,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket)
Endpoint_ClearSetupOUT();
- /* Wait until the host is ready to receive the request confirmation */
+ /* Acknowledge status stage */
while (!(Endpoint_IsSetupINReady()));
-
- /* Handshake the request by sending an empty IN packet */
Endpoint_ClearSetupIN();
}