]> sigrok.org Git - sigrok-cli.git/commit - input.c
input: unbreak automatic format detection when reading from stdin
authorGerhard Sittig <redacted>
Thu, 7 Apr 2022 21:12:34 +0000 (23:12 +0200)
committerGerhard Sittig <redacted>
Sat, 23 Apr 2022 19:34:59 +0000 (21:34 +0200)
commit2b29fb3954da8ede79ade2e4940f95b3ef836d8f
tree53a7c429234355acbe60ab34de0fa7b7fa61c8b0
parent525f48143fc004d104b2e3fb91c6e5bb2a1064df
input: unbreak automatic format detection when reading from stdin

The combination of reading from stdin and automatic file format match
could result in the execution of an input module's .end() callback
before its .receive() ever executed. Which then suffers from an sdi
which is not yet ready, and no data was sent to the sigrok session.
Fix that.

Unfortunately the input module's accumulator is hidden behind the
libsigrok API. That's why applications cannot defer the forwarding
of the first data chunk from the input file. Insert a .receive() call
with a zero length instead before more file content is consumed. All
existing input modules are prepared to handle this call sequence.
input.c