Re: [PATCH v3 2/4] usb: usbtest: support usb2 extension descriptor test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sarah,

On Tue, Nov 12, 2013 at 09:43:20AM -0800, Sarah Sharp wrote:
> On Mon, Oct 28, 2013 at 11:31:33PM +0800, Huang Rui wrote:
> > In Test 9 of usbtest module, it is used for performing chapter 9 tests N
> > times.
> > 
> > USB2.0 Extension descriptor is one of the generic device-level capbility
> > descriptors which added in section 9.6.2.1 of USB 3.0 spec.
> > 
> > This patch adds to support getting usb2.0 extension descriptor test
> > scenario for USB 3.0.
> 
> Why not check the USB 2.0 extension BOS descriptor for USB 2.1 devices
> as well?  Just change you check to be bcdUSB >= 0x0210.  You would have
> to make sure you fail a USB 2.1 device with a the USB 3.0 BOS extension
> descriptor or the Container ID BOS extension.
> 

Thank you to look at these patches.

I tested with a USB 3.0 pen drive of "DT Ultimate G2 16G" which is
attached on USB2 bus and act as a USB 2.1 device. It passed.
But there aren't BOS descriptor set from lsusb message attached, it's
strange, why?

BTW, is BOS descriptor set not mandatory for USB 2.1 device?

> More comments below.
> 
> > Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
> > ---
> >  drivers/usb/misc/usbtest.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 77 insertions(+)
> > 
> > diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
> > index 38ebe1d..d9ac215 100644
> > --- a/drivers/usb/misc/usbtest.c
> > +++ b/drivers/usb/misc/usbtest.c
> > @@ -606,6 +606,28 @@ static int is_good_config(struct usbtest_dev *tdev, int len)
> >  	return 0;
> >  }
> >  
> > +static int is_good_ext(struct usbtest_dev *tdev, char *buf)
> > +{
> > +	struct usb_ext_cap_descriptor *ext;
> > +	u32 attr;
> > +
> > +	ext = (struct usb_ext_cap_descriptor *) buf;
> > +
> > +	if (ext->bLength != USB_DT_USB_EXT_CAP_SIZE) {
> > +		ERROR(tdev, "bogus usb 2.0 extension descriptor length\n");
> > +		return 0;
> > +	}
> > +
> > +	attr = le32_to_cpu(ext->bmAttributes);
> > +	/* bits[1:4] is used and others are reserved */
> > +	if (attr & ~0x1e) {	/* reserved == 0 */
> > +		ERROR(tdev, "reserved bits set\n");
> > +		return 0;
> > +	}
> 
> New errata for USB 2.1 Link PM that adds support for the BESL and DBESL
> encoding uses bits[1:15].  See the "USB2-LPM-Errata-final.pdf" file in
> the latest download of the USB 2.0 spec.  This code should be fixed to
> reflect those changes (bitmask should be 0xfffe rather than 0x1e).
> 

You're right. I will make a patch to fix it.

Thanks,
Rui
Bus 001 Device 005: ID 0951:1656 Kingston Technology 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0951 Kingston Technology
  idProduct          0x1656 
  bcdDevice            1.10
  iManufacturer           1 Kingston
  iProduct                2 DT Ultimate G2
  iSerial                 3 0018F30BFDDCBC410000003D
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              498mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux