Maintains the original registration order as was before span
assignments. Should allow seemless trannsition to
dahdi.auto_assign_spans=0
* The idea:
- We stop handling in udev the case of missing
/etc/dahdi/assigned-spans.conf
- Instead we rely on "registration_time" dahdi_device attribute from
DAHDI-linux
- Then, we can sort the devices and assign their spans in
/etc/init.d/dahdi
* Mechanics:
- From /etc/init.d/dahdi, we run a new 'dahdi_auto_assign_compat'
script (after "waitfor_xpds" etc.)
- In this script we "auto" assign spans of non-Astribank devices
- In the end of the script we run "dahdi_registration" which
does the same for Astribank devices.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
26 lines
522 B
Bash
Executable File
26 lines
522 B
Bash
Executable File
#! /bin/sh
|
|
|
|
devdir='/sys/bus/dahdi_devices/devices'
|
|
|
|
# DAHDI is loaded?
|
|
if [ ! -d "$devdir" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
devices_by_registration_time() {
|
|
grep -H '' $devdir/*/registration_time 2>/dev/null | \
|
|
sed 's,/registration_time:,\t,' | \
|
|
sort -k 2,2
|
|
}
|
|
|
|
# First assign non-Astribank devices
|
|
devices_by_registration_time | \
|
|
grep -v '/astribanks:' | \
|
|
while read devpath time; do
|
|
echo >&2 "D: auto '$devpath'"
|
|
dahdi_span_assignments auto "$devpath"
|
|
done
|
|
|
|
# Now handle Astribanks
|
|
LC_ALL=C dahdi_registration -Rv on
|