[PATCH] usb: Ignore endpoints in non-zero altsettings

Marek Vasut marex at denx.de
Sun Oct 29 18:34:05 CET 2023


On 10/29/23 16:50, Hector Martin wrote:
> On 29/10/2023 21.04, Marek Vasut wrote:
>> On 10/29/23 08:24, Hector Martin wrote:
>>> We currently do not really handle altsettings properly, and no driver
>>> uses them. Ignore the respective endpoint descriptors for secondary
>>> altsettings, to avoid creating duplicate endpoint records in the
>>> interface.
>>>
>>> This will have to be revisited if/when we have a driver that needs
>>> altsettings to work properly.
>>>
>>> Signed-off-by: Hector Martin <marcan at marcan.st>
>>> ---
>>>    common/usb.c | 9 +++++++++
>>>    1 file changed, 9 insertions(+)
>>>
>>> diff --git a/common/usb.c b/common/usb.c
>>> index aad13fd9c557..90f72fda00bc 100644
>>> --- a/common/usb.c
>>> +++ b/common/usb.c
>>> @@ -463,6 +463,15 @@ static int usb_parse_config(struct usb_device *dev,
>>>    				puts("Endpoint descriptor out of order!\n");
>>>    				break;
>>>    			}
>>> +			if (if_desc->num_altsetting > 1) {
>>> +				/*
>>> +				 * Ignore altsettings, which can trigger duplicate
>>> +				 * endpoint errors below. Revisit this when some
>>> +				 * driver actually needs altsettings with differing
>>> +				 * endpoint setups.
>>> +				 */
>>
>> How do you trigger this error ?
>>
> 
> Plug in a device with altsettings, like most sound cards or UVC devices.

Please add that to the commit message.


More information about the U-Boot mailing list