Com. script for /dev/ttyS0

Mathieu Deschamps mdeschamps at mangrove-systems.com
Tue May 11 03:47:01 CEST 2004


Hello,

As i've seen there are no tool to handle ttyS0 communication, I've
done some tiny scripts to handle this in bash so it relies on linux.
It logs and calculate the elapse time of hearing, that could be 
interrupt. That's very minimal, I find it useful and the command line
of hear isn't that simple.

 To use them, you just have to check out your com driver with your
actual LB Baud rate :

[root at ge] cat /proc/tty/driver/serial 

serinfo:1.0 driver:5.05c revision:2001-07-08
0: uart:16550A port:3F8 irq:4 baud:9600 tx:967431 rx:955468 fe:2155
brk:2 
1: uart:16550A port:2F8 irq:3 baud:9600 tx:3 rx:0

Then copy these file hear.sh and digest.sh  (note:render 'em executable)
-------------------------------------------------------------------
#!/bin/sh
#
# Hear! script  listen & log from ttyS0 (serial port a.k.a COM1)
#  Mathieu Deschamps for mangove-systems
#
VERSION="07/05/04|16:24:03 MD"
i="Bienvenu(e) dans Hear! v. $VERSION j'ecoute sur ttyS0 ..."
ter=`tty`
if [ "x$1" = "x" ]; then
  echo "Usage $0 log_to_file"
  exit 0
 else
  LOG="$1"
fi
echo $i
echo  "Logging in $LOG"
echo "****************************************************" >>"$LOG" 
echo " Hear! Boot Log started on `date +%d/%m/%y\|%T` " >> "$LOG"
echo "  tty in use : $ter  from ttyS0 " >>"$LOG"
echo "****************************************************" >>"$LOG"

  /usr/bin/time -pao "$LOG" -- cat -sbA </dev/ttyS0 | tee -a "$LOG" 
  
  ./digest.sh $LOG -s

-------------------------------------------------------------------------

#!/bin/bash
#
# Script to digest hard-human readable hear! logs
#  Mathieu Deschamps for mangrove-systems
#
VERSION="11/05/04|09:40:28 MD"
SUPP=0
DAT="`date +%d\-%m\-%y\ %T`"
if  [ "x$1" = "x"  ]; then
        echo "usage: $0 hear!_log_file [--suppress-log,-s] " 
        echo "v. $VERSION"
        exit 0
  else
        FIL="$1"
fi

[ "x$2" = "x-s" ] || [ "x$2" = "x--suppress-log" ]  && SUPP=1

if [ -f "$FIL.adv" ]; then
  mv "$FIL.adv"  "$FIL.adv.$DAT"
fi

cat $FIL | while read line; 
        do 
                [ "x$line" != "x$" ] && echo "$line"
        done >  "$FIL.adv"

( [ $? -eq 0 ];  echo "$FIL digested into $FIL.adv" ) || echo "Digestion
gets harden ...blurp (error) "

[ $SUPP -eq 1 ] && rm -f $FIL 2>&1 >/dev/null
------------------------------------------------------------------------


Of course, first, you should test hear.sh  in typing  : echo "test"
>/dev/ttyS0 on you build station and see what you'll get, to end and
close dialog you can send a /dev/null or CTRL Interrup the listener.

It has helped me keeping trails, so if could for you.
mathieu



More information about the coreboot mailing list