From: Huang Rui Date: Mon, 28 Oct 2013 15:31:32 +0000 (+0800) Subject: usb: usbtest: support bos descriptor test for usb 3.0 X-Git-Tag: v3.13-rc1~174^2~10 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=9d3bd7684645834ede59d285af1d70ccabee9bf3;p=cascardo%2Flinux.git usb: usbtest: support bos descriptor test for usb 3.0 In Test 9 of usbtest module, it is used for performing chapter 9 tests N times. This patch adds to support getting bos descriptor test scenario for USB 3.0. Signed-off-by: Huang Rui Acked-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 1fdd88f382cc..e7235d5cce85 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -689,6 +689,19 @@ static int ch9_postconfig(struct usbtest_dev *dev) return (retval < 0) ? retval : -EDOM; } + /* + * there's always [9.4.3] a bos device descriptor [9.6.2] in USB + * 3.0 spec + */ + if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0300) { + retval = usb_get_descriptor(udev, USB_DT_BOS, 0, dev->buf, + sizeof(*udev->bos->desc)); + if (retval != sizeof(*udev->bos->desc)) { + dev_err(&iface->dev, "bos descriptor --> %d\n", retval); + return (retval < 0) ? retval : -EDOM; + } + } + /* there's always [9.4.3] at least one config descriptor [9.6.3] */ for (i = 0; i < udev->descriptor.bNumConfigurations; i++) { retval = usb_get_descriptor(udev, USB_DT_CONFIG, i,