ba3289ac9a
* New script: dahdi_cfg_device_args: - Just like span_assignments, span_types: may be given one or more sysfs devpath's - Output the required options for dahdi_cfg. E.g: "-S 8 -C 15-28" - This may be passed (with any other wanted options) to the new dahdi_cfg (which supports '-S' and '-C') * Use dahdi_cfg_device_args in handle_device so we configure each span from udev. Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#! /bin/sh
|
|
#
|
|
# /usr/share/dahdi/handle_device
|
|
#
|
|
# Called by UDEV when a span goes online/offline to assign spans
|
|
|
|
me=`basename $0`
|
|
dir=`dirname $0`
|
|
LOGGER="logger -i -t '$me'"
|
|
NAME=`basename "$DEVPATH" | tr -c 'A-Za-z0-9-' '_'`
|
|
|
|
# Always redirect stderr somewhere, otherwise the shell script will die
|
|
# when it tries to do I/O related stuff on closed file descriptor.
|
|
# Our default is to throw it down the bit-bucket.
|
|
exec 2> /dev/null
|
|
# If you wish to trace this script:
|
|
#exec 2> "/tmp/${me}.$NAME" 1>&2
|
|
#exec 2> /dev/console
|
|
|
|
# Our directory in the beginning, so we can use local lab setup
|
|
PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin"
|
|
|
|
set -e
|
|
|
|
run_dahdi_cfg() {
|
|
args="-c $DAHDICONFDIR/system.conf $@"
|
|
echo "Running dahdi_cfg $args"
|
|
dahdi_cfg $args
|
|
}
|
|
|
|
echo >&2 "$0($ACTION): DEBUG($# args): '$*'"
|
|
|
|
case "$ACTION" in
|
|
add)
|
|
echo "$ACTION: $DEVPATH" | $LOGGER
|
|
# FIXME: need a way to add custom environment here:
|
|
#export DAHDICONFDIR="/tmp/xortel/dahdi"
|
|
span_types set "/sys/$DEVPATH" 2>&1 | $LOGGER
|
|
span_assignments add "/sys/$DEVPATH" 2>&1 | $LOGGER
|
|
dahdi_cfg_device_args | while read args; do
|
|
run_dahdi_cfg $args 2>&1 | $LOGGER
|
|
done
|
|
;;
|
|
remove)
|
|
echo "$ACTION: $DEVPATH" | $LOGGER
|
|
;;
|
|
*)
|
|
echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER
|
|
;;
|
|
esac
|