Oops - with new changes to the way the device Configuration Descriptor is retrieved...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / MassStorage.c
index ba281cf..6a8373a 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,7 +91,7 @@ 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
@@ -106,12 +106,14 @@ 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
-               uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,\r
-                                                       USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);\r
+               USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,\r
+                                                                             USB_Descriptor_Endpoint_t);\r
+\r
+               uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);\r
 \r
                if ((EndpointType == EP_TYPE_BULK) &&\r
                    (!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress))))\r
@@ -137,7 +139,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, MS_
 {\r
        uint8_t ErrorCode = PIPE_RWSTREAM_NoError;\r
 \r
-       SCSICommandBlock->Tag = MSInterfaceInfo->State.TransactionTag++;\r
+       SCSICommandBlock->Tag = ++MSInterfaceInfo->State.TransactionTag;\r
 \r
        if (MSInterfaceInfo->State.TransactionTag == 0xFFFFFFFF)\r
          MSInterfaceInfo->State.TransactionTag = 1;\r