|
|
@ -79,22 +79,15 @@ int main(void)
|
|
|
|
uint16_t ConfigDescriptorSize;
|
|
|
|
uint16_t ConfigDescriptorSize;
|
|
|
|
uint8_t ConfigDescriptorData[512];
|
|
|
|
uint8_t ConfigDescriptorData[512];
|
|
|
|
|
|
|
|
|
|
|
|
if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)
|
|
|
|
if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||
|
|
|
|
|
|
|
|
(ConfigDescriptorSize > sizeof(ConfigDescriptorData)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("Error Retrieving Device Descriptor.\r\n");
|
|
|
|
printf("Error Retrieving Configuration Descriptor.\r\n");
|
|
|
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
|
|
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
|
|
|
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
|
|
|
|
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ConfigDescriptorSize > 512)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("Device Descriptor Too Large To Process.\r\n");
|
|
|
|
|
|
|
|
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
|
|
|
|
|
|
|
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData);
|
|
|
|
USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData);
|
|
|
|
|
|
|
|
|
|
|
|
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,
|
|
|
|
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,
|
|
|
|