#!/bin/sh -e ############################################################################ # Copyright (c) 2006 O.S. Systems # # Author: Otavio Salvador # # This program 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 2 of the License, or # (at your option) any later version. # # This program 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. ############################################################################ # This utility serialize parallel requests if [ "$1" = on ]; then OPTION=-o else OPTION=-f fi LOCK=$STATE_DIR/serial if [ -z "$SERIAL_POWER_PIN" ]; then echo "SERIAL_POWER_PIN required for serial control" >&2 exit 1 fi sigout () { lockfile-remove $LOCK } trap sigout INT QUIT lockfile-create $LOCK lockfile-touch --oneshot $LOCK serial-control $OPTION $SERIAL_POWER_PIN lockfile-remove $LOCK