[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb
Subject:    Re: USB Type-C hub detection is flaky
From:       Timur =?ISO-8859-1?Q?Krist=F3f?= <timur.kristof () gmail ! com>
Date:       2018-06-29 20:26:46
Message-ID: f1bf8a84d23b405e7e0ecf713917ba2f0f06b0c9.camel () gmail ! com
[Download RAW message or body]

Hi Heikki,

On Fri, 2018-06-29 at 14:42 +0300, Heikki Krogerus wrote:
> Hi Tim,
> 
> On Tue, Jun 26, 2018 at 02:10:57PM +0200, Timur Krist?f wrote:
> > > Can you send the dmesg output after you have plugged the powered
> > > and
> > > non-powered hubs:
> > 
> > Right now I have the Dell Type-C to USB 3.0 Type-A adapter with the
> > USB
> > 2.0 hub here. There is a Logitech received plugged into the hub.
> > (So I
> > can quickly see if it works or not.)
> > 
> > After some trial-and-error I figured out when it works and when
> > not.
> > Tests were performed on Fedora 28 with kernel 4.17.2.
> > 
> > Basically it always works just on the first try. In other words,
> > when I
> > power up the USB 2.0 hub and plug it in, then it works. If I plug
> > it
> > out, but keep it powered and plug it back in again, it stops
> > working.
> 
> I wonder if the PD controller or EC firmware is seeing the
> disconnection. Perhaps we can test it.

How does the PD controller come into the picture?
(Assuming you mean PD = Power Delivery?)

The device I was talking about does not (and should not) deliver any
power to the laptop. Again this is a powered USB 2.0 hub with the Dell
Type-C to Type-A adapter, so it does not support PD.

(Next week I will buy a Type-C hub with PD support so will be able to
test with that too.)

> 
> Can you check if have the USB Type-C ports and partners in sysfs
> folder /sys/class/typec?
> 
>         % ls /sys/class/typec/
>         port0  port0-partner port1

On kernel 4.17.2 (as packaged by Fedora 28), that directory is empty,
even though I have something plugged in to all ports.

> It may be that you need to cherry-pick a few patches from Greg's
> tree [1][2] that fix an issue we had with the UCSI device on those
> Dell laptops. Can you build your own kernel?
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/co
> mmit/?h=usb-linus&id=d2d2e3c46be5d6dd8001d0eebdf7cafb9bc7006b
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/co
> mmit/?h=usb-linus&id=1f9f9d168ce619608572b01771c47a41b15429e6

How I usually build a kernel is I just use Fedora's config and tools,
ie. I patch the latest Fedora kernel and build it using 'fedpkg'
locally. Hope this approach is OK.

Now I got the latest from the f28 branch (which is 4.17.3 with some
patches). I added the two patches from above.

With the patched kernel, the directory is non-empty but it does not
correctly react to hotplugging and unplugging.

> But if you can see the ports and partners under that sysfs folder,
> after you unplug the device, does the port<x>-partner disappears?

When I have something in every port on bootup I see this:

$ ls /sys/class/typec/
port0  port0-partner  port1  port1-partner  port2  port2-partner

But when I boot the machine with nothing plugged in, and then plug the
things in later:

- Type-C adapter with the USB 2.0 hub does not get a "partner" when it
is hotplugged, only when it is plugged in at boot time. The partner
correctly disappears when I plug it out but never appears again.

- Type-C charger appears as a "partner" when hot-plugged, but the
partner does not disappear even if I plug it out. Despite this,
charging continues to work when I plug it back in to any port. Though
no other partner gets created when I plug it into a different port.

Note that despite the presence of the "partner" Linux still recognizes
that the laptop is not charging, when the charger is plugged out.

- Type-C to DisplayPort adapter also shows up as a partner only when it
is present at boot time. Otherwise not. However it still works with any
of the three Type-C ports.

> 
> > If it was plugged into another computer but kept powered, it does
> > not
> > work with this laptop either. (Until I power the hub off and on
> > again.)
> > 
> > It appears that the Thunderbolt and non-Thunderbolt ports behave
> > slightly differently, and the same testcases leave wildly different
> > messages in dmesg. So I will describe what I did and what output I
> > got
> > from dmesg.
> 
> Did you have a change to test if the problem can be reproduced in
> Windows too?

Sorry, not yet but I will get around to it next week.
(The XPS is my primary work machine so I will have to back up
everything before trying my luck with Windows.)

> FYI. I'll be travelling next week, so expect delays in my answers.

I hope you have a great time!

Best regards,
Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic