Hi Salvatore,
answering the question from your Message #42: yes, 70b4db7d2581 on top of
6.12.115-2 fixes it. Confirmed on real hardware, and on a device from a
different vendor (Topping, not MOTU).
Device: Topping E2x2, USB ID 152a:8752 (XMOS/Thesycon UAC2)
Playback endpoint 0x01 (OUT, ASYNC), implicit feedback via EP 0x81
How it was built
I rebuilt only sound/usb/snd-usb-audio.ko, against the Debian 6.12.115-2
configuration and the Module.symvers shipped in
linux-headers-6.12.115+deb13.1-amd64, using gcc-14, the same compiler
Debian used for this kernel. The resulting module has an identical
vermagic:
6.12.115+deb13.1-amd64 SMP preempt mod_unload modversions
Baseline sanity check: built *without* the patch, prepare_playback_urb()
comes out at exactly the same size as in the shipped module (1653 bytes),
so the build environment reproduces Debian's build. With the patch applied
it is 1646 bytes, and the disassembly contains:
imul %r10d,%edx
cmp %edx,0x8(%r12)
i.e. (frames + counts) * stride compared against ctx->buffer_size.
A correction to my previous message
I wrote that ctx->buffer_size might not exist in 6.12.y. That was wrong.
It does exist - struct snd_urb_ctx in sound/usb/card.h has:
unsigned int buffer_size; /* size of data buffer, if data URB */
and it is assigned unconditionally in data_ep_set_params() in
sound/usb/endpoint.c:
u->buffer_size = maxsize * u->packets;
That line is outside the "if (usb_pipein(ep->pipe) || ep->implicit_fb_sync)"
branch, so the value is valid for capture, implicit-feedback playback and
plain playback alike. Consequently 70b4db7d2581 applies to 6.12.y as-is.
No substitute such as subs->buffer_bytes is needed.
Before / after
Before (6.12.115-2, stock module), while playing:
state: RUNNING
delay : 4608 (constant)
hw_ptr : 0 (never advances)
appl_ptr : 4608
After (6.12.115-2 + 70b4db7d2581), while playing:
state: RUNNING
delay : 7222
hw_ptr : 701497
appl_ptr : 708630
hw_ptr advances continuously and the output is audible again.
Disclosure: I worked on this together with an LLM-based assistant. It
helped with the source analysis, with preparing the module build and
with drafting this message. I reviewed all of it, and I ran the builds
and the hardware tests myself on the machine described above; the
measurements quoted here come from my own system.
Thanks,
smg <[email protected]>