All of lore.kernel.org
 help / color / mirror / Atom feed
* How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
@ 2020-09-05 11:37 Hans de Goede
  2020-09-06  2:22 ` Alan Stern
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2020-09-05 11:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Stern; +Cc: linux-usb

Hi All,

I have been debugging an issue with a 2-in-1 which
consists of a tablet + a kbd-dock, where the device
turns into a clamshell when docked into the kbd-dock.

The kbd dock is connected via pogo-pins. This works
fine when docked at boot. But there is an enumeration
issue when hot-docked (and the keyboard looses power
when the lid is closedm so this also triggers after
a suspend/resume):

[ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
[ 3499.041725] usb 1-3: device descriptor read/64, error -71
[ 3515.215890] usb 1-3: device descriptor read/64, error -110
[ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
[ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
[ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3515.603596] usb 1-3: Product: ITE Device(8910)
[ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.

Note there is about 6 seconds before the keyboard becomes
usable, which is quite long when trying to unlock the
laptop after opening the lid.

If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:

echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks

Then this changes to:

[ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
[ 4467.878483] usb 1-3: Device not responding to setup address.
[ 4468.082476] usb 1-3: Device not responding to setup address.
[ 4468.289990] usb 1-3: device not accepting address 7, error -71
[ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
[ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
[ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4468.662444] usb 1-3: Product: ITE Device(8910)
[ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.

Which is a lot better wrt making the keyboard available for
use in a timely manner.

So now I'm looking into a way to automatically do this. I would
prefer to keep the handling of this out of the kernel, so I looked into
udev, but it seems that the usb_port_device_type device-s registered by
usb_hub_create_port_device() are not visible to udev?

At least I'm not seeing them, in the output of "udevadm info -e"


Note another option would be to set the global old_scheme_first kernel
cmdline parameter on this 2-in-1. That can be done with a simple
dmi_system_id table on which to do this, but adding such a table
seems undesirable.


A third option I guess would be to try and improve the probe time
of the kbd-dock under the new scheme.


Any input on this would be much appreciated.

Regards,

Hans



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-09-05 11:37 How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ? Hans de Goede
@ 2020-09-06  2:22 ` Alan Stern
  2020-09-10 13:58   ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Stern @ 2020-09-06  2:22 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Greg Kroah-Hartman, linux-usb

