Skip to content

Commit 9d3bd76

Browse files
huangruigregkh
authored andcommitted
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 <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 488c9cd commit 9d3bd76

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/usb/misc/usbtest.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,19 @@ static int ch9_postconfig(struct usbtest_dev *dev)
689689
return (retval < 0) ? retval : -EDOM;
690690
}
691691

692+
/*
693+
* there's always [9.4.3] a bos device descriptor [9.6.2] in USB
694+
* 3.0 spec
695+
*/
696+
if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0300) {
697+
retval = usb_get_descriptor(udev, USB_DT_BOS, 0, dev->buf,
698+
sizeof(*udev->bos->desc));
699+
if (retval != sizeof(*udev->bos->desc)) {
700+
dev_err(&iface->dev, "bos descriptor --> %d\n", retval);
701+
return (retval < 0) ? retval : -EDOM;
702+
}
703+
}
704+
692705
/* there's always [9.4.3] at least one config descriptor [9.6.3] */
693706
for (i = 0; i < udev->descriptor.bNumConfigurations; i++) {
694707
retval = usb_get_descriptor(udev, USB_DT_CONFIG, i,

0 commit comments

Comments
 (0)