Add user-filtering to the HID report parser, so that the user code can decide which...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / MassStorage.c
index 65c49b1..678c070 100644 (file)
@@ -45,7 +45,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_
          return MS_ENUMERROR_InvalidConfigDescriptor;\r
        \r
        if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor,\r
-                                     DComp_NextMassStorageInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
+                                     DComp_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
        {\r
                return MS_ENUMERROR_NoMSInterfaceFound;\r
        }\r
@@ -60,7 +60,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_
        while (FoundEndpoints != (MS_FOUND_DATAPIPE_IN | MS_FOUND_DATAPIPE_OUT))\r
        {\r
                if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor,\r
-                                             DComp_NextInterfaceBulkDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
+                                             DComp_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
                {\r
                        return MS_ENUMERROR_EndpointsNotFound;\r
                }\r
@@ -91,13 +91,16 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_
        return MS_ENUMERROR_NoError;\r
 }\r
 \r
-static uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor)\r
+static uint8_t DComp_NextMSInterface(void* CurrentDescriptor)\r
 {\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
        {\r
-               if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class    == MASS_STORE_CLASS)    &&\r
-                   (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == MASS_STORE_SUBCLASS) &&\r
-                   (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MASS_STORE_PROTOCOL))\r
+               USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,\r
+                                                                               USB_Descriptor_Interface_t);\r
+\r
+               if ((CurrentInterface->Class    == MASS_STORE_CLASS)    &&\r
+                   (CurrentInterface->SubClass == MASS_STORE_SUBCLASS) &&\r
+                   (CurrentInterface->Protocol == MASS_STORE_PROTOCOL))\r
                {\r
                        return DESCRIPTOR_SEARCH_Found;\r
                }\r
@@ -106,7 +109,7 @@ static uint8_t DComp_NextMassStorageInterface(void* CurrentDescriptor)
        return DESCRIPTOR_SEARCH_NotFound;\r
 }\r
 \r
-static uint8_t DComp_NextInterfaceBulkDataEndpoint(void* CurrentDescriptor)\r
+static uint8_t DComp_NextMSInterfaceEndpoint(void* CurrentDescriptor)\r
 {\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
        {\r