[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <db3db4c6-d019-49d0-92ad-96427341589c@rowland.harvard.edu>
Date: Fri, 17 Oct 2025 09:10:22 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: yicongsrfy@....com
Cc: michal.pecio@...il.com, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, linux-usb@...r.kernel.org,
netdev@...r.kernel.org, oliver@...kum.org, pabeni@...hat.com
Subject: Re: [PATCH net v5 2/3] net: usb: ax88179_178a: add USB device driver
for config selection
On Fri, Oct 17, 2025 at 10:42:29AM +0800, yicongsrfy@....com wrote:
> > > + /* The vendor mode is not always config #1, so to find it out. */
> > > + c = udev->config;
> > > + num_configs = udev->descriptor.bNumConfigurations;
> > > + for (i = 0; i < num_configs; (i++, c++)) {
> > > + struct usb_interface_descriptor *desc = NULL;
> > > +
> > > + if (!c->desc.bNumInterfaces)
> > > + continue;
> > > + desc = &c->intf_cache[0]->altsetting->desc;
> > > + if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
> > > + break;
> > > + }
> > > +
> > > + if (i == num_configs)
> > > + return -ENODEV;
> > > +
> > > + return c->desc.bConfigurationValue;
> > > +}
> >
> > I wonder how many copies of this code would justify making it some
> > sort of library in usbnet or usbcore?
>
> Yes, there are many similar code instances in the USB subsystem.
> However, I'm primarily focused on the networking subsystem,
> so my abstraction work here might not be thorough enough.
> Hopefully, an experienced USB developer may can optimize this issue.
Would it help to have a USB quirks flag that tells the core to prefer
configurations with a USB_CLASS_VENDOR_SPEC interface class when we
choose the device's configuration? Or something similar to that (I'm
not sure exactly what you are looking for)?
Alan Stern
Powered by blists - more mailing lists