Linux USB
 help / color / mirror / Atom feed
From: Michal Pecio <michal.pecio@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Nikhil Solanke <nikhilsolanke5@gmail.com>,
	linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
	mathias.nyman@linux.intel.com, sakari.ailus@linux.intel.com,
	katieeliu@tencent.com, johannes.bruederl@gmail.com,
	kees@kernel.org, dengjie03@kylinos.cn, limiao@kylinos.cn,
	wse@tuxedocomputers.com, dev@a1rm4x.com, vahnenko2003@gmail.com,
	cs@tuxedo.de, lijiayi@kylinos.cn, oneukum@suse.com,
	bence98@sch.bme.hu, eeodqql09@gmail.com
Subject: Re: USB: Request for guidance investigating configuration descriptor enumeration failure
Date: Mon, 8 Jun 2026 09:17:35 +0200	[thread overview]
Message-ID: <20260608091735.3a325cc7.michal.pecio@gmail.com> (raw)
In-Reply-To: <80bad7e6-239e-4b7c-a175-0ba170b7c883@rowland.harvard.edu>

On Sun, 7 Jun 2026 21:34:37 -0400, Alan Stern wrote:
> On Sun, Jun 07, 2026 at 11:25:35PM +0200, Michal Pecio wrote:
> > Ipad is interesting because the single Device request must be a
> > high-speed optimization, or they hacked their xHC to ignore short
> > packets and keep reissuing IN tokens until the URB is filled.  
> 
> I would guess it's the former.  The only real reason for having a
> short request first is because for full-speed connections, the host
> doesn't know what the ep0 maxpacket length is until it sees the
> descriptor.

I wouldn't 100% rule out Apple being nuts enough to do the latter too
to squeeze out the last few ms of enumeration latency. But of course
it's impossible on any standard HC and only of academic interest.

I found that OSX 14 for Intel Macs in QEMU does an initial 8 byte
request at FS but omits it at HS and SS. And it uses the 9/wTotalLength
config sequence seen in iPad.

So they migrated away from 8/wTotalLength and it's interesting that
they chose to ape Linux rather than Windows. Is Android the new
Microsoft? The Windows scheme seems more efficient, its only drawback
being risk of buggy devices.

> > Linux has been doing the initial 8 or 64 byte read at LS and HS
> > since forever and I found no explanation besides nobody daring to
> > touch it.  
> 
> That's the explanation.  Originally Linux always did the 8-byte read.
> But some devices didn't like it, and we saw that Windows used a
> 64-byte read.  So we copied the Windows behavior, with a fallback to
> the original behavior (which is what the spec recommends) when
> needed.  Even for LS and HS, because that's what Windows does.
> 
> > Though I wonder if it wouldn't make sense to skip this at SS,
> > because Windows does (in my QEMU tests) and very likely Apple too.  
> 
> I'd be fine with that.  OTOH, if it's not broken, you don't need to
> fix it.

Actually it's partly broken - xhci-hcd completely ignores udev->ep0.desc
of SuperSpeed devices and uses 512 as per spec. So the request only
exists for its side effects, if any, and it's somewhat unique to Linux.

And of coures there are totally broken cases: devices which disconnect
when queried for BOS by Linux but don't disconnect on Windows (which
likely queries them too). And I have one device which returns broken
descriptors depending on how fast I insert the plug (seriously) and of
course it doesn't have this problem in Windows.

The former does look like something that descriptor request size and
ordering might fix, but I don't have that HW.

For the latter, I tried without high expectations nor any success yet:

e079d3125493 usb: core: Issue Set Isochronous Delay later
49475308741e usb: core: Fetch the Configuration Descriptor with 255 length
7606f13ab0d1 usb: core: Don't fetch SuperSpeed Device Descriptor twice

Currently I get a usb_choose_configuration() crash after moving the
usb_enumerate_device() call from usb_new_device() to hub_port_init()
to reorder it against BOS. Will need to investigate later.

Regards,
Michal

  reply	other threads:[~2026-06-08  7:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 21:22 USB: Request for guidance investigating configuration descriptor enumeration failure Nikhil Solanke
2026-05-30  1:58 ` Alan Stern
2026-05-30  6:57   ` Nikhil Solanke
2026-05-30 14:48     ` Alan Stern
2026-05-30 16:48       ` Nikhil Solanke
2026-05-30 20:26         ` Alan Stern
2026-05-30 20:47           ` Nikhil Solanke
2026-05-31  1:44             ` Alan Stern
2026-05-31  7:49               ` Nikhil Solanke
2026-05-31 14:03                 ` Alan Stern
2026-05-31  8:16 ` Michal Pecio
2026-05-31 10:11   ` Nikhil Solanke
2026-05-31 10:38     ` Michal Pecio
2026-05-31 11:20       ` Nikhil Solanke
2026-05-31 14:12       ` Alan Stern
2026-06-01  6:49         ` Michal Pecio
2026-06-01  9:01           ` Nikhil Solanke
2026-06-02 17:30             ` Michal Pecio
2026-06-04  2:02               ` Alan Stern
2026-06-04 10:53                 ` Michal Pecio
2026-06-07  2:17                   ` Alan Stern
2026-06-07 20:02                     ` Nikhil Solanke
2026-06-08  1:24                       ` Alan Stern
2026-06-07 21:25                     ` Michal Pecio
2026-06-08  1:34                       ` Alan Stern
2026-06-08  7:17                         ` Michal Pecio [this message]
2026-06-01 13:02           ` Alan Stern

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=20260608091735.3a325cc7.michal.pecio@gmail.com \
    --to=michal.pecio@gmail.com \
    --cc=bence98@sch.bme.hu \
    --cc=cs@tuxedo.de \
    --cc=dengjie03@kylinos.cn \
    --cc=dev@a1rm4x.com \
    --cc=eeodqql09@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes.bruederl@gmail.com \
    --cc=katieeliu@tencent.com \
    --cc=kees@kernel.org \
    --cc=lijiayi@kylinos.cn \
    --cc=limiao@kylinos.cn \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=nikhilsolanke5@gmail.com \
    --cc=oneukum@suse.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=vahnenko2003@gmail.com \
    --cc=wse@tuxedocomputers.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