[svn-commits] tzafrir: tools/trunk r6646 - in /tools/trunk: dahdi.init xpp/waitfor_xpds

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 19 11:33:53 CDT 2009


Author: tzafrir
Date: Tue May 19 11:33:50 2009
New Revision: 6646

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6646
Log:
dahdi.init: moved test for astribanks into waitfor_xpds

If the system starts with an Astribank with no firmware, the firmware
loading may take a while and the Astribank only becomes ready some time
after the DAHDI init script starts.

This means that the test at the beginning of xpp_startup() in dahdi.init
fails to find an Astribank, and the init script simply continues
ignoring this.

This changeset moves the testing inside the script waitfor_xpds. The
script now:

1. Tests for an Astribank using dahdi_hardware and exists immediately
   if none found.
2. A loop (of maximum 10 seconds) waits for the first Astribank to
   be detected by the driver.
3. Waiting for the initialization of all the Astribanks to complete (The 
   original waitfor_xpds)

The support for the old procfs iinterface has been removed, as it has
never been used with DAHDI.

Modified:
    tools/trunk/dahdi.init
    tools/trunk/xpp/waitfor_xpds

Modified: tools/trunk/dahdi.init
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/dahdi.init?view=diff&rev=6646&r1=6645&r2=6646
==============================================================================
--- tools/trunk/dahdi.init (original)
+++ tools/trunk/dahdi.init Tue May 19 11:33:50 2009
@@ -89,8 +89,6 @@
 # Initialize the Xorcom Astribank (xpp/) using perl utiliites:
 xpp_startup() {
 	# do nothing if there are no astribank devices:
-	if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi
-
 	if ! /usr/share/dahdi/waitfor_xpds; then return 0; fi
 
 	# overriding locales for the above two, as perl can be noisy

Modified: tools/trunk/xpp/waitfor_xpds
URL: http://svn.asterisk.org/svn-view/dahdi/tools/trunk/xpp/waitfor_xpds?view=diff&rev=6646&r1=6645&r2=6646
==============================================================================
--- tools/trunk/xpp/waitfor_xpds (original)
+++ tools/trunk/xpp/waitfor_xpds Tue May 19 11:33:50 2009
@@ -26,22 +26,32 @@
 set -e
 
 ab_list() {
+	# Only check /sys info (don't use /proc anymore).
 	ab=`find /sys/bus/astribanks/devices/xbus-*/ -name waitfor_xpds 2> /dev/null || :`
-	if [ "$ab" = "" ]; then
-		ab=`find /proc/xpp/XBUS-[0-9]*/ -name waitfor_xpds 2> /dev/null || :`
-		procfiles=1
-	fi
-	if [ "$ab" = "" ]; then
-		echo 1>&2 "$0: No XBUSES to wait for. Aborting..."
-		exit 1
-	fi
-	if [ -n "$procfiles" ]; then
-		echo 1>&2 "$0: No /sys attributes, fallback to /proc interface..."
-	fi
 	echo $ab
 }
 
+# Any hardware?
+if [ "`dahdi_hardware | grep xpp_usb`" = "" ]; then
+	exit 0
+fi
 
+# Wait for driver and first device
+echo -n 1>&2 "Astribanks detection "
+tries=10
+while [ ! -e "/sys/bus/astribanks/devices/xbus-00" ]
+do
+	if [ "$tries" -le 0 ]; then
+		exit 1
+	fi
+	echo -n 1>&2 "."
+	sleep 1
+	((tries--))
+done
+echo ""
+
+# Wait for device to stabilize and XPD's to finish initalizations
+echo 1>&2 "Astribanks initalization "
 while
 	if ! ab=`ab_list`; then
 		exit 1
@@ -49,6 +59,5 @@
 	test "$oldab" != "$ab"
 do
 	oldab="$ab"
-	echo 1>&2 "Waiting for XPDS"
 	cat $ab
 done




More information about the svn-commits mailing list