Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:sources:sbserial

Dies ist eine alte Version des Dokuments!


sbserial

Description

sbserial starts the serial terminal program seyon with a preset baud rate on a preset serial port.

The baud rate and port are read from config files located in $HOME/.config/sbserial/<name>. Start the script with the name of the config file as the only parameter eg.:

sbserial usb

If no config file is specified or it cannot be found, sberial expects the baudrate in arg 1 and devicefile in arg 2, eg.:

sbserial 115200 ttyS0

Conifg File Examples

#!/bin/bash
# file: $HOME/.config/sbserial/usb
baud='19200'
device='ttyUSB0'
#!/bin/bash
# file: $HOME/.config/sbserial/38400
baud='38400'
device='ttyS0'

Code

#!/bin/bash
# file: /user/local/bin/sbserial
# Usage: See http://wiki.think-deep.com/becki/sources/sbserial
# License: See http://think-deep.com/becki/sources/COPYING
 
CONFDIR="$HOME/.config/sbserial"
SEYONDIR="$HOME/.seyon"
SEYONSCRIPT="$SEYONDIR/sbserial"
 
if [ -f "$CONFDIR/$1" ]; then
    . "$CONFDIR/$1"
else
    if [ "$1" ]; then
        echo "Configfile \"$CONFDIR/$1\" not found!" >&2 ;
    else 
        echo "Configfile not specified!" >&2 ;
    fi
    echo "Expecting baudrate in arg 1 and devicefile in arg 2." >&2 ;
    baud="$1"
    device="$2"
fi
 
if [ ! "$baud" ]; then
    echo "Baudrate not passed!" >&2 ;
    exit 1
fi
 
if [ ! "$device" ]; then
    echo "Devicefile not passed!" >&2 ;
    exit 1
fi
 
echo "Generating config script: $SEYONSCRIPT:" >&2 ;
if [ ! -d $SEYONDIR ]; then
    mkdir $SEYONDIR
fi
echo "set baud $baud" > $SEYONSCRIPT
cat $SEYONSCRIPT
echo "On $device"
 
seyon -noemulator -script sbserial -modems "/dev/$device"
Cookies helfen bei der Bereitstellung von Inhalten. Diese Website verwendet Cookies. Mit der Nutzung der Website erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Computer gespeichert werden. Außerdem bestätigen Sie, dass Sie unsere Datenschutzerklärung gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website. Weitere Information
becki/sources/sbserial.1244639812.txt.gz · Zuletzt geändert: 2009-06-10 13:16 von becki

Impressum - Datenschutzerklärung