[RFC] usb_scan_device() only considers first interface

Marek Vasut marex at denx.de
Mon Apr 5 14:29:03 CEST 2021


On 4/5/21 1:04 AM, Heinrich Schuchardt wrote:
> Hello Marek,

Hi,

> I have a USB HID device with two interfaces:
> 
> 2: Human Interface,  USB Revision 1.0
> - WCH.CN 7
>             Serial To HID 12345678
> - Class: (from Interface) Human Interface
> - PacketSize: 8  Configurations: 1
> - Vendor: 0x1a86  Product 0xe026 Version 55.0
>    Configuration: 1
>    - Interfaces: 2 Bus Powered Remote Wakeup 100mA
>      Interface: 0
>      - Alternate Setting 0, Endpoints: 2
>      - Class Human Interface, Subclass: None
>      - Endpoint 2 In Interrupt MaxPacket 8 Interval 1ms
>      - Endpoint 2 Out Interrupt MaxPacket 8 Interval 1ms
>      Interface: 1
>      - Alternate Setting 0, Endpoints: 1
>      - Class Human Interface, Subclass: Boot Keyboard
>      - Endpoint 1 In Interrupt MaxPacket 8 Interval 1ms
> 
> Linux correctly detects the HID keyboard and receives key strokes.
> 
> U-Boot's usb_scan_device() does not detect that this is a boot keyboard
> because it only tries to match interface 0 and not interface 1.
> Shouldn't it iterate over all interfaces to find a matching driver?

It likely should, but I doubt anyone had such hardware when the keyboard 
driver was originally implemented.

> Further work in common/usb_kbd.c will be needed to actually use 
> interface 1.

Patches welcome.


More information about the U-Boot mailing list