-       /* Save the HID report size for later use */
-       HIDReportSize = DESCRIPTOR_CAST(CurrConfigLocation, USB_Descriptor_HID_t).HIDReportLength;
-       
-       /* Get the joystick interface's data endpoint descriptor */
-       if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
-                                     DComp_NextJoystickInterfaceDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
-       {
-               /* Descriptor not found, error out */
-               return NoEndpointFound;
+                       /* Save the interface in case we need to refer back to it later */
+                       HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
+
+                       /* Get the HID descriptor from the configuration descriptor */
+                       if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
+                                                                                 DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
+                       {
+                               /* Descriptor not found, error out */
+                               return NoCompatibleInterfaceFound;
+                       }
+
+                       /* Save the HID descriptor for later use */
+                       HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_HID_Descriptor_HID_t);
+
+                       /* Skip the remainder of the loop as we have not found an endpoint yet */
+                       continue;
+               }
+
+               /* Retrieve the endpoint address from the endpoint descriptor */
+               USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
+
+               /* If the endpoint is a IN type endpoint */
+               if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+                 DataINEndpoint = EndpointData;