Serial Port Monitoring

Neil Marjoram n.marjoram at adastral.ucl.ac.uk
Wed Oct 13 10:09:54 UTC 2004


Mike,

Thanks for that, it does not seem to produce any output. I am not really
the expert on the data, just an admin brought in at the last minute to
sort it out. I believe the transmission is hex. It's a custom built
receiver to collect information from devices anchored to the sea bed to
record tide and sandbank movements. It's being used monitor wind farm
locations in the North Sea.

I'll try to find out what the data is.

Many thanks,

Neil.


On Wed, 2004-10-13 at 04:50, Mike Klinke wrote:
> On Tuesday 12 October 2004 09:57, Neil Marjoram wrote:
> > Has anyone got any software that can monitor all data  from a
> > serial port?
> >
> > I have looked around and found a couple of projects, but I can't
> > find anything that can time stamp the data as well as log it.
> >
> > I am currently looking at slsnif-0.4.3, which seems to be able to
> > do it only I am getting an error :
> >
> > Serial Line Sniffer. Version 0.4.3
> >         Copyright (C) 2001 Yan Gurtovoy (ymg at dakotacom.net)
> >
> > Failed to open a pty: No such file or directory
> >
> > Can anyone tell me what this may be?
> >
> > I am in a race with an MS system to deliver the output - the
> > project found the Winblows box to be unreliable (funny that!),
> > and big mouth here said why don't you use a proper system!
> >
> > Thanks,
> >
> > Neil.
> >
>  
> You didn't say, but if your serial communication is based on lines 
> of text you can easily use something like tclsh or expect as 
> follows:
> 
> ############## serial_capture.sh ##############
> 
> #!/usr/bin/expect
> 
> proc Reader { pipe } {
>   global done
> 
>   if {[eof $pipe]} {
>     catch {close $pipe}
>     set done 1
>     return
>   }
>   gets $pipe line
>   set tagxmitdate [clock seconds]
>   #puts $line $tagxmitdate
>   puts "$tagxmitdate $line"
> }
> 
> set pipe [open "|cat /dev/ttyS0" r]
> fileevent $pipe readable [list Reader $pipe]
> vwait done
> 
> ####### End serial_capture.sh #########
> 
> This was done on FC1 with expect:
> 
> $rpm -qa expect
> expect-5.39.0-96.0.1
> 
> The line with "set pipe" shows ttyS0 but you can specify which 
> serial device you want to use. The output will be as follows:
> 
> $./serial_capture.sh
> 
> 1097638625 Line 1
> 1097638625 Line 2 
> 1097638625 Line 3
> 1097638625 etc...
> 
> which shows the number of seconds since Jan 01, 1970 for each line 
> of text your received.  In order to save this to a file simply 
> redirect the output: i.e.
> 
> $./serial_capture.sh > serial.log
> 
> Regards, Mike Klinke  
-- 
Neil Marjoram.
Systems Manager
University College London
Adastral Park Campus
Martlesham Heath
Ipswich
Suffolk
IP5 3RL

01473 663711




More information about the fedora-list mailing list