Linux USB
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Jeremy Figgins <kernel@jeremyfiggins.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: usblp: add USBLP_QUIRK_NO_SET_INTF flag
Date: Sat, 23 Jan 2021 16:33:07 -0500	[thread overview]
Message-ID: <20210123213307.GA86881@rowland.harvard.edu> (raw)
In-Reply-To: <15c2f9ba-a3c1-ebc4-25f4-f8c3df269807@jeremyfiggins.com>

On Sat, Jan 23, 2021 at 12:46:06PM -0600, Jeremy Figgins wrote:
> On 1/22/21 10:22 AM, Alan Stern wrote:
> > On Thu, Jan 21, 2021 at 07:06:27PM -0600, Jeremy Figgins wrote:
> > > On 1/21/21 5:02 PM, Pete Zaitcev wrote:
> > > > On Thu, 21 Jan 2021 14:29:29 -0500
> > > > Alan Stern <stern@rowland.harvard.edu> wrote:
> > > > 
> > > > > > 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.
> > > > 
> > > > > How about skipping the call whenever the interface has only one
> > > > > altsetting?
> > > > 
> > > > Do you mean when it's only one and not equal to zero?
> > > > 
> > > > BTW, one other thing bothers me. Jeremy confirmed that my patch
> > > > worked, which skips the call when USB_QUIRK_NO_SET_INTF is set.
> > > > But if we look into drivers/usb/core/message.c, the control
> > > > exchange to set the altsetting is skipped in that case anyway.
> > > > So, usblp was calling usb_set_protocol, the suspect control was
> > > > skipped, but something else caused a problem. Could it be the
> > > > attempt to clear halt that triggered the problem?
> > > > 
> > > > -- Pete
> > > > 
> > > 
> > > 
> > > In my debugging, I found that it was the calls to usb_control_msg_send() in
> > > both usb_set_interface() and usb_clear_halt() caused the printer to lockup.
> > > I suppose another way to resolve this would to have a flag to prevent
> > > usb_clear_halt()'s call to usb_control_msg_send(), but I'm not an expert in
> > > USB, so I'm not sure of the ramifications of that.
> > 
> > The simplest solution in all cases is just to avoid calling either
> > usb_set_interface or usb_clear_halt.  Especially since in cases where
> > the interface has only one altsetting, neither call should be necessary.
> > 
> > Alan Stern
> > 
> 
> I can confirm that only calling usb_clear_halt() if USB_QUIRK_NO_SET_INTF is
> not set (and setting it for my device) does allow my device to work. What is
> the next step? Should I submit a v2 patch?

Why don't you write, test, and submit a patch that will make usblp avoid 
calling usb_set_interface and usb_clear_halt when there's only one 
altsetting?

Alan Stern

  reply	other threads:[~2021-01-23 21:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 21:36 [PATCH] USB: usblp: add USBLP_QUIRK_NO_SET_INTF flag Jeremy Figgins
2021-01-18  5:44 ` Pete Zaitcev
2021-01-18 16:31   ` Alan Stern
2021-01-18 16:43     ` Michael Sweet
2021-01-19  0:01       ` Jeremy Figgins
2021-01-21 19:21         ` Pete Zaitcev
2021-01-21 19:19     ` Pete Zaitcev
2021-01-21 19:29       ` Alan Stern
2021-01-21 23:02         ` Pete Zaitcev
2021-01-22  1:06           ` Jeremy Figgins
2021-01-22 16:22             ` Alan Stern
2021-01-23 18:46               ` Jeremy Figgins
2021-01-23 21:33                 ` Alan Stern [this message]
2021-01-22 16:20           ` Alan Stern
2021-01-18  9:02 ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210123213307.GA86881@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@jeremyfiggins.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox