dahdi-tools/dahdi_cfg_device_args
Oron Peled ba3289ac9a Make udev run dahdi_cfg on each device:
* 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>
2013-05-24 16:58:15 -05:00

33 lines
586 B
Bash
Executable File

#! /bin/sh
devbase='/sys/bus/dahdi_devices/devices'
# Use given devices or otherwise, all existing devices
if [ "$#" -gt 0 ]; then
DEVICES="$@"
else
DEVICES=`echo $devbase/*`
fi
run_action_spans() {
device="$1"
for span in $device/span-*
do
spanno=`echo "$span" | sed 's,.*/span-,,'`
spantype=`cat "$span/spantype"`
basechan=`cat "$span/basechan"`
channels=`cat "$span/channels"`
endchan=`expr "$basechan" + "$channels" - 1`
echo "-S $spanno -C $basechan-$endchan"
done
}
run_action() {
for device in $DEVICES
do
run_action_spans "$device"
done
}
run_action