gregkh / usbutils

USB utilities for Linux, including lsusb
http://www.linux-usb.org
354 stars 199 forks source link

Do not warn about missing LPM bit when not required #189

Open tmon-nordic opened 4 months ago

tmon-nordic commented 4 months ago

The bcdUSB value 0x0210 defined in USB 3.2 Specification indicates USB 3.2 device operating in one of the USB 2.0 modes. USB 2.0 Link Power Management Addendum defines bcdUSB value 0x0201 to indicate that USB 2.0 device supports the request to read the BOS Descriptor.

The main difference between bcdUSB 0x0210 and 0x0201 is that the USB 3.2 device must support LPM, while USB 2.0 devices can (but are not required to) support LPM.

The difference is respected by USB 3 Gen X Command Verifier (2.3.0.0) Chapter 9 Tests [USB 2 devices], where the test behaves as follows:

  * For bcdUSB 0x0200:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.00.
      DUT is NOT compatible with LPM.
      LPM is NOT required for DUT
      LPM is only supported in USB version 2.01 and above.

  * For bcdUSB 0x0201:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.01.
      DUT IS compatible with LPM.
      LPM is NOT required for DUT
      USB 2.0 Extension Descriptor bmAttributes:
        LPM Capable = 0
        BESL and Alternate HIRD Supported = 0
        Baseline BESL Valid = 0
        Deep BESL Valid = 0
        Baseline BESL: 0d
        Deep BESL:  0d
      LPM is not supported

  * For bcdUSB 0x0210:
      Checking Device Under Test for LPM L1 Compatibility...
      USB version of device is 2.10.
      DUT IS compatible with LPM.
      LPM IS required for DUT
      USB 2.0 Extension Descriptor bmAttributes:
        LPM Capable = 0
        BESL and Alternate HIRD Supported = 0
        Baseline BESL Valid = 0
        Deep BESL Valid = 0
        Baseline BESL: 0d
        Deep BESL:  0d
      (USB: 9.6.2.1.6) Bit 1 in Attributes field of a USB 2.0 Extension
      descriptor returned in response to a GetDescriptor(BOS) request
      must be 1 for LS/FS/HS devices that support LPM L1.

The LPM bit must be set only when bcdUSB is at least 0x0210 or when BESL bit is set. Change the check to only print missing must-be-set LPM bit warning when it is required by the specification.