Update the configure script as well.
[dahdi/tools.git] / dahdi_cfg_device_args
1 #! /bin/sh
2
3 devbase='/sys/bus/dahdi_devices/devices'
4
5 # Use given devices or otherwise, all existing devices
6 if [ "$#" -gt 0 ]; then
7         DEVICES="$@"
8 else
9         DEVICES=`echo $devbase/*`
10 fi
11
12 run_action_spans() {
13         device="$1"
14         for span in $device/span-*
15         do
16                 spanno=`echo "$span" | sed 's,.*/span-,,'`
17                 spantype=`cat "$span/spantype"`
18                 basechan=`cat "$span/basechan"`
19                 channels=`cat "$span/channels"`
20                 endchan=`expr "$basechan" + "$channels" - 1`
21                 echo "-S $spanno -C $basechan-$endchan"
22         done
23 }
24
25 run_action() {
26         for device in $DEVICES
27         do
28                 run_action_spans "$device"
29         done
30 }
31
32 run_action