[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Writing baseband data from the USRP
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] Writing baseband data from the USRP |
Date: |
Thu, 2 Feb 2006 16:54:29 -0800 |
User-agent: |
Mutt/1.5.6i |
On Thu, Feb 02, 2006 at 02:46:51PM -0500, Marcus Leech wrote:
> I want to be able to write baseband data from the usrp to a file. So I
> can just use
> gr_file_sink or gr_file_descriptor_sink as appropriate.
>
> But I want to have the GUI have a "start recording" and "stop recording"
> control that turns on/off the "torrent" of data to the disk, create
> filenames
> dynamically, etc.
>
> Any suggestions?
I've used this fairly hideous kludge to good effect:
# at init time...
self.log_file = open('/dev/null', 'w') # hold ref to file so it stays open
self.log_fd = self.log_file.fileno() # get the file descriptor
log = gr.file_descriptor_sink(gr.sizeof_foo, self.log_fd)
# Some time later...
new_file = open('/path/to/logfile', 'w') # open new target file
os.dup2(new_file.fileno(), self.log_fd) # self.log_fd now refs new_file
self.log_file = new_file # hold on to new file so it stays open
Eric