Skip to content

Add sofprobeclient binary#35

Open
jsarha wants to merge 6 commits intoalsa-project:masterfrom
jsarha:sofprobeclient
Open

Add sofprobeclient binary#35
jsarha wants to merge 6 commits intoalsa-project:masterfrom
jsarha:sofprobeclient

Conversation

@jsarha
Copy link
Copy Markdown

@jsarha jsarha commented Mar 31, 2026

I was hoping this SOF [1] debug tool could be accepted as part of tinycompress package. The current method of usage [2] is not very convenient and a single binary doing everything would simplify things nicely. And since this method of debugging uses alsa compressed support, I think the most natural place for the tool would be as part of tinycompress repository.

Best regards,
Jyri

[1] https://github.com/thesofproject
[2] https://thesofproject.github.io/latest/developer_guides/debugability/probes/index.html

Jyri Sarha added 6 commits March 31, 2026 23:39
Add sofprobeclient, a SOF probe client for compressed audio
capture based on crecord. Built from its own source file with
the same libtinycompress linkage as cplay and crecord.

At this phase the sofprobeclient.c is almost exact copy of
crecord.c. Only the reference to the command name have been updated
from "crecord" to "sofprobeclient".

This is a staring point for SOF probe debugging tool that uses
compressed audio capture device for routing logs and audio form
defined probe points out of the DSP subsystem.
Change default parameters to match typical SOF probe usage:
card 3, device 0, buffer 8192, 4 fragments, S32_LE format,
48000 Hz sample rate, and 4 channels.

All parameters remain overridable via command line options.
Integrate the sof-probes demux engine directly into sofprobeclient so
captured compressed data is parsed in real time instead of being
written to a raw file.

Log output from non-audio probe points is printed to stdout
(equivalent to sof-probes -l). Audio probe data is extracted into
buffer_<id>.wav files in the current directory. The file output
parameter is removed; sofprobeclient no longer acts as a generic
recorder.

New files copied from SOF v2.9 sources tools/probes/ with include
paths adjusted for standalone tinycompress build:
  probes_demux.c / probes_demux.h  - probe stream parser
  probes_wave.h                    - WAV header definitions
  probe_dma_frame.h                - DMA frame packet format
The compress device may return more data than the parser's internal
buffer (DATA_READ_LIMIT, 4096 bytes) can accept in one call. Feed
captured data in a loop, copying only as much as parser_fetch_free_buffer()
reports available per iteration. This fixes truncated probe packets
that caused checksum errors and missing log lines.
Move the "We read N, DSP sent M" diagnostic behind a new -D
(parser debug) flag so it does not clutter normal output.
Audio capture files (buffer_<id>.wav) are now automatically closed
after 200 ms of inactivity, so completed recordings can be accessed
while sofprobeclient is still running.

If the same probe point becomes active again, a new file is created
with an incrementing index (buffer_<id>-1.wav, buffer_<id>-2.wav, ...)
rather than overwriting the previous capture.  The index is chosen by
probing the filesystem, so existing files from earlier runs are never
clobbered either.

Buffer IDs in file names and log messages are printed in hexadecimal
(e.g. buffer_0x1a.wav) to match firmware conventions.
@jsarha
Copy link
Copy Markdown
Author

jsarha commented Mar 31, 2026

@lgirdwood , @kv2019i , do you have anything to add before I turn this PR ready for review?

@jsarha jsarha marked this pull request as ready for review April 1, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant