From b20d25854d7134ed5c73bfcd852a6e3e4febdc0b Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Thu, 2 Dec 2010 04:28:53 +0000
Subject: [PATCH] Fixed HID hpst class driver incorrectly binding to HID
 devices that do not have an OUT endpoint.

---
 LUFA/Drivers/USB/Class/Host/HID.c | 5 ++++-
 LUFA/ManPages/ChangeLog.txt       | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index e6c575e212..427dbd56de 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -88,7 +88,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
 		USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
 
 		if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
-		  DataINEndpoint = EndpointData;
+		  DataINEndpoint  = EndpointData;
 		else
 		  DataOUTEndpoint = EndpointData;
 	}
@@ -115,6 +115,9 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
 		}
 		else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
 		{
+			if (DataOUTEndpoint == NULL)
+			  continue;
+		
 			Size            = DataOUTEndpoint->EndpointSize;
 			EndpointAddress = DataOUTEndpoint->EndpointAddress;
 			Token           = PIPE_TOKEN_OUT;
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 494f1797be..025e5bfd9f 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -25,6 +25,7 @@
   *  <b>Fixed:</b>
   *  - Core:
   *   - Fixed broken USBFOO board drivers due to missing BOARD_USBFOO define
+  *   - Fixed HID hpst class driver incorrectly binding to HID devices that do not have an OUT endpoint
   *  - Library Applications:
   *   - Fixed Benito project discarding incoming data from the USB virtual serial port when the USART is busy
   *   - Fixed broken DFU bootloader, added XPLAIN support for bootloader start when XCK jumpered to ground