summaryrefslogtreecommitdiff
path: root/xpp/waitfor_xpds
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-10-21 14:30:32 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-10-21 14:30:32 +0000
commit939ffb7577ce08dfc552ce0c112e9d51fd2b4519 (patch)
treeb109d414522a83530be7999b0aa9d13a61f5c739 /xpp/waitfor_xpds
parentee453cb6ce6863f1b3f87888bf4572d1f6455cb3 (diff)
Fix XPP_HOTPLUG_DAHDI: logic; end of init.d script
'Hotplug mode' was introduced in r7335. * The logic in the script was broken. - Negative logic is not such a grand idea to start with. * Interactive invocation of init.d ends when expected and not sooner. This change makes waitfor_xpds wait longer. Rather than waiting for all the Astribanks to load, it will now wait until the initialization of dahdi from the Astribanks hook script is run. This allows running e.g.: /etc/init.d/dahdi start; /etc/init.d/asterisk start It also means that 'astribank_is_starting' is actually used as a semaphore and not only as stamp file. As before, those changes have no effect if hotplug mode is not explicitly enabled (setting 'XPP_HOTPLUG_DAHDI=yes' in init.conf). git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7409 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/waitfor_xpds')
-rwxr-xr-xxpp/waitfor_xpds18
1 files changed, 14 insertions, 4 deletions
diff --git a/xpp/waitfor_xpds b/xpp/waitfor_xpds
index 7caa981..6bee5f2 100755
--- a/xpp/waitfor_xpds
+++ b/xpp/waitfor_xpds
@@ -29,6 +29,8 @@ set -e
mydir=`dirname $0`
PATH="${mydir}:${PATH}"
+[ -r /etc/dahdi/init.conf ] && . /etc/dahdi/init.conf
+
ab_list() {
# Only check /sys info (don't use /proc anymore).
ab=`find /sys/bus/astribanks/devices/xbus-*/ -name waitfor_xpds 2> /dev/null || :`
@@ -45,7 +47,7 @@ if ! astribank_is_starting="`which astribank_is_starting 2>/dev/null`"; then
exit 0
fi
if [ "`$dahdi_hardware | grep xpp_usb`" != "" ]; then
- astribank_is_starting -a
+ astribank_is_starting -v -a
fi
if ! astribank_is_starting; then
exit 0
@@ -67,7 +69,7 @@ done
echo ""
# Wait for device to stabilize and XPD's to finish initalizations
-echo 1>&2 "Astribanks initalization "
+echo 1>&2 "Astribanks initializing spans"
while
if ! ab=`ab_list`; then
exit 1
@@ -78,5 +80,13 @@ do
cat $ab
done
-# Handled astribanks
-astribank_is_starting -r
+if [ "$XPP_HOTPLUG_DAHDI" = yes ]; then
+ if [ "$CALLED_FROM_ATRIBANK_HOOK" = '' ]; then
+ # Now we can wait until the hotplug run would remove the semaphore
+ echo -n 1>&2 "Other DAHDI initializations... "
+ astribank_is_starting -v -w 1>&2
+ fi
+else
+ # Non-hotplug -- Sequential initialization, remove semaphore
+ astribank_is_starting -v -r 1>&2
+fi