From 0c00210ff32f64808e2ab7a38feae960f3981ccf Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Thu, 19 Sep 2019 18:42:17 +0200 Subject: executor: always provide DEVICE_QUALIFIER USB descriptor --- executor/common_usb.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'executor/common_usb.h') diff --git a/executor/common_usb.h b/executor/common_usb.h index 6e181836e..c4b9e96ac 100644 --- a/executor/common_usb.h +++ b/executor/common_usb.h @@ -236,6 +236,22 @@ static bool lookup_connect_response(struct vusb_connect_descriptors* descs, stru *response_length = descs->bos_len; return true; case USB_DT_DEVICE_QUALIFIER: + if (!descs->qual) { + // Fill in DEVICE_QUALIFIER based on DEVICE if not provided. + struct usb_qualifier_descriptor* qual = + (struct usb_qualifier_descriptor*)response_data; + qual->bLength = sizeof(*qual); + qual->bDescriptorType = USB_DT_DEVICE_QUALIFIER; + qual->bcdUSB = index->dev->bcdUSB; + qual->bDeviceClass = index->dev->bDeviceClass; + qual->bDeviceSubClass = index->dev->bDeviceSubClass; + qual->bDeviceProtocol = index->dev->bDeviceProtocol; + qual->bMaxPacketSize0 = index->dev->bMaxPacketSize0; + qual->bNumConfigurations = index->dev->bNumConfigurations; + qual->bRESERVED = 0; + *response_length = sizeof(*qual); + return true; + } *response_data = descs->qual; *response_length = descs->qual_len; return true; -- cgit mrf-deployment