From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: retry reset if a device times out
Date: Wed, 03 Feb 2016 21:52:39 +0100 [thread overview]
Message-ID: <1454532759.22169.0.camel@suse.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1602031115460.2041-100000@iolanthe.rowland.org>
On Wed, 2016-02-03 at 11:24 -0500, Alan Stern wrote:
> On Wed, 3 Feb 2016, Oliver Neukum wrote:
>
> > Some devices I got show an inability to operate right after
> > power on if they are already connected. They are beyond recovery
> > if the descriptors are requested multiple times. So in case of
> > a timeout we rather bail early and reset again.
> >
> > This patch is a rework of a patch that fell through the cracks.
> > http://www.spinics.net/lists/linux-usb/msg103263.html
> >
> > Signed-off-by: Oliver Neukum <oneukum@suse.com>
> > CC: stable@vger.kernel.org
> > ---
> > drivers/usb/core/hub.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index f912fe6..2124c4e 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -4496,7 +4496,12 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
> > r = -EPROTO;
> > break;
> > }
> > - if (r == 0)
> > + /*
> > + * Some devices time out if they are powered on
> > + * when already connected. They need a second
> > + * reset.
> > + */
> > + if (r == 0 || r == -ETIMEDOUT)
> > break;
> > }
> > udev->descriptor.bMaxPacketSize0 =
> >
>
> Hmmm. Your device fails completely if there are multiple attempts
> without a reset in between, right?
>
> What about devices which always time out the first control request
> after a reset? I can't be certain any such devices exist, but it
> wouldn't be surprising given the range of hardware bugs in USB devices.
>
> Would it be safer to do this instead?
>
> if (r == 0 || (r == -ETIMEDOUT &&
> j = 0))
> break;
Indeed. Greg, I'll make an improved patch.
Regards
Oliver
next prev parent reply other threads:[~2016-02-03 20:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 10:47 [PATCH] usb: retry reset if a device times out Oliver Neukum
2016-02-03 16:24 ` Alan Stern
2016-02-03 20:52 ` Oliver Neukum [this message]
2016-02-04 6:53 ` Peter Chen
2016-02-04 8:53 ` Oliver Neukum
2016-02-04 9:08 ` Peter Chen
2016-02-04 9:30 ` Oliver Neukum
2016-02-04 15:41 ` Alan Stern
2016-02-05 2:16 ` Peter Chen
-- strict thread matches above, loose matches on Subject: below --
2016-02-10 10:33 Oliver Neukum
2016-02-17 3:38 ` Peter Chen
2016-02-17 9:15 ` Oliver Neukum
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=1454532759.22169.0.camel@suse.com \
--to=oneukum@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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;
as well as URLs for NNTP newsgroup(s).