X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/663f449c10b9a77a429aaa81066ce2b43ca6dc39..59becad82f18c158063ef450d65fefa332857e86:/Demos/Host/MouseHostWithParser/ConfigDescriptor.c?ds=inline diff --git a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c index 486a0c7fb..5d9d3f04e 100644 --- a/Demos/Host/MouseHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/MouseHostWithParser/ConfigDescriptor.c @@ -49,7 +49,6 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t* ConfigDescriptorData; uint16_t ConfigDescriptorSize; - uint8_t ErrorCode; /* Get Configuration Descriptor size from the device */ if (USB_GetDeviceConfigDescriptor(&ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) @@ -70,14 +69,16 @@ uint8_t ProcessConfigurationDescriptor(void) return InvalidConfigDataReturned; /* Get the mouse interface from the configuration descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextMouseInterface))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DComp_NextMouseInterface) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoHIDInterfaceFound; } /* Get the mouse interface's HID descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, NextHID))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DComp_NextHID) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoHIDDescriptorFound; @@ -87,8 +88,8 @@ uint8_t ProcessConfigurationDescriptor(void) HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_Descriptor_HID_t).HIDReportLength; /* Get the mouse interface's data endpoint descriptor */ - if ((ErrorCode = USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, - NextInterfaceMouseDataEndpoint))) + if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, + DComp_NextInterfaceMouseDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found) { /* Descriptor not found, error out */ return NoEndpointFound; @@ -115,7 +116,7 @@ uint8_t ProcessConfigurationDescriptor(void) * * \return A value from the DSEARCH_Return_ErrorCodes_t enum */ -DESCRIPTOR_COMPARATOR(NextMouseInterface) +uint8_t DComp_NextMouseInterface(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface) { @@ -139,7 +140,7 @@ DESCRIPTOR_COMPARATOR(NextMouseInterface) * * \return A value from the DSEARCH_Return_ErrorCodes_t enum */ -DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint) +uint8_t DComp_NextInterfaceMouseDataEndpoint(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) { @@ -162,7 +163,7 @@ DESCRIPTOR_COMPARATOR(NextInterfaceMouseDataEndpoint) * * \return A value from the DSEARCH_Return_ErrorCodes_t enum */ -DESCRIPTOR_COMPARATOR(NextHID) +uint8_t DComp_NextHID(void* CurrentDescriptor) { if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID) return DESCRIPTOR_SEARCH_Found;