From: Alan Stern <stern@rowland.harvard.edu>
To: David Heinzelmann <heinzelmann.david@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>
Subject: Re: [PATCH] Check for changed device descriptors when a connection-change occurs before validating the connection.
Date: Wed, 25 Sep 2019 10:20:00 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.44L0.1909251010290.14432-100000@netrider.rowland.org> (raw)
In-Reply-To: <20190924100119.GA7353@dhe-pc>
On Tue, 24 Sep 2019, David Heinzelmann wrote:
> > I really don't understand this.
> >
> > Your patch involves the case where there was a connect-change event but
> > the port is still enabled. Now maybe I've forgotten about one of the
> > pathways, but it seems like that combination should never occur.
> >
> > Certainly it shouldn't occur in your case. The device disconnects and
> > then reconnects with a new set of descriptors. The disconnect should
> > cause the port to be disabled, and the port should remain disabled
> > after the reconnect occurs. So how can your new code run in the first
> > place?
> >
> > Alan Stern
> >
>
> Hi,
>
> I have a log with two devices which are connected to a hub and the hub is plugged in.
>
> The device which is not working in this log:
>
> Sep 24 08:32:21 kernel: usb 2-6-port1: status 0203 change 0011
> Sep 24 08:32:21 kernel: usb 2-6.1: new SuperSpeed Gen 1 USB device number 65 using xhci_hcd
Ah, SuperSpeed. You're using a USB-3 device. That does make a
difference.
> Sep 24 08:32:21 kernel: usb 2-6.1: udev 65, busnum 2, minor = 192
> Sep 24 08:32:21 kernel: usb 2-6.1: New USB device found, idVendor=1409, idProduct=3240, bcdDevice= 0.00
> Sep 24 08:32:21 kernel: usb 2-6.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> Sep 24 08:32:21 kernel: usb 2-6.1: Product: USB 3.0 Camera
> Sep 24 08:32:21 kernel: usb 2-6.1: Manufacturer: Camera Manufacturer
>
> Now the firmware download happens and the device is re-enumerating and a disconnect/connect should occur.
> But the only change which is seen is the following output:
>
> Sep 24 08:32:23 kernel: usb 2-6-port1: link state change
> Sep 24 08:32:23 kernel: usb 2-6-port1: status 0203, change 0041, 5.0 Gb/s
>
> Now the resuscitation is happening but from my understanding this is not correct as in the reality there was a
> reconnect from the device. So I tried to initiate a device reconnect if the device descriptor changed.
>
> It also seems to me that the enumeration from the second device (usb 2-6-port1) is blocking
> the port change event and so the actual disconnect is missed.
Now it all makes sense. Yes, I agree that your patch is the
appropriate thing to do -- except that it contains at least one logic
error: It doesn't handle the return code from
usb_get_device_descriptor() properly.
Also, I think you should expand the immediately preceding comment.
Explain that it is indeed possible for the port to be enabled at this
point, because USB-3 connections are initialized automatically by the
host controller hardware when the connection is detected.
Alan Stern
next prev parent reply other threads:[~2019-09-25 14:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 10:36 [PATCH] Check for changed device descriptors when a connection-change occurs before validating the connection David Heinzelmann
2019-09-20 8:55 ` Greg KH
2019-09-20 13:17 ` David Heinzelmann
2019-09-20 12:15 ` Greg KH
2019-09-20 15:33 ` David Heinzelmann
2019-09-23 14:49 ` Alan Stern
2019-09-24 10:01 ` David Heinzelmann
2019-09-25 14:20 ` Alan Stern [this message]
2019-09-30 7:26 ` David Heinzelmann
2019-09-30 14:25 ` Alan Stern
2019-10-04 13:23 ` David Heinzelmann
2019-10-04 14:17 ` Alan Stern
2019-10-07 8:47 ` David Heinzelmann
2019-10-07 14:01 ` Alan Stern
2019-10-07 15:35 ` Greg KH
2019-10-08 8:09 ` [PATCH v4] usb: hub: Check device descriptor before resusciation David Heinzelmann
2019-10-08 12:55 ` Greg KH
2019-10-08 16:10 ` David Heinzelmann
2019-10-08 15:17 ` Greg KH
2019-10-09 4:46 ` [PATCH v5] " David Heinzelmann
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=Pine.LNX.4.44L0.1909251010290.14432-100000@netrider.rowland.org \
--to=stern@rowland.harvard.edu \
--cc=gregkh@linuxfoundation.org \
--cc=heinzelmann.david@gmail.com \
--cc=linux-usb@vger.kernel.org \
/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).