Česky
Kamil Dudka

TriloBot Simulator (C++, Qt4, Flex, Readline, Boost)

File detail

Name:DownloadredirCOM1.sh [Download]
Location: rob08
Size:1.5 KB
Last modification:2009-07-11 00:10

Source code

#!/bin/sh
# Copyright (C) 2008 Kamil Dudka <xdudka00@stud.fit.vutbr.cz>
#
# This file is part of rob08
#
# rob08 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# rob08 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with rob08.  If not, see <http://www.gnu.org/licenses/>.
 
DEV_PTY_MASTER=/dev/ptyp0
DEV_PTY_SLAVE=/dev/ttyp0
DEV_SERIAL=/dev/ttyS0
 
# check if PTY device pair exists
if test ! -c $DEV_PTY_MASTER || test ! -c $DEV_PTY_SLAVE; then
    echo "error: no PTY device, try add 'CONFIG_LEGACY_PTYS=y' to your kernel" \
         "configuration"
    exit 1
fi
 
# check for read/write permissions (slave only)
if test ! -r $DEV_PTY_SLAVE || test ! -w $DEV_PTY_SLAVE; then
    echo "error: not enough privileges to access PTY device, try add self to" \
         "group 'tty'"
    exit 1
fi
 
# check for read/write permissions on serial device
# if test -e $DEV_SERIAL; then
#     if test ! -r $DEV_SERIAL || test ! -w $DEV_SERIAL; then
#         echo "error: not enough privileges to access serial port device, try" \
#              "add self to group 'uucp'"
#         exit 1
#     fi
# fi
 
set -x
su -c "set -x; ln -f $DEV_PTY_SLAVE $DEV_SERIAL"