From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4193 invoked by alias); 18 Jul 2013 05:59:57 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17883 Received: (qmail 12813 invoked from network); 18 Jul 2013 05:59:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.220.47 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=Em/avsYbsbaZL2TKqKxv1DqmO1bdXkyF8Asw1a5lyy8=; b=CTn1UqbZuAGc1f75OLK8nqygi3Dc17LQk9U/F0PJ8fvaJQQrIg4thm/zTkczpmQfMM ffyU4c1dfumRVQ5xlx9h7tqZvTTucJIMVNL+Y59jGAZq8D043oAGmFAjJc1Pn4ynGHMs ngu0oSQxKZrmT2S6SIOBW6zY8SyCW9bLz6NGHIzMQFEkZoVOVdK6VIRQN0wxGJpfIKAV bXt+82bebneWyDftAemaFA35WEka8XgGDU7z2D76oHrGsEvWfz8jbUqjUnN1Mh+B/W4Z P5nQ4H/RFyCDV2+sMiPp4iKu9HepR64sPw25sWpFafY5m7cILfGMbd01szPl3gyZzdUf WRDA== X-Received: by 10.66.224.237 with SMTP id rf13mr11613830pac.26.1374127184776; Wed, 17 Jul 2013 22:59:44 -0700 (PDT) Date: Thu, 18 Jul 2013 15:59:32 +1000 From: Ian Petts To: zsh-users@zsh.org Subject: Problem with redirecting from serial device Message-ID: <20130718055932.GA9525@kvm1.pettsie.net> Mail-Followup-To: zsh-users@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) I have been playing around with weather station receiver software on the Arduino. The Arduino outputs serial data over USB on device ttyACM0. The incoming data is not timestamped, so I have a small awk script to add this as the data is received: #!/usr/bin/awk -f { dt = strftime("%Y-%m-%d %H:%M:%S", systime(), 0) print dt " " $0 } When I run the script with output going to the terminal, everything looks to be working just fine: ian@nibbler[1568]~% ./dt-add.awk < /dev/ttyACM0 2013-07-18 15:34:18 [OS V3 Sensor Capture/Decode] 2013-07-18 15:35:16 Wind Gust: 2.33 Wind Avg: 2.42 Dir: NW 2013-07-18 15:36:02 Temp: 17.11 Humidity: 61 2013-07-18 15:36:55 Temp: 17.01 Humidity: 61 As soon as I add a redirect or pipe to the above (to save the data to a file or for further processing) no data appears: ian@nibbler[1570]~% ./dt-add.awk < /dev/ttyACM0 > weather.out # A few minutes later ^C ian@nibbler[1571]~% ls -lh weather.out -rw-rw-r-- 1 ian ian 0 Jul 18 15:47 weather.out I don't think it's a file buffering issue, I've left it go for several hours with the same results. Even if I try 'more'ing the data I seem to get no output. Dumping the raw data to a file seems to be fine. < /dev/ttyACM0 > foo works as expected. Can anyone please explain where the issue is? -- All computers run at the same speed...with the power off.