/* Standard device request to get descriptors about USB device.  */
static bool udc_req_std_dev_get_descriptor(void)
/* Standard device request to get descriptors about USB device.  */
static bool udc_req_std_dev_get_descriptor(void)
{
	switch ((uint8_t) (udd_g_ctrlreq.req.wValue >> 8)) {
	case USB_DT_DEVICE:
		udd_set_setup_payload(
				(uint8_t*)&udc_device_desc,
				udc_device_desc.bLength);
		break;
	case USB_DT_CONFIGURATION:
		udd_set_setup_payload(
				(uint8_t*)&udc_desc_fs,
				le16_to_cpu(udc_desc_fs.conf.wTotalLength));
		break;
	case USB_DT_STRING:
		if (!udc_req_std_dev_get_str_desc()) {
			return false;
		}
		break;
	default:
		return false;
	}
	if (udd_g_ctrlreq.req.wLength < udd_g_ctrlreq.payload_size) {
		udd_g_ctrlreq.payload_size = udd_g_ctrlreq.req.wLength;
	}
	return true;
}