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

Neal Gompa neal at gompa.dev
Sun Oct 29 15:37:15 CET 2023


On Sun, Oct 29, 2023 at 3:25 AM Hector Martin <marcan at marcan.st> 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.
> +                                */
> +                               break;
> +                       }
>                         epno = dev->config.if_desc[ifno].no_of_ep;
>                         if_desc = &dev->config.if_desc[ifno];
>                         if (epno >= USB_MAXENDPOINTS) {
>
> ---
> base-commit: 8ad1c9c26f7740806a162818b790d4a72f515b7e
> change-id: 20231029-usb-fixes-4-ba6931acf217
>

Irritating, but makes sense.

Reviewed-by: Neal Gompa <neal at gompa.dev>



--
真実はいつも一つ!/ Always, there's only one truth!


More information about the U-Boot mailing list