# Controlling File Sink

**URL:** <https://www.ruby-forum.com/t/controlling-file-sink/234544>\
**Category:** GNU Radio\
**Created:** [March 12, 2015, 7:39pm UTC](https://www.ruby-forum.com/t/controlling-file-sink/234544 "2015-03-12T19:39:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 12, 2015, 7:39pm UTC](https://www.ruby-forum.com/t/controlling-file-sink/234544/1 "2015-03-12T19:39:23Z")

</div>

Hello all,

In GRC, I’ve set up a packet detector that is working using the Header  
Payload Demux block. Unexpectedly, however, it seems the payload output  
port does not go silent when no header is detected. It outputs zeros,  
which  
the file sink block I have connected to that port then stores.

I’ve attached a screenshot of my flowgraph. The top row generates the  
packets. The middle row adds zeros between packets, to give the header  
payload demux something to do. The third row detects the packets, strips  
the header and sends the payload out to a file sink.

I would like the payload output port to be quiet when no header is  
detected, or I would like a way to control what the file sink stores.  
Tagged File Sink is not what I’m looking for, because it creates a new  
file  
every time a tag is detected.

Would someone kindly recommend a way to do what I would like?

v/r,  
Rich

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 12, 2015, 7:44pm UTC](https://www.ruby-forum.com/t/controlling-file-sink/234544/2 "2015-03-12T19:44:26Z")

</div>

Have your packet detector set the filename on the filesink to  
“/dev/null” when you don’t want anything recorded, and to your output  
filename when you do, and use the “append” option.

On 2015-03-12 14:36, Richard B. wrote:

> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio) [1]

Links:

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 12, 2015, 10:20pm UTC](https://www.ruby-forum.com/t/controlling-file-sink/234544/3 "2015-03-12T22:20:08Z")

</div>

Marcus,

I’m not sure how to do what you’re saying. Can you elaborate with an  
example?

Rich

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 13, 2015, 6:34pm UTC](https://www.ruby-forum.com/t/controlling-file-sink/234544/4 "2015-03-13T18:34:18Z")

</div>

On 12.03.2015 11:36, Richard B. wrote:

> Hello all,
> 
> In GRC, I’ve set up a packet detector that is working using the Header  
> Payload Demux block. Unexpectedly, however, it seems the payload output  
> port does not go silent when no header is detected. It outputs zeros,  
> which the file sink block I have connected to that port then stores.

Richard,

the HPD does _not_ output zeros between bursts. It will send out  
whatever the header return message tells it to output. Check the OFDM  
examples for how these things happen. You can add message probes to see  
what exactly is encoded by the messages.

M

---

<div class="post-metadata">

**Author:** ![reback](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b5ac83/32.png) [@reback](https://www.ruby-forum.com/u/reback)\
**Post date:** [March 13, 2015, 11:38pm UTC](https://www.ruby-forum.com/t/controlling-file-sink/234544/5 "2015-03-13T23:38:42Z")

</div>

Hey Richard,

I looked at your previous post, and turns out that I actually have a  
similar need; I’m trying to figure out a way to control the  
functionality  
of the tagged file sink because I don’t want it to create so many files  
lol  
(I’d just like it to place everything in one file).

So I was thinking, since we already have the source code for these  
blocks,  
and there’s a nice tutorial on how to write blocks either in c++ or  
python  
at [http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules](http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules),  
so  
a good starting point would be to create our own version of the block,  
and  
use the current source code as a starting point in adding the extra  
functionality that’s needed.

Best,  
Ali

On Fri, Mar 13, 2015 at 12:32 PM, Martin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
