From 708a1c6166af75f0243972c81d06978cc9bf20be Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Tue, 4 May 2010 10:16:44 +0000
Subject: [PATCH] Fixed INTERRUPT_CONTROL_ENDPOINT compile time option
 preventing other interrupts from occuring while the control endpoint request
 is being processed, causing possible lockups if a USB interrupt occurs during
 a transfer.

---
 LUFA/Drivers/USB/LowLevel/USBInterrupt.c | 3 +++
 LUFA/Drivers/USB/LowLevel/USBInterrupt.h | 1 +
 LUFA/ManPages/ChangeLog.txt              | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
index 925248d13..2d9e35b72 100644
--- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
+++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
@@ -235,7 +235,10 @@ ISR(USB_COM_vect, ISR_BLOCK)
 {
 	uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
 
+	USB_INT_Disable(USB_INT_RXSTPI);
+	sei();
 	USB_USBTask();
+	USB_INT_Enable(USB_INT_RXSTPI);
 
 	USB_INT_Clear(USB_INT_RXSTPI);
 	
diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h
index cccf26ac8..e46e7597b 100644
--- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h
+++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h
@@ -43,6 +43,7 @@
 
 	/* Includes: */
 		#include <avr/io.h>
+		#include <avr/interrupt.h>
 		#include <stdbool.h>
 		
 		#include "../../../Common/Common.h"
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index b99faaca6..4c292849c 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -60,6 +60,8 @@
   *  - Fixed Set Configuration requests not being stalled until the host has set the device's address
   *  - Fixed Host mode HID class driver not sending the correct report type when HID_Host_SendReportByID() was called and the 
   *    HID_HOST_BOOT_PROTOCOL_ONLY compile time option is set
+  *  - Fixed INTERRUPT_CONTROL_ENDPOINT compile time option preventing other interrupts from occuring while the control endpoint
+  *    request is being processed, causing possible lockups if a USB interrupt occurs during a transfer
   *
   *  \section Sec_ChangeLog100219 Version 100219
   *
-- 
GitLab