/* Handles the GET_DESCRIPTOR callback. All required descriptors must be handled here.  */
static const USBDescriptor* get_descriptor(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang)
/* Handles the GET_DESCRIPTOR callback. All required descriptors must be handled here.  */
static const USBDescriptor* get_descriptor(USBDriver *usbp, uint8_t dtype, uint8_t dindex, uint16_t lang)
{
    (void)usbp;
    (void)lang;
    switch (dtype)
    {
        case USB_DESCRIPTOR_DEVICE:
            return &vcom_device_descriptor;
        case USB_DESCRIPTOR_CONFIGURATION:
            return &vcom_configuration_descriptor;
        case USB_DESCRIPTOR_STRING:
            if (dindex < 4)
            {
                if (dindex == 3)
                {
                    Get_SerialNum((uint8_t *)&usb_serial_number.bPropertyData[INDEX_OF_WCHAR_FOR_UNIQUE_ID]);
                }
                return &vcom_strings[dindex];
            }
    }
    return NULL;
}