On Tue, Apr 05, 2005 at 06:50:04PM -0400, cswiger wrote:
> Gang - *almost* have a keyboard input to a psk31 transmitter running -
> but I don't fully understand named pipes. Q: Why does it not send
> untill the pipe is closed???
> 
> One script opens a named pipe /pipe for writing
> 
>   pskfh = open("/pipe","w")
> 
> and the script successfully gets characters from the keyboard and
> translates to the appropriate phase shift sent to the pipe, or inserts
> idles characters if no keys are pressed before timeouts.
> 
> Another script opens the pipe for input to the gnuradio part
> feeding gr.bytes_to_syms() etc
> 
>   src = gr.file_source(gr.sizeof_char,"/pipe")
> 
> However the gnuradio script produces NO output untill the
> keyboard/varicode/psk script closes the pipe - then it appears
> to produce the correct output. Even tried pskfh.flush() after
> every pipe write w/o luck.
> 
> I want it to run as I type - the keyboard script should be keeping the
> pipe loaded faster then the gnuradio script is reading (I think).
> 
> Clue appreciated.

Two things:

  (1) For better interaction with pipes, sockets, etc use
      gr.file_descriptor_source instead of gr.file_source.
      gr.file_descriptor_source returns as soon as it gets any input.
      gr.file_source blocks until it gets everything asked for by the
      caller.

      # you've got to keep a reference to file until you're done...
      self.file = open("/pipe", "r")
      src = gr.file_descriptor_source(gr.sizeof_char, self.file.fileno())

  (2) If you aren't already calling flush, after writing each
      character into pskfh, try this:

      pskfg.flush()

Eric

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to