All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: way to notice user when a device connected to a inappropriate port
@ 2024-03-28 16:57 Cui Alan
  0 siblings, 0 replies; 3+ messages in thread
From: Cui Alan @ 2024-03-28 16:57 UTC (permalink / raw)
  To: Alan Stern, mathias.nyman; +Cc: linux-usb, kexybiscuit

> Sender: Alan Stern <stern@rowland.harvard.edu> 
> Mar 29, 2024 at 00:22:10AM +0800
> Recipient: Cui Alan <AlanCui4080@outlook.com>
> Cc: inux-usb@vger.kernel.org; kexybiscuit@outlook.com
> Subject: Re: way to notice user when a device connected to a inappropriate port
>
> 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
Excatly, there are two situations I said above " a SuperSpeed-only device plugged into a USB-2 port." and " a device which supports SuperSpeed plugged into a USB-2 port.".
Maybe its more secure to ask the XHCI mantaniner before we do that. Looking forward to reply from all of you.

Alan Cui


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: way to notice user when a device connected to a inappropriate port
  2024-03-28  3:20 Cui Alan
@ 2024-03-28 16:22 ` Alan Stern
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Stern @ 2024-03-28 16:22 UTC (permalink / raw)
  To: Cui Alan; +Cc: linux-usb, kexybiscuit

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* way to notice user when a device connected to a inappropriate port
@ 2024-03-28  3:20 Cui Alan
  2024-03-28 16:22 ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Cui Alan @ 2024-03-28  3:20 UTC (permalink / raw)
  To: linux-usb; +Cc: kexybiscuit

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-28 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 16:57 way to notice user when a device connected to a inappropriate port Cui Alan
  -- strict thread matches above, loose matches on Subject: below --
2024-03-28  3:20 Cui Alan
2024-03-28 16:22 ` Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.