Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:sources:sbserial

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

Notes:

  • Do not forget to add yourself to the group which has permission to use the serial device files ttyS0, ttyUSB0 etc. On Slackware this is the group dialout
  • If you do not have a real RS232 interface anymore, you can use an USB-to-serial adapter. After pluggin into the USB port, usually the file /dev/ttyUSB0 is created by the kernel. This can be used just the same way as the „real“ 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.txt · Zuletzt geändert: 2009-11-02 16:27 von becki

Impressum - Datenschutzerklärung