Added USE_INTERNAL_SERIAL compile time option to automatically read out the internal...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / CDC.c
index aef5b35..2d5ec0f 100644 (file)
@@ -71,7 +71,6 @@ static uint8_t CDC_Host_ProcessConfigDescriptor(USB_ClassInfo_CDC_Host_t* CDCInt
                                if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, \r
                                                              DComp_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
                                {\r
-                                       /* Descriptor not found, error out */\r
                                        return CDC_ENUMERROR_NoCDCInterfaceFound;\r
                                }\r
                        }\r
@@ -149,10 +148,12 @@ static uint8_t DComp_CDC_Host_NextCDCControlInterface(void* CurrentDescriptor)
 {\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
        {\r
-               /* Check the CDC descriptor class, subclass and protocol, break out if correct control interface found */\r
-               if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class    == CDC_CONTROL_CLASS)    &&\r
-                   (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CONTROL_SUBCLASS) &&\r
-                   (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CONTROL_PROTOCOL))\r
+               USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,\r
+                                                                               USB_Descriptor_Interface_t);\r
+       \r
+               if ((CurrentInterface->Class    == CDC_CONTROL_CLASS)    &&\r
+                   (CurrentInterface->SubClass == CDC_CONTROL_SUBCLASS) &&\r
+                       (CurrentInterface->Protocol == CDC_CONTROL_PROTOCOL))\r
                {\r
                        return DESCRIPTOR_SEARCH_Found;\r
                }\r
@@ -165,10 +166,12 @@ static uint8_t DComp_CDC_Host_NextCDCDataInterface(void* CurrentDescriptor)
 {\r
        if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
        {\r
-               /* Check the CDC descriptor class, subclass and protocol, break out if correct data interface found */\r
-               if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class    == CDC_DATA_CLASS)    &&\r
-                   (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) &&\r
-                   (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_DATA_PROTOCOL))\r
+               USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,\r
+                                                                               USB_Descriptor_Interface_t);\r
+       \r
+               if ((CurrentInterface->Class    == CDC_DATA_CLASS)    &&\r
+                   (CurrentInterface->SubClass == CDC_DATA_SUBCLASS) &&\r
+                       (CurrentInterface->Protocol == CDC_DATA_PROTOCOL))\r
                {\r
                        return DESCRIPTOR_SEARCH_Found;\r
                }\r
@@ -181,8 +184,10 @@ static uint8_t DComp_CDC_Host_NextInterfaceCDCDataEndpoint(void* CurrentDescript
 {\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) || (EndpointType == EP_TYPE_INTERRUPT))\r
                  return DESCRIPTOR_SEARCH_Found;\r
@@ -215,7 +220,6 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
                        USB_HostState = HOST_STATE_Configured;\r
                        break;\r
                case HOST_STATE_Configured:\r
-                               \r
                        USB_HostState = HOST_STATE_Ready;\r
                        break;\r
        }\r