} while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&\r
(CurrentHIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));\r
\r
- HIDInterfaceInfo->State.InterfaceNumber =\r
- #if defined(USE_NONSTANDARD_DESCRIPTOR_NAMES)\r
- CurrentHIDInterface->InterfaceNumber;\r
- #else\r
- CurrentHIDInterface->bInterfaceNumber;\r
- #endif\r
+ HIDInterfaceInfo->State.InterfaceNumber = CurrentHIDInterface->InterfaceNumber;\r
HIDInterfaceInfo->State.SupportsBootSubClass = (CurrentHIDInterface->SubClass != 0);\r
\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)\r
+ {\r
+ return HID_ENUMERROR_NoHIDDescriptorFound;\r
+ }\r
+\r
+ HIDInterfaceInfo->State.HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_HID_Descriptor_t).HIDReportLength;\r
+\r
while (FoundEndpoints != (HID_FOUND_DATAPIPE_IN | HID_FOUND_DATAPIPE_OUT))\r
{\r
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,\r
return DESCRIPTOR_SEARCH_NotFound;\r
}\r
\r
+static uint8_t DComp_NextHID(void* CurrentDescriptor)\r
+{\r
+ if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)\r
+ return DESCRIPTOR_SEARCH_Found;\r
+ else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)\r
+ return DESCRIPTOR_SEARCH_Fail;\r
+ else\r
+ return DESCRIPTOR_SEARCH_NotFound; \r
+}\r
+\r
static uint8_t DComp_HID_Host_NextHIDInterfaceEndpoint(void* CurrentDescriptor)\r
{\r
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)\r
\r
Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
\r
+ if (UseReportProtocol && !(HIDInterfaceInfo->State.SupportsBootSubClass))\r
+ return MS_ERROR_UNSUPPORTED;\r
+ \r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r