+ switch (USB_HostState)\r
+ {\r
+ case HOST_STATE_Addressed:\r
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+ \r
+ uint16_t ConfigDescriptorSize;\r
+ uint8_t ConfigDescriptorData[512];\r
+\r
+ if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||\r
+ (ConfigDescriptorSize > sizeof(ConfigDescriptorData)) ||\r
+ (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData)))\r
+ {\r
+ printf("Error Retrieving Configuration Descriptor.\r\n");\r
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+ break;\r
+ }\r
+\r
+ if (CDC_Host_ConfigurePipes(&VirtualSerial_CDC_Interface,\r
+ ConfigDescriptorSize, ConfigDescriptorData) != CDC_ENUMERROR_NoError)\r
+ {\r
+ printf("Attached Device Not a Valid CDC Class Device.\r\n");\r
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+ break;\r
+ }\r
+ \r
+ if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)\r
+ {\r
+ printf("Error Setting Device Configuration.\r\n");\r
+ LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
+ break;\r
+ }\r
+ \r
+ printf("CDC Device Enumerated.\r\n");\r
+ USB_HostState = HOST_STATE_Configured;\r
+ break;\r
+ case HOST_STATE_Configured:\r
+ break;\r
+ }\r
+ \r