On Thu, Mar 28, 2024 at 03:20:10AM +0000, Cui Alan wrote: > If we can query the capability of the root hub among the whole system, to indicate if kernel should > notice userspace that the device is pluged into a inappropriate port. When a port with higher speed and/or more capabilities the > device required is available. eg a dp display device on a normal typec even usb 2.0 only, or a superspeed device on a usb 2.0 port. > (Windows DID that) > > Also some non-standard device only provide a usb superspeed without usb 2.0 even the specifaction says > > > 11.3 USB 3.2 Device Support for USB 2.0 > >USB 3.2 device certification requirements require support for USB 2.0 for all user attached devices. > > I looked up the USB BOS descriptor and found that the field describing the device's speed capabilities is one-hot coded. > So also the device can put a billboard or BOS on usb2.0 to indicate it cannot run on such a port. > > struct _SUPER_SPEED_USB_DEVICE_CAPABILITY_DESCRIPTOR > { > BYTE bLength; > BYTE bDescriptorType; > BYTE bDevCapabilityType; // ONE HOT BIT CODING! > BYTE bmAttributes; > WORD wSpeedsSupported; > BYTE bFunctionalitySupport; > BYTE bU1DevExitLat; > WORD wU2DevExitLat; > }SUPER_SPEED_USB_DEVICE_CAPABILITY_DESCRIPTOR > > I search the kernel source, but nothing shows that kernel trying to notice user or even a pr_info when situations above happened. There is a message that gets logged when a high-speed-capable device is plugged into a USB-1.1 port, but no message when a SuperSpeed-only device is plugged into a USB-2 port. Would you like to write a patch that produces such a message? Alan Stern