On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
> Hi All,
> 
> I have been debugging an issue with a 2-in-1 which
> consists of a tablet + a kbd-dock, where the device
> turns into a clamshell when docked into the kbd-dock.
> 
> The kbd dock is connected via pogo-pins. This works
> fine when docked at boot. But there is an enumeration
> issue when hot-docked (and the keyboard looses power
> when the lid is closedm so this also triggers after
> a suspend/resume):
> 
> [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
> [ 3499.041725] usb 1-3: device descriptor read/64, error -71
> [ 3515.215890] usb 1-3: device descriptor read/64, error -110
> [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
> [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 3515.603596] usb 1-3: Product: ITE Device(8910)
> [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
> 
> Note there is about 6 seconds before the keyboard becomes
> usable, which is quite long when trying to unlock the
> laptop after opening the lid.
> 
> If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
> 
> echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
> 
> Then this changes to:
> 
> [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
> [ 4467.878483] usb 1-3: Device not responding to setup address.
> [ 4468.082476] usb 1-3: Device not responding to setup address.
> [ 4468.289990] usb 1-3: device not accepting address 7, error -71
> [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
> [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 4468.662444] usb 1-3: Product: ITE Device(8910)
> [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
> 
> Which is a lot better wrt making the keyboard available for
> use in a timely manner.
> 
> So now I'm looking into a way to automatically do this. I would
> prefer to keep the handling of this out of the kernel, so I looked into
> udev, but it seems that the usb_port_device_type device-s registered by
> usb_hub_create_port_device() are not visible to udev?
> 
> At least I'm not seeing them, in the output of "udevadm info -e"

My impression is that fixing this would be the simplest approach.

Alan Stern

> Note another option would be to set the global old_scheme_first kernel
> cmdline parameter on this 2-in-1. That can be done with a simple
> dmi_system_id table on which to do this, but adding such a table
> seems undesirable.
> 
> 
> A third option I guess would be to try and improve the probe time
> of the kbd-dock under the new scheme.

Have you tried decreasing the initial_descriptor_timeout module 
parameter for usbcore?  That would probably help, but it's kind of a 
sledgehammer.

Alan Stern

> Any input on this would be much appreciated.
> 
> Regards,
> 
> Hans

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-09-06  2:22 ` Alan Stern
@ 2020-09-10 13:58   ` Hans de Goede
  2020-09-10 15:41     ` Alan Stern
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2020-09-10 13:58 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb

Hi,

On 9/6/20 4:22 AM, Alan Stern wrote:
> On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
>> Hi All,
>>
>> I have been debugging an issue with a 2-in-1 which
>> consists of a tablet + a kbd-dock, where the device
>> turns into a clamshell when docked into the kbd-dock.
>>
>> The kbd dock is connected via pogo-pins. This works
>> fine when docked at boot. But there is an enumeration
>> issue when hot-docked (and the keyboard looses power
>> when the lid is closedm so this also triggers after
>> a suspend/resume):
>>
>> [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
>> [ 3499.041725] usb 1-3: device descriptor read/64, error -71
>> [ 3515.215890] usb 1-3: device descriptor read/64, error -110
>> [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
>> [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>> [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>> [ 3515.603596] usb 1-3: Product: ITE Device(8910)
>> [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
>>
>> Note there is about 6 seconds before the keyboard becomes
>> usable, which is quite long when trying to unlock the
>> laptop after opening the lid.
>>
>> If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
>>
>> echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
>>
>> Then this changes to:
>>
>> [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
>> [ 4467.878483] usb 1-3: Device not responding to setup address.
>> [ 4468.082476] usb 1-3: Device not responding to setup address.
>> [ 4468.289990] usb 1-3: device not accepting address 7, error -71
>> [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
>> [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>> [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>> [ 4468.662444] usb 1-3: Product: ITE Device(8910)
>> [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
>>
>> Which is a lot better wrt making the keyboard available for
>> use in a timely manner.
>>
>> So now I'm looking into a way to automatically do this. I would
>> prefer to keep the handling of this out of the kernel, so I looked into
>> udev, but it seems that the usb_port_device_type device-s registered by
>> usb_hub_create_port_device() are not visible to udev?
>>
>> At least I'm not seeing them, in the output of "udevadm info -e"
> 
> My impression is that fixing this would be the simplest approach.

I agree that first trying to fix it is a good idea.

>> Note another option would be to set the global old_scheme_first kernel
>> cmdline parameter on this 2-in-1. That can be done with a simple
>> dmi_system_id table on which to do this, but adding such a table
>> seems undesirable.
>>
>>
>> A third option I guess would be to try and improve the probe time
>> of the kbd-dock under the new scheme.
> 
> Have you tried decreasing the initial_descriptor_timeout module
> parameter for usbcore?  That would probably help, but it's kind of a
> sledgehammer.

So I tried this:

[root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
1000

But it does not really seem to help:

[ 1171.435346] usb 1-3: USB disconnect, device number 2
[ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
[ 1180.551543] usb 1-3: device descriptor read/64, error -71
[ 1184.045548] usb 1-3: device descriptor read/64, error -110
[ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
[ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
[ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1184.438399] usb 1-3: Product: ITE Device(8910)
[ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.

Regards,

Hans


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-09-10 13:58   ` Hans de Goede
@ 2020-09-10 15:41     ` Alan Stern
  2020-09-17 17:27       ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Stern @ 2020-09-10 15:41 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Greg Kroah-Hartman, linux-usb

On Thu, Sep 10, 2020 at 03:58:49PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 9/6/20 4:22 AM, Alan Stern wrote:
> > On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
> > > Hi All,
> > > 
> > > I have been debugging an issue with a 2-in-1 which
> > > consists of a tablet + a kbd-dock, where the device
> > > turns into a clamshell when docked into the kbd-dock.
> > > 
> > > The kbd dock is connected via pogo-pins. This works
> > > fine when docked at boot. But there is an enumeration
> > > issue when hot-docked (and the keyboard looses power
> > > when the lid is closedm so this also triggers after
> > > a suspend/resume):
> > > 
> > > [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
> > > [ 3499.041725] usb 1-3: device descriptor read/64, error -71
> > > [ 3515.215890] usb 1-3: device descriptor read/64, error -110
> > > [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
> > > [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > [ 3515.603596] usb 1-3: Product: ITE Device(8910)
> > > [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > 
> > > Note there is about 6 seconds before the keyboard becomes
> > > usable, which is quite long when trying to unlock the
> > > laptop after opening the lid.
> > > 
> > > If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
> > > 
> > > echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
> > > 
> > > Then this changes to:
> > > 
> > > [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
> > > [ 4467.878483] usb 1-3: Device not responding to setup address.
> > > [ 4468.082476] usb 1-3: Device not responding to setup address.
> > > [ 4468.289990] usb 1-3: device not accepting address 7, error -71
> > > [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
> > > [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > [ 4468.662444] usb 1-3: Product: ITE Device(8910)
> > > [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > 
> > > Which is a lot better wrt making the keyboard available for
> > > use in a timely manner.
> > > 
> > > So now I'm looking into a way to automatically do this. I would
> > > prefer to keep the handling of this out of the kernel, so I looked into
> > > udev, but it seems that the usb_port_device_type device-s registered by
> > > usb_hub_create_port_device() are not visible to udev?
> > > 
> > > At least I'm not seeing them, in the output of "udevadm info -e"
> > 
> > My impression is that fixing this would be the simplest approach.
> 
> I agree that first trying to fix it is a good idea.
> 
> > > Note another option would be to set the global old_scheme_first kernel
> > > cmdline parameter on this 2-in-1. That can be done with a simple
> > > dmi_system_id table on which to do this, but adding such a table
> > > seems undesirable.
> > > 
> > > 
> > > A third option I guess would be to try and improve the probe time
> > > of the kbd-dock under the new scheme.
> > 
> > Have you tried decreasing the initial_descriptor_timeout module
> > parameter for usbcore?  That would probably help, but it's kind of a
> > sledgehammer.
> 
> So I tried this:
> 
> [root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
> 1000
> 
> But it does not really seem to help:
> 
> [ 1171.435346] usb 1-3: USB disconnect, device number 2
> [ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
> [ 1180.551543] usb 1-3: device descriptor read/64, error -71
> [ 1184.045548] usb 1-3: device descriptor read/64, error -110
> [ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
> [ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> [ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 1184.438399] usb 1-3: Product: ITE Device(8910)
> [ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.

That part of hub.c is a real mess.  Coincidentally, I just posted a 
patch to try and fix it up a bit:

	https://marc.info/?l=linux-usb&m=159959185227447&w=2

If you apply that along with module parameter change, does it make any 
difference?

(Or maybe you don't care to pursue this course and would prefer to work 
on the udev approach...)

Alan Stern

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-09-10 15:41     ` Alan Stern
@ 2020-09-17 17:27       ` Hans de Goede
  2020-09-17 20:09         ` Alan Stern
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2020-09-17 17:27 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb

Hi,

On 9/10/20 5:41 PM, Alan Stern wrote:
> On Thu, Sep 10, 2020 at 03:58:49PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 9/6/20 4:22 AM, Alan Stern wrote:
>>> On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
>>>> Hi All,
>>>>
>>>> I have been debugging an issue with a 2-in-1 which
>>>> consists of a tablet + a kbd-dock, where the device
>>>> turns into a clamshell when docked into the kbd-dock.
>>>>
>>>> The kbd dock is connected via pogo-pins. This works
>>>> fine when docked at boot. But there is an enumeration
>>>> issue when hot-docked (and the keyboard looses power
>>>> when the lid is closedm so this also triggers after
>>>> a suspend/resume):
>>>>
>>>> [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
>>>> [ 3499.041725] usb 1-3: device descriptor read/64, error -71
>>>> [ 3515.215890] usb 1-3: device descriptor read/64, error -110
>>>> [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
>>>> [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>> [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>> [ 3515.603596] usb 1-3: Product: ITE Device(8910)
>>>> [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>
>>>> Note there is about 6 seconds before the keyboard becomes
>>>> usable, which is quite long when trying to unlock the
>>>> laptop after opening the lid.
>>>>
>>>> If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
>>>>
>>>> echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
>>>>
>>>> Then this changes to:
>>>>
>>>> [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
>>>> [ 4467.878483] usb 1-3: Device not responding to setup address.
>>>> [ 4468.082476] usb 1-3: Device not responding to setup address.
>>>> [ 4468.289990] usb 1-3: device not accepting address 7, error -71
>>>> [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
>>>> [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>> [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>> [ 4468.662444] usb 1-3: Product: ITE Device(8910)
>>>> [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>
>>>> Which is a lot better wrt making the keyboard available for
>>>> use in a timely manner.
>>>>
>>>> So now I'm looking into a way to automatically do this. I would
>>>> prefer to keep the handling of this out of the kernel, so I looked into
>>>> udev, but it seems that the usb_port_device_type device-s registered by
>>>> usb_hub_create_port_device() are not visible to udev?
>>>>
>>>> At least I'm not seeing them, in the output of "udevadm info -e"
>>>
>>> My impression is that fixing this would be the simplest approach.
>>
>> I agree that first trying to fix it is a good idea.

<snip>

>>> Have you tried decreasing the initial_descriptor_timeout module
>>> parameter for usbcore?  That would probably help, but it's kind of a
>>> sledgehammer.
>>
>> So I tried this:
>>
>> [root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
>> 1000
>>
>> But it does not really seem to help:
>>
>> [ 1171.435346] usb 1-3: USB disconnect, device number 2
>> [ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
>> [ 1180.551543] usb 1-3: device descriptor read/64, error -71
>> [ 1184.045548] usb 1-3: device descriptor read/64, error -110
>> [ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
>> [ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>> [ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>> [ 1184.438399] usb 1-3: Product: ITE Device(8910)
>> [ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.
> 
> That part of hub.c is a real mess.  Coincidentally, I just posted a
> patch to try and fix it up a bit:
> 
> 	https://marc.info/?l=linux-usb&m=159959185227447&w=2

Ok, I've applied the patch and tried again (with initial_descriptor_timeout still set to 1000),
so now the log from the reconnect looks look this:

[ 1157.248439] usb 1-3: new full-speed USB device number 3 using xhci_hcd
[ 1157.254234] usb 1-3: device descriptor read/64, error -71
[ 1157.371442] usb 1-3: new full-speed USB device number 4 using xhci_hcd
[ 1158.377895] usb 1-3: device descriptor read/64, error -110
[ 1158.379646] usb usb1-port3: attempt power cycle
[ 1159.014480] usb 1-3: new full-speed USB device number 5 using xhci_hcd
[ 1159.176112] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
[ 1159.176138] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1159.176156] usb 1-3: Product: ITE Device(8910)
[ 1159.176172] usb 1-3: Manufacturer: ITE Tech. Inc.

Still a bit slower then the old probe method, but much better then the
new probe method with the default initial_descriptor_timeout.

> If you apply that along with module parameter change, does it make any
> difference?
> 
> (Or maybe you don't care to pursue this course and would prefer to work
> on the udev approach...)

No, I would like to see this fixed properly in the kernel, but this is
somewhat low on my prioritry list, esp. during workdays, so that why I'm
a bit slow with responding, sorry.

Regards,

Hans



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-09-17 17:27       ` Hans de Goede
@ 2020-09-17 20:09         ` Alan Stern
  2020-10-02 20:10           ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Alan Stern @ 2020-09-17 20:09 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Greg Kroah-Hartman, linux-usb

On Thu, Sep 17, 2020 at 07:27:03PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 9/10/20 5:41 PM, Alan Stern wrote:
> > On Thu, Sep 10, 2020 at 03:58:49PM +0200, Hans de Goede wrote:
> > > Hi,
> > > 
> > > On 9/6/20 4:22 AM, Alan Stern wrote:
> > > > On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
> > > > > Hi All,
> > > > > 
> > > > > I have been debugging an issue with a 2-in-1 which
> > > > > consists of a tablet + a kbd-dock, where the device
> > > > > turns into a clamshell when docked into the kbd-dock.
> > > > > 
> > > > > The kbd dock is connected via pogo-pins. This works
> > > > > fine when docked at boot. But there is an enumeration
> > > > > issue when hot-docked (and the keyboard looses power
> > > > > when the lid is closedm so this also triggers after
> > > > > a suspend/resume):
> > > > > 
> > > > > [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
> > > > > [ 3499.041725] usb 1-3: device descriptor read/64, error -71
> > > > > [ 3515.215890] usb 1-3: device descriptor read/64, error -110
> > > > > [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
> > > > > [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > > > [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > > > [ 3515.603596] usb 1-3: Product: ITE Device(8910)
> > > > > [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > > > 
> > > > > Note there is about 6 seconds before the keyboard becomes
> > > > > usable, which is quite long when trying to unlock the
> > > > > laptop after opening the lid.
> > > > > 
> > > > > If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
> > > > > 
> > > > > echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
> > > > > 
> > > > > Then this changes to:
> > > > > 
> > > > > [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
> > > > > [ 4467.878483] usb 1-3: Device not responding to setup address.
> > > > > [ 4468.082476] usb 1-3: Device not responding to setup address.
> > > > > [ 4468.289990] usb 1-3: device not accepting address 7, error -71
> > > > > [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
> > > > > [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > > > [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > > > [ 4468.662444] usb 1-3: Product: ITE Device(8910)
> > > > > [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > > > 
> > > > > Which is a lot better wrt making the keyboard available for
> > > > > use in a timely manner.
> > > > > 
> > > > > So now I'm looking into a way to automatically do this. I would
> > > > > prefer to keep the handling of this out of the kernel, so I looked into
> > > > > udev, but it seems that the usb_port_device_type device-s registered by
> > > > > usb_hub_create_port_device() are not visible to udev?
> > > > > 
> > > > > At least I'm not seeing them, in the output of "udevadm info -e"
> > > > 
> > > > My impression is that fixing this would be the simplest approach.
> > > 
> > > I agree that first trying to fix it is a good idea.
> 
> <snip>
> 
> > > > Have you tried decreasing the initial_descriptor_timeout module
> > > > parameter for usbcore?  That would probably help, but it's kind of a
> > > > sledgehammer.
> > > 
> > > So I tried this:
> > > 
> > > [root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
> > > 1000
> > > 
> > > But it does not really seem to help:
> > > 
> > > [ 1171.435346] usb 1-3: USB disconnect, device number 2
> > > [ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
> > > [ 1180.551543] usb 1-3: device descriptor read/64, error -71
> > > [ 1184.045548] usb 1-3: device descriptor read/64, error -110
> > > [ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
> > > [ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > [ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > [ 1184.438399] usb 1-3: Product: ITE Device(8910)
> > > [ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.
> > 
> > That part of hub.c is a real mess.  Coincidentally, I just posted a
> > patch to try and fix it up a bit:
> > 
> > 	https://marc.info/?l=linux-usb&m=159959185227447&w=2
> 
> Ok, I've applied the patch and tried again (with initial_descriptor_timeout still set to 1000),
> so now the log from the reconnect looks look this:
> 
> [ 1157.248439] usb 1-3: new full-speed USB device number 3 using xhci_hcd
> [ 1157.254234] usb 1-3: device descriptor read/64, error -71
> [ 1157.371442] usb 1-3: new full-speed USB device number 4 using xhci_hcd
> [ 1158.377895] usb 1-3: device descriptor read/64, error -110
> [ 1158.379646] usb usb1-port3: attempt power cycle
> [ 1159.014480] usb 1-3: new full-speed USB device number 5 using xhci_hcd
> [ 1159.176112] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> [ 1159.176138] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [ 1159.176156] usb 1-3: Product: ITE Device(8910)
> [ 1159.176172] usb 1-3: Manufacturer: ITE Tech. Inc.
> 
> Still a bit slower then the old probe method, but much better then the
> new probe method with the default initial_descriptor_timeout.

Yeah, okay, it's good to see that the patch helps.  But I'm doubtful 
that the change it makes will become part of the standard (i.e., not 
for embedded systems) kernel.

I still think the udev approach will be best.  That will require adding 
various *_uevent_* calls in usb_hub_create_port_device, and adding a 
.uevent member to usb_port_device_type.

> > If you apply that along with module parameter change, does it make any
> > difference?
> > 
> > (Or maybe you don't care to pursue this course and would prefer to work
> > on the udev approach...)
> 
> No, I would like to see this fixed properly in the kernel, but this is
> somewhat low on my prioritry list, esp. during workdays, so that why I'm
> a bit slow with responding, sorry.

No problem.

Alan Stern

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-09-17 20:09         ` Alan Stern
@ 2020-10-02 20:10           ` Hans de Goede
  2020-10-02 20:12             ` Hans de Goede
  2020-10-03  7:52             ` Greg Kroah-Hartman
  0 siblings, 2 replies; 11+ messages in thread
From: Hans de Goede @ 2020-10-02 20:10 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb

Hi,

On 9/17/20 10:09 PM, Alan Stern wrote:
> On Thu, Sep 17, 2020 at 07:27:03PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 9/10/20 5:41 PM, Alan Stern wrote:
>>> On Thu, Sep 10, 2020 at 03:58:49PM +0200, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 9/6/20 4:22 AM, Alan Stern wrote:
>>>>> On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
>>>>>> Hi All,
>>>>>>
>>>>>> I have been debugging an issue with a 2-in-1 which
>>>>>> consists of a tablet + a kbd-dock, where the device
>>>>>> turns into a clamshell when docked into the kbd-dock.
>>>>>>
>>>>>> The kbd dock is connected via pogo-pins. This works
>>>>>> fine when docked at boot. But there is an enumeration
>>>>>> issue when hot-docked (and the keyboard looses power
>>>>>> when the lid is closedm so this also triggers after
>>>>>> a suspend/resume):
>>>>>>
>>>>>> [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
>>>>>> [ 3499.041725] usb 1-3: device descriptor read/64, error -71
>>>>>> [ 3515.215890] usb 1-3: device descriptor read/64, error -110
>>>>>> [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
>>>>>> [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>>>> [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>>>> [ 3515.603596] usb 1-3: Product: ITE Device(8910)
>>>>>> [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>>>
>>>>>> Note there is about 6 seconds before the keyboard becomes
>>>>>> usable, which is quite long when trying to unlock the
>>>>>> laptop after opening the lid.
>>>>>>
>>>>>> If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
>>>>>>
>>>>>> echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
>>>>>>
>>>>>> Then this changes to:
>>>>>>
>>>>>> [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
>>>>>> [ 4467.878483] usb 1-3: Device not responding to setup address.
>>>>>> [ 4468.082476] usb 1-3: Device not responding to setup address.
>>>>>> [ 4468.289990] usb 1-3: device not accepting address 7, error -71
>>>>>> [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
>>>>>> [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>>>> [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>>>> [ 4468.662444] usb 1-3: Product: ITE Device(8910)
>>>>>> [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>>>
>>>>>> Which is a lot better wrt making the keyboard available for
>>>>>> use in a timely manner.
>>>>>>
>>>>>> So now I'm looking into a way to automatically do this. I would
>>>>>> prefer to keep the handling of this out of the kernel, so I looked into
>>>>>> udev, but it seems that the usb_port_device_type device-s registered by
>>>>>> usb_hub_create_port_device() are not visible to udev?
>>>>>>
>>>>>> At least I'm not seeing them, in the output of "udevadm info -e"
>>>>>
>>>>> My impression is that fixing this would be the simplest approach.
>>>>
>>>> I agree that first trying to fix it is a good idea.
>>
>> <snip>
>>
>>>>> Have you tried decreasing the initial_descriptor_timeout module
>>>>> parameter for usbcore?  That would probably help, but it's kind of a
>>>>> sledgehammer.
>>>>
>>>> So I tried this:
>>>>
>>>> [root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
>>>> 1000
>>>>
>>>> But it does not really seem to help:
>>>>
>>>> [ 1171.435346] usb 1-3: USB disconnect, device number 2
>>>> [ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
>>>> [ 1180.551543] usb 1-3: device descriptor read/64, error -71
>>>> [ 1184.045548] usb 1-3: device descriptor read/64, error -110
>>>> [ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
>>>> [ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>> [ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>> [ 1184.438399] usb 1-3: Product: ITE Device(8910)
>>>> [ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>
>>> That part of hub.c is a real mess.  Coincidentally, I just posted a
>>> patch to try and fix it up a bit:
>>>
>>> 	https://marc.info/?l=linux-usb&m=159959185227447&w=2
>>
>> Ok, I've applied the patch and tried again (with initial_descriptor_timeout still set to 1000),
>> so now the log from the reconnect looks look this:
>>
>> [ 1157.248439] usb 1-3: new full-speed USB device number 3 using xhci_hcd
>> [ 1157.254234] usb 1-3: device descriptor read/64, error -71
>> [ 1157.371442] usb 1-3: new full-speed USB device number 4 using xhci_hcd
>> [ 1158.377895] usb 1-3: device descriptor read/64, error -110
>> [ 1158.379646] usb usb1-port3: attempt power cycle
>> [ 1159.014480] usb 1-3: new full-speed USB device number 5 using xhci_hcd
>> [ 1159.176112] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>> [ 1159.176138] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>> [ 1159.176156] usb 1-3: Product: ITE Device(8910)
>> [ 1159.176172] usb 1-3: Manufacturer: ITE Tech. Inc.
>>
>> Still a bit slower then the old probe method, but much better then the
>> new probe method with the default initial_descriptor_timeout.
> 
> Yeah, okay, it's good to see that the patch helps.  But I'm doubtful
> that the change it makes will become part of the standard (i.e., not
> for embedded systems) kernel.
> 
> I still think the udev approach will be best.  That will require adding
> various *_uevent_* calls in usb_hub_create_port_device, and adding a
> .uevent member to usb_port_device_type.

So I tried this and it does not work, the problem is that
dev_uevent_filter() from drivers/base/core.c
filters out uevents for anything which is not either a device
on a bus or a class device:

static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
{
         struct kobj_type *ktype = get_ktype(kobj);

         if (ktype == &device_ktype) {
                 struct device *dev = kobj_to_dev(kobj);
                 if (dev->bus)
                         return 1;
                 if (dev->class)
                         return 1;
         }
         return 0;
}

(as mentioned this is a low priority thing for me, so hence
  the long time between replies)

Regards,

Hans


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-10-02 20:10           ` Hans de Goede
@ 2020-10-02 20:12             ` Hans de Goede
  2020-10-03  1:26               ` Alan Stern
  2020-10-03  7:52             ` Greg Kroah-Hartman
  1 sibling, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2020-10-02 20:12 UTC (permalink / raw)
  To: Alan Stern; +Cc: Greg Kroah-Hartman, linux-usb

Hi,

On 10/2/20 10:10 PM, Hans de Goede wrote:

<snip>

>>> Still a bit slower then the old probe method, but much better then the
>>> new probe method with the default initial_descriptor_timeout.
>>
>> Yeah, okay, it's good to see that the patch helps.  But I'm doubtful
>> that the change it makes will become part of the standard (i.e., not
>> for embedded systems) kernel.
>>
>> I still think the udev approach will be best.  That will require adding
>> various *_uevent_* calls in usb_hub_create_port_device, and adding a
>> .uevent member to usb_port_device_type.
> 
> So I tried this and it does not work, the problem is that
> dev_uevent_filter() from drivers/base/core.c
> filters out uevents for anything which is not either a device
> on a bus or a class device:
> 
> static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
> {
>          struct kobj_type *ktype = get_ktype(kobj);
> 
>          if (ktype == &device_ktype) {
>                  struct device *dev = kobj_to_dev(kobj);
>                  if (dev->bus)
>                          return 1;
>                  if (dev->class)
>                          return 1;
>          }
>          return 0;
> }

p.s.

I guess that this means that it is best to just learn to live
with the somewhat long enumeration time with the new scheme in
this somewhat specific case, that is fine with me.

Regards,

Hans


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-10-02 20:12             ` Hans de Goede
@ 2020-10-03  1:26               ` Alan Stern
  0 siblings, 0 replies; 11+ messages in thread
From: Alan Stern @ 2020-10-03  1:26 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Greg Kroah-Hartman, linux-usb

On Fri, Oct 02, 2020 at 10:12:33PM +0200, Hans de Goede wrote:
> I guess that this means that it is best to just learn to live
> with the somewhat long enumeration time with the new scheme in
> this somewhat specific case, that is fine with me.

There may be a way around it.  For instance, a shell script (invoked by 
udev when the hub is registered) that checks in sysfs to see whether the 
hub is of the appropriate kind, and if it is, sets the OLD_SCHEME quirk 
for the right port.

Alan Stern

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-10-02 20:10           ` Hans de Goede
  2020-10-02 20:12             ` Hans de Goede
@ 2020-10-03  7:52             ` Greg Kroah-Hartman
  2020-10-03 11:09               ` Hans de Goede
  1 sibling, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2020-10-03  7:52 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Alan Stern, linux-usb

On Fri, Oct 02, 2020 at 10:10:52PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 9/17/20 10:09 PM, Alan Stern wrote:
> > On Thu, Sep 17, 2020 at 07:27:03PM +0200, Hans de Goede wrote:
> > > Hi,
> > > 
> > > On 9/10/20 5:41 PM, Alan Stern wrote:
> > > > On Thu, Sep 10, 2020 at 03:58:49PM +0200, Hans de Goede wrote:
> > > > > Hi,
> > > > > 
> > > > > On 9/6/20 4:22 AM, Alan Stern wrote:
> > > > > > On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
> > > > > > > Hi All,
> > > > > > > 
> > > > > > > I have been debugging an issue with a 2-in-1 which
> > > > > > > consists of a tablet + a kbd-dock, where the device
> > > > > > > turns into a clamshell when docked into the kbd-dock.
> > > > > > > 
> > > > > > > The kbd dock is connected via pogo-pins. This works
> > > > > > > fine when docked at boot. But there is an enumeration
> > > > > > > issue when hot-docked (and the keyboard looses power
> > > > > > > when the lid is closedm so this also triggers after
> > > > > > > a suspend/resume):
> > > > > > > 
> > > > > > > [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
> > > > > > > [ 3499.041725] usb 1-3: device descriptor read/64, error -71
> > > > > > > [ 3515.215890] usb 1-3: device descriptor read/64, error -110
> > > > > > > [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
> > > > > > > [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > > > > > [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > > > > > [ 3515.603596] usb 1-3: Product: ITE Device(8910)
> > > > > > > [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > > > > > 
> > > > > > > Note there is about 6 seconds before the keyboard becomes
> > > > > > > usable, which is quite long when trying to unlock the
> > > > > > > laptop after opening the lid.
> > > > > > > 
> > > > > > > If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
> > > > > > > 
> > > > > > > echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
> > > > > > > 
> > > > > > > Then this changes to:
> > > > > > > 
> > > > > > > [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
> > > > > > > [ 4467.878483] usb 1-3: Device not responding to setup address.
> > > > > > > [ 4468.082476] usb 1-3: Device not responding to setup address.
> > > > > > > [ 4468.289990] usb 1-3: device not accepting address 7, error -71
> > > > > > > [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
> > > > > > > [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > > > > > [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > > > > > [ 4468.662444] usb 1-3: Product: ITE Device(8910)
> > > > > > > [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > > > > > 
> > > > > > > Which is a lot better wrt making the keyboard available for
> > > > > > > use in a timely manner.
> > > > > > > 
> > > > > > > So now I'm looking into a way to automatically do this. I would
> > > > > > > prefer to keep the handling of this out of the kernel, so I looked into
> > > > > > > udev, but it seems that the usb_port_device_type device-s registered by
> > > > > > > usb_hub_create_port_device() are not visible to udev?
> > > > > > > 
> > > > > > > At least I'm not seeing them, in the output of "udevadm info -e"
> > > > > > 
> > > > > > My impression is that fixing this would be the simplest approach.
> > > > > 
> > > > > I agree that first trying to fix it is a good idea.
> > > 
> > > <snip>
> > > 
> > > > > > Have you tried decreasing the initial_descriptor_timeout module
> > > > > > parameter for usbcore?  That would probably help, but it's kind of a
> > > > > > sledgehammer.
> > > > > 
> > > > > So I tried this:
> > > > > 
> > > > > [root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
> > > > > 1000
> > > > > 
> > > > > But it does not really seem to help:
> > > > > 
> > > > > [ 1171.435346] usb 1-3: USB disconnect, device number 2
> > > > > [ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
> > > > > [ 1180.551543] usb 1-3: device descriptor read/64, error -71
> > > > > [ 1184.045548] usb 1-3: device descriptor read/64, error -110
> > > > > [ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
> > > > > [ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > > > [ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > > > [ 1184.438399] usb 1-3: Product: ITE Device(8910)
> > > > > [ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > > 
> > > > That part of hub.c is a real mess.  Coincidentally, I just posted a
> > > > patch to try and fix it up a bit:
> > > > 
> > > > 	https://marc.info/?l=linux-usb&m=159959185227447&w=2
> > > 
> > > Ok, I've applied the patch and tried again (with initial_descriptor_timeout still set to 1000),
> > > so now the log from the reconnect looks look this:
> > > 
> > > [ 1157.248439] usb 1-3: new full-speed USB device number 3 using xhci_hcd
> > > [ 1157.254234] usb 1-3: device descriptor read/64, error -71
> > > [ 1157.371442] usb 1-3: new full-speed USB device number 4 using xhci_hcd
> > > [ 1158.377895] usb 1-3: device descriptor read/64, error -110
> > > [ 1158.379646] usb usb1-port3: attempt power cycle
> > > [ 1159.014480] usb 1-3: new full-speed USB device number 5 using xhci_hcd
> > > [ 1159.176112] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
> > > [ 1159.176138] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> > > [ 1159.176156] usb 1-3: Product: ITE Device(8910)
> > > [ 1159.176172] usb 1-3: Manufacturer: ITE Tech. Inc.
> > > 
> > > Still a bit slower then the old probe method, but much better then the
> > > new probe method with the default initial_descriptor_timeout.
> > 
> > Yeah, okay, it's good to see that the patch helps.  But I'm doubtful
> > that the change it makes will become part of the standard (i.e., not
> > for embedded systems) kernel.
> > 
> > I still think the udev approach will be best.  That will require adding
> > various *_uevent_* calls in usb_hub_create_port_device, and adding a
> > .uevent member to usb_port_device_type.
> 
> So I tried this and it does not work, the problem is that
> dev_uevent_filter() from drivers/base/core.c
> filters out uevents for anything which is not either a device
> on a bus or a class device:
> 
> static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
> {
>         struct kobj_type *ktype = get_ktype(kobj);
> 
>         if (ktype == &device_ktype) {
>                 struct device *dev = kobj_to_dev(kobj);
>                 if (dev->bus)
>                         return 1;
>                 if (dev->class)
>                         return 1;
>         }
>         return 0;
> }
> 
> (as mentioned this is a low priority thing for me, so hence
>  the long time between replies)

I'm kind of lost in this thread, but what part of the USB device tree in
sysfs is getting "caught" by this filter and does not belong to a bus or
class?  We can always fix that up if needed.

This is the second time this week I have seen this happen in different
subsystems where people wanted to do things in userspace for devices
that were caught by this.  Odd coincidence :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ?
  2020-10-03  7:52             ` Greg Kroah-Hartman
@ 2020-10-03 11:09               ` Hans de Goede
  0 siblings, 0 replies; 11+ messages in thread
From: Hans de Goede @ 2020-10-03 11:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alan Stern, linux-usb

Hi Greg,

On 10/3/20 9:52 AM, Greg Kroah-Hartman wrote:
> On Fri, Oct 02, 2020 at 10:10:52PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 9/17/20 10:09 PM, Alan Stern wrote:
>>> On Thu, Sep 17, 2020 at 07:27:03PM +0200, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 9/10/20 5:41 PM, Alan Stern wrote:
>>>>> On Thu, Sep 10, 2020 at 03:58:49PM +0200, Hans de Goede wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On 9/6/20 4:22 AM, Alan Stern wrote:
>>>>>>> On Sat, Sep 05, 2020 at 01:37:38PM +0200, Hans de Goede wrote:
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> I have been debugging an issue with a 2-in-1 which
>>>>>>>> consists of a tablet + a kbd-dock, where the device
>>>>>>>> turns into a clamshell when docked into the kbd-dock.
>>>>>>>>
>>>>>>>> The kbd dock is connected via pogo-pins. This works
>>>>>>>> fine when docked at boot. But there is an enumeration
>>>>>>>> issue when hot-docked (and the keyboard looses power
>>>>>>>> when the lid is closedm so this also triggers after
>>>>>>>> a suspend/resume):
>>>>>>>>
>>>>>>>> [ 3498.924190] usb 1-3: new full-speed USB device number 5 using xhci_hcd
>>>>>>>> [ 3499.041725] usb 1-3: device descriptor read/64, error -71
>>>>>>>> [ 3515.215890] usb 1-3: device descriptor read/64, error -110
>>>>>>>> [ 3515.440369] usb 1-3: new full-speed USB device number 6 using xhci_hcd
>>>>>>>> [ 3515.603544] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>>>>>> [ 3515.603574] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>>>>>> [ 3515.603596] usb 1-3: Product: ITE Device(8910)
>>>>>>>> [ 3515.603614] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>>>>>
>>>>>>>> Note there is about 6 seconds before the keyboard becomes
>>>>>>>> usable, which is quite long when trying to unlock the
>>>>>>>> laptop after opening the lid.
>>>>>>>>
>>>>>>>> If I set the USB_PORT_QUIRK_OLD_SCHEME on the port used by the kbd-dock:
>>>>>>>>
>>>>>>>> echo 1 >  /sys/devices/pci0000\:00/0000\:00\:14.0/usb1/1-0\:1.0/usb1-port3/quirks
>>>>>>>>
>>>>>>>> Then this changes to:
>>>>>>>>
>>>>>>>> [ 4467.875008] usb 1-3: new full-speed USB device number 7 using xhci_hcd
>>>>>>>> [ 4467.878483] usb 1-3: Device not responding to setup address.
>>>>>>>> [ 4468.082476] usb 1-3: Device not responding to setup address.
>>>>>>>> [ 4468.289990] usb 1-3: device not accepting address 7, error -71
>>>>>>>> [ 4468.614928] usb 1-3: new full-speed USB device number 8 using xhci_hcd
>>>>>>>> [ 4468.662392] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>>>>>> [ 4468.662423] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>>>>>> [ 4468.662444] usb 1-3: Product: ITE Device(8910)
>>>>>>>> [ 4468.662461] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>>>>>
>>>>>>>> Which is a lot better wrt making the keyboard available for
>>>>>>>> use in a timely manner.
>>>>>>>>
>>>>>>>> So now I'm looking into a way to automatically do this. I would
>>>>>>>> prefer to keep the handling of this out of the kernel, so I looked into
>>>>>>>> udev, but it seems that the usb_port_device_type device-s registered by
>>>>>>>> usb_hub_create_port_device() are not visible to udev?
>>>>>>>>
>>>>>>>> At least I'm not seeing them, in the output of "udevadm info -e"
>>>>>>>
>>>>>>> My impression is that fixing this would be the simplest approach.
>>>>>>
>>>>>> I agree that first trying to fix it is a good idea.
>>>>
>>>> <snip>
>>>>
>>>>>>> Have you tried decreasing the initial_descriptor_timeout module
>>>>>>> parameter for usbcore?  That would probably help, but it's kind of a
>>>>>>> sledgehammer.
>>>>>>
>>>>>> So I tried this:
>>>>>>
>>>>>> [root@localhost ~]# cat /sys/module/usbcore/parameters/initial_descriptor_timeout
>>>>>> 1000
>>>>>>
>>>>>> But it does not really seem to help:
>>>>>>
>>>>>> [ 1171.435346] usb 1-3: USB disconnect, device number 2
>>>>>> [ 1180.430958] usb 1-3: new full-speed USB device number 3 using xhci_hcd
>>>>>> [ 1180.551543] usb 1-3: device descriptor read/64, error -71
>>>>>> [ 1184.045548] usb 1-3: device descriptor read/64, error -110
>>>>>> [ 1184.270924] usb 1-3: new full-speed USB device number 4 using xhci_hcd
>>>>>> [ 1184.438336] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>>>> [ 1184.438371] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>>>> [ 1184.438399] usb 1-3: Product: ITE Device(8910)
>>>>>> [ 1184.438425] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>>
>>>>> That part of hub.c is a real mess.  Coincidentally, I just posted a
>>>>> patch to try and fix it up a bit:
>>>>>
>>>>> 	https://marc.info/?l=linux-usb&m=159959185227447&w=2
>>>>
>>>> Ok, I've applied the patch and tried again (with initial_descriptor_timeout still set to 1000),
>>>> so now the log from the reconnect looks look this:
>>>>
>>>> [ 1157.248439] usb 1-3: new full-speed USB device number 3 using xhci_hcd
>>>> [ 1157.254234] usb 1-3: device descriptor read/64, error -71
>>>> [ 1157.371442] usb 1-3: new full-speed USB device number 4 using xhci_hcd
>>>> [ 1158.377895] usb 1-3: device descriptor read/64, error -110
>>>> [ 1158.379646] usb usb1-port3: attempt power cycle
>>>> [ 1159.014480] usb 1-3: new full-speed USB device number 5 using xhci_hcd
>>>> [ 1159.176112] usb 1-3: New USB device found, idVendor=06cb, idProduct=73f5, bcdDevice= 0.02
>>>> [ 1159.176138] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
>>>> [ 1159.176156] usb 1-3: Product: ITE Device(8910)
>>>> [ 1159.176172] usb 1-3: Manufacturer: ITE Tech. Inc.
>>>>
>>>> Still a bit slower then the old probe method, but much better then the
>>>> new probe method with the default initial_descriptor_timeout.
>>>
>>> Yeah, okay, it's good to see that the patch helps.  But I'm doubtful
>>> that the change it makes will become part of the standard (i.e., not
>>> for embedded systems) kernel.
>>>
>>> I still think the udev approach will be best.  That will require adding
>>> various *_uevent_* calls in usb_hub_create_port_device, and adding a
>>> .uevent member to usb_port_device_type.
>>
>> So I tried this and it does not work, the problem is that
>> dev_uevent_filter() from drivers/base/core.c
>> filters out uevents for anything which is not either a device
>> on a bus or a class device:
>>
>> static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
>> {
>>          struct kobj_type *ktype = get_ktype(kobj);
>>
>>          if (ktype == &device_ktype) {
>>                  struct device *dev = kobj_to_dev(kobj);
>>                  if (dev->bus)
>>                          return 1;
>>                  if (dev->class)
>>                          return 1;
>>          }
>>          return 0;
>> }
>>
>> (as mentioned this is a low priority thing for me, so hence
>>   the long time between replies)
> 
> I'm kind of lost in this thread, but what part of the USB device tree in
> sysfs is getting "caught" by this filter and does not belong to a bus or
> class?  We can always fix that up if needed.

So usb_ports, can have per port quirks, e.g.:

/sys/bus/usb/devices/1-0\:1.0/usb1-port1/quirks

On a device I have I would like to set such a quirk from a
udev rule (see below for why), but the filter causes no
udev events to be generated for the port.  So in essence it
is not possible to actually use the per-port-quirks in
a sensible (e.g. through udev hwdb) manner. I can put
something in rc.local for this, but I was looking for an
upstreamable solution.

So I guess that maybe we should consider generating (not filtering)
udev events for usb-port devices. The code to do this could be
as simple as a flag in the device struct which the filter checks.

But this will cause a whole bunch of extra udev events on all
machines for something which is somewhat of a corner case...
Which brings me to why I was looking into this:

One of these quirks is to use the old-probe-scheme instead of the
new one.  On a 2-in-1 with a detachable USB keyboard (*) I noticed
that probing the kbd with the new probe scheme takes 7 seconds,
where as the old scheme does it in 1.5.

Since the usb-port gets turned off when suspending by closing the
LID, the 7s probe is pretty annoying, since you need to wait a
long time before you can type your password to unlock after the
suspend.  And I've also had several times where I attached the
kbd more then once, simply because I ran out of patience and
thought the connection (pogo pins) was not aligned properly.

> This is the second time this week I have seen this happen in different
> subsystems where people wanted to do things in userspace for devices
> that were caught by this.  Odd coincidence :)

Odd coincidence indeed.

Regards,

Hans


*) An Acer One 10 S1003


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-10-03 11:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05 11:37 How to set USB_PORT_QUIRK_OLD_SCHEME on an usb-port ? Hans de Goede
2020-09-06  2:22 ` Alan Stern
2020-09-10 13:58   ` Hans de Goede
2020-09-10 15:41     ` Alan Stern
2020-09-17 17:27       ` Hans de Goede
2020-09-17 20:09         ` Alan Stern
2020-10-02 20:10           ` Hans de Goede
2020-10-02 20:12             ` Hans de Goede
2020-10-03  1:26               ` Alan Stern
2020-10-03  7:52             ` Greg Kroah-Hartman
2020-10-03 11:09               ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.