[plug] ring buffer for raw data

Onno Benschop onno at itmaze.com.au
Mon Oct 26 14:44:33 AWST 2020


I'm attempting to pipe output from the rtl_sdr command - think of it as raw
bytes if you're not familiar with it - to a ring buffer. The purpose of
doing this is to create multiple such processes and synchronise their
output.

I've come across multilog (from daemontools) that allows you to pipe data
in and it sends that data into a collection of rotating files and it
internally tracks overall size and renames "current' to the latest
timestamp, deleting the oldest - the point being that all data is kept
sequentially within the files and tail -F can get the current output.

Furthermore, I'm sending the output from rtl_sdr - again, just raw data -
to a named pipe and directing that to multilog.

A trivial script to do this looks like this:

   - mkfifo sdr_0
   - mkdir sdr_bufffer
   - multilog  ./sdr_buffer/ < ./sdr_0 &
   - rtl_sdr -f 99.3M ./sdr_0 &

To get the output at the other end, you can use:

   - tail -f ./sdr_buffer/current

The reason for the named pipe is to have the ability to "inject" extra
data, so we can add extra samples, thus changing the difference between
multiple versions of this process running side-by-side in their own logging
buffer (essentially running the above script in several separate
directories).

The problem I'm having is that the data from rtl_sdr doesn't actually end
up in the log. It's massively truncated and mangled. Even using a binhex
encoder between the raw output and the multilog process doesn't get the
data to the other end - I thought it might only want to deal with actual
ASCII text.

I've also created a test file and have attempted to send that through
multilog, but that too is not getting through properly.

I'm expecting to be able to do "tail -F ./sdr_buffer/current > mynewfile"

I'm also expecting mynewfile to be identical to the raw file I pipe in thus:

   - multilog ./sdr_buffer/ < raw_file

What am I missing?

Is there a better way?

-- 
Onno Benschop

()/)/)()        ..ASCII for Onno..
|>>?            ..EBCDIC for Onno..
--- -. -. ---   ..Morse for Onno..

If you need to know: "What computer should I buy?" http://goo.gl/spsb66

ITmaze   -   ABN: 56 178 057 063   -  ph: 04 1219 8888   -
onno at itmaze.com.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20201026/639386ad/attachment.html>


More information about the plug mailing list