From 5527e73305e8a9958b00331902a27514e62d539b Mon Sep 17 00:00:00 2001 From: Igor Kotrasinski Date: Thu, 20 Aug 2015 10:00:01 +0200 Subject: [PATCH] usb: gadget: composite: fill bcdUSB for any gadget max speed When handling device GET_DESCRIPTOR, composite gadget driver fills the bcdUSB field only if the gadget supports USB 3.0. Otherwise the field is left unfilled. For consistency, set bcdUSB to 0x0200 for gadgets that don't support superspeed. It's correct to use 0x0200 for any setting that doesn't use superspeed, since USB 2.0 devices can restrict themselves to full speed only. It is NOT correct to use 0x0210, since BOS descriptors are handled only if gadget_is_superspeed() is satisfied, otherwise it results in a stall. Signed-off-by: Igor Kotrasinski Signed-off-by: Felipe Balbi --- drivers/usb/gadget/composite.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 3e95c0e88b8b..8b14c2a13ac5 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1504,6 +1504,8 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) } else { cdev->desc.bcdUSB = cpu_to_le16(0x0210); } + } else { + cdev->desc.bcdUSB = cpu_to_le16(0x0200); } value = min(w_length, (u16) sizeof cdev->desc);