uint16_t ConfigDescriptorSize;\r
uint8_t ConfigDescriptorData[512];\r
\r
- if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)\r
+ if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||\r
+ (ConfigDescriptorSize > sizeof(ConfigDescriptorData)))\r
{\r
- printf("Error Retrieving Device Descriptor.\r\n");\r
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
- break;\r
- }\r
- \r
- if (ConfigDescriptorSize > 512)\r
- {\r
- printf("Device Descriptor Too Large To Process.\r\n");\r
+ printf("Error Retrieving Configuration Descriptor.\r\n");\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
uint16_t ConfigDescriptorSize;\r
uint8_t ConfigDescriptorData[512];\r
\r
- if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)\r
+ if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||\r
+ (ConfigDescriptorSize > sizeof(ConfigDescriptorData)))\r
{\r
- printf("Error Retrieving Device Descriptor.\r\n");\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 (ConfigDescriptorSize > 512)\r
- {\r
- printf("Device Descriptor Too Large To Process.\r\n");\r
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
- break;\r
- }\r
- \r
USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData);\r
\r
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,\r
uint8_t DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe */\r
uint8_t DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe */\r
\r
- bool MatchInterfaceProtocol;\r
- uint8_t HIDInterfaceProtocol;\r
+ bool MatchInterfaceProtocol; /**< Indicates whether the driver should match the device's\r
+ * HID interface protocol's value to the \ref HIDInterfaceProtocol\r
+ * suppled (otherwise just accept all HID class devices)\r
+ */\r
+ uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if the\r
+ * \ref MatchInterfaceProtocol is set to true (ignored otherwise)\r
+ */\r
} Config; /**< Config data for the USB class interface within the device. All elements in this section\r
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.\r
*/\r