/* This function parses the string descriptor from the received buffer.  */
void usb_host_parsestringdesc(uint8_t *psrc, uint8_t *pdest, uint16_t length)
/* This function parses the string descriptor from the received buffer.  */
void usb_host_parsestringdesc(uint8_t *psrc, uint8_t *pdest, uint16_t length)
{
    uint16_t strlength;
    uint16_t tmp_idx;
    if (psrc[1] == USB_DESC_TYPE_STRING) {
        strlength = ((((uint16_t)psrc[0]) - 2U) <= length) ? (((uint16_t)psrc[0]) - 2U) : length;
        psrc += 2U;
        for (tmp_idx = 0U; tmp_idx < strlength; tmp_idx += 2U) {
            *pdest =  psrc[tmp_idx];
            pdest++;
        }
        *pdest = 0U;
    }
}