/* Look for the bString that has the address equal to the ptr and return its index. Use it to determine the index of the bString and assign it to the interfaces iInterface variable.  */
int usb_get_str_descriptor_idx(void *ptr)
/* Look for the bString that has the address equal to the ptr and return its index. Use it to determine the index of the bString and assign it to the interfaces iInterface variable.  */
int usb_get_str_descriptor_idx(void *ptr)
{
	struct usb_desc_header *head = __usb_descriptor_start;
	struct usb_string_descriptor *str = ptr;
	int str_descr_idx = 0;
	while (head->bLength != 0U) {
		switch (head->bDescriptorType) {
		case USB_DESC_STRING:
			if (head == (struct usb_desc_header *)str) {
				return str_descr_idx;
			}
			str_descr_idx += 1;
			break;
		default:
			break;
		}
		head = (struct usb_desc_header *)((uint8_t *)head + head->bLength);
	}
	return 0;
}