Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| becki:sources:sbserial [2009-06-10 10:22] becki created | becki:sources:sbserial [2009-11-02 16:27] (aktuell) becki | ||
|---|---|---|---|
| Zeile 10: | Zeile 10: | ||
| sbserial 115200 ttyS0 | 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 == | ===== Conifg File Examples == | ||
| Zeile 34: | Zeile 37: | ||
| # Usage: See http://wiki.think-deep.com/becki/sources/sbserial | # Usage: See http://wiki.think-deep.com/becki/sources/sbserial | ||
| # License: See http://think-deep.com/becki/sources/COPYING | # License: See http://think-deep.com/becki/sources/COPYING | ||
| - | |||
| - | DEFBAUD=19200 | ||
| - | DEFDEVICE=ttyS0 | ||
| CONFDIR="$HOME/.config/sbserial" | CONFDIR="$HOME/.config/sbserial" | ||
| - | SEYONSCRIPT="$HOME/.seyon/sbserial" | + | SEYONDIR="$HOME/.seyon" | 
| + | SEYONSCRIPT="$SEYONDIR/sbserial" | ||
| if [ -f "$CONFDIR/$1" ]; then | if [ -f "$CONFDIR/$1" ]; then | ||
| - | #echo "Sourcing configfile \"$CONFDIR/$1\"." >&2 ; | ||
| . "$CONFDIR/$1" | . "$CONFDIR/$1" | ||
| else | else | ||
| - | echo "Configfile \"$CONFDIR/$1\" not found!" >&2 ; | + | 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 ; | echo "Expecting baudrate in arg 1 and devicefile in arg 2." >&2 ; | ||
| baud="$1" | baud="$1" | ||
| Zeile 52: | Zeile 56: | ||
| if [ ! "$baud" ]; then | if [ ! "$baud" ]; then | ||
| - | echo "Baudrate not passed! Using default $DEFBAUD" >&2 ; | + | echo "Baudrate not passed!" >&2 ; | 
| - | baud=$DEFBAUD | + | exit 1 | 
| fi | fi | ||
| if [ ! "$device" ]; then | if [ ! "$device" ]; then | ||
| - | echo "Devicefile not passed! Using default $DEFDEVICE" >&2 ; | + | echo "Devicefile not passed!" >&2 ; | 
| - | device=$DEFDEVICE ; | + | exit 1 | 
| fi | fi | ||
| echo "Generating config script: $SEYONSCRIPT:" >&2 ; | echo "Generating config script: $SEYONSCRIPT:" >&2 ; | ||
| + | if [ ! -d $SEYONDIR ]; then | ||
| + | mkdir $SEYONDIR | ||
| + | fi | ||
| echo "set baud $baud" > $SEYONSCRIPT | echo "set baud $baud" > $SEYONSCRIPT | ||
| cat $SEYONSCRIPT | cat $SEYONSCRIPT | ||
| Zeile 67: | Zeile 74: | ||
| seyon -noemulator -script sbserial -modems "/dev/$device" | seyon -noemulator -script sbserial -modems "/dev/$device" | ||
| + | |||
| </code> | </code> | ||