Fixed incorrect buffer size check in the USBtoSerial project (thanks to Yuri A Nikifo...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / HID.c
index 08fb666..fdcd6ee 100644 (file)
@@ -73,7 +73,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
                                         (HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
 
                        if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
-                                                     DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
+                                                     DCOMP_HID_Host_NextHIDDescriptor) != DESCRIPTOR_SEARCH_COMP_Found)
                        {
                                return HID_ENUMERROR_NoCompatibleInterfaceFound;
                        }
@@ -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)
+               if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
                  DataINEndpoint  = EndpointData;
                else
                  DataOUTEndpoint = EndpointData;
@@ -168,7 +168,7 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
        return DESCRIPTOR_SEARCH_NotFound;
 }
 
-static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor)
+static uint8_t DCOMP_HID_Host_NextHIDDescriptor(void* const CurrentDescriptor)
 {
        USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);