Re: [PATCH] USB: usblp: add USBLP_QUIRK_NO_SET_INTF flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 18 Jan 2021 11:31:17 -0500
Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:

> > diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
> > index 37062130a03c..0c4a98f00797 100644
> > --- a/drivers/usb/class/usblp.c
> > +++ b/drivers/usb/class/usblp.c
> > @@ -1315,7 +1315,11 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
> >  	alts = usblp->protocol[protocol].alt_setting;
> >  	if (alts < 0)
> >  		return -EINVAL;
> > -	r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
> > +	if (usblp->dev->quirks & USB_QUIRK_NO_SET_INTF) {
> > +		r = 0;
> > +	} else {
> > +		r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
> > +	}
> >  	if (r < 0) {
> >  		printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n",
> >  			alts, usblp->ifnum);  
> 
> Would it be practical simply to skip the usb_set_interface() call 
> whenever alts is 0?  After all, devices use altsetting 0 by default; it 
> shouldn't be necessary to tell them to do so.

Is it possible to bind and unbind the driver without enumeration, and
thus inherit a non-zero altsetting?

I'm also concerned about regressions. This is a legacy class driver,
only used where CUPS is not applicable, mostly with truly ancient
devices. So yes, setting a zero altsetting after enumeration should
be unnecessary. But you never know with the old firmware.

-- Pete




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux