Re: [PATCH 0/4] usb: usbtmc: fix undersized high-speed bulk packets on xHCI
From: Michal Pecio
Date: Tue Oct 20 2026 - 12:51:53 EST
On Tue, 20 Oct 2026 16:33:37 +0200, Nicolai Buchwitz wrote:
> The Siglent SDM4065A-SC, Rigol DP800 and Rigol DS1000Z (and probably
> others) advertise 64-byte bulk endpoints at high speed. USB 2.0 only
> allows 512, which xHCI correctly implements. Unfortunately this breaks
> usbtmc on these devices. Reads stop after the first packet, and longer
> writes also fail or hang the OUT endpoint until a USB reset:
>
> usb 1-1.3: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 64
> usbtmc 1-1.3:1.0: Device sent too small first packet: 8 < 12
> usbtmc 1-1.3:1.0: Unable to send data, error -110
Fascinating.
But SDM4065A is apparently pretty modern (2025) gear marketed for
"automatic production lines", so it's odd that it has such issues.
Has anyone looked if the same out-of-spec descriptor shows up on
Windows or (don't laught at my optimism) consulted vendor support?
Maybe Windows xHCI driver tries to enable out-of-spec maxpacket?
We could do that too, though IIRC not all controllers are happy,
so a SW workaround may be unavoidable.
And xHCI doesn't support URB_SHORT_NOT_OK, for the record.
> We ran into this in our factory once we switched some test PCs from
> dwc2 based hardware to xHCI based ones. dwc2 uses the advertised 64
> bytes, so the devices worked fine before.
>
> This series adds a quirk table to usbtmc and moves one packet per URB
> for the devices in it. The DP800 also wants a ZLP after a write that
> ends on a packet boundary. Only read() and write() change, the ioctls
> behave as before. More devices can go into the table as they turn up.
>
> The Rigols still have one issue I can't work around. They split
> replies over 500 bytes into several transfers, and a follow-on
> transfer that ends exactly on a packet boundary never arrives. Raw
> libusb shows the same, so I guess it's another firmware bug. Should
> be fine for most use cases though.
What exactly is the sequence of URBs you see vs would want to see?
>
> Tested on a Raspberry Pi CM4S (BCM2711 xHCI) and a CM5 (RP1 xHCI).
>
> Signed-off-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>
> ---
> Nicolai Buchwitz (4):
> usb: usbtmc: handle undersized high-speed bulk IN packets
> usb: usbtmc: handle undersized high-speed bulk OUT packets
> usb: usbtmc: add Rigol DP800 and DS1000Z to the packet I/O quirk table
> usb: usbtmc: send a ZLP after a full last packet in packet I/O mode
>
> drivers/usb/class/usbtmc.c | 87 ++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 76 insertions(+), 11 deletions(-)
> ---
> base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
> change-id: 20261020-fix-usbtmc-short-packets-1c4e233ae407
>
> Best regards,
> --
> Nicolai Buchwitz <nb@xxxxxxxxxxx>
>