[svn-commits] tzafrir: branch tools/2.6 r10596 - /tools/branches/2.6/xpp/astribank_hook

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Mar 22 14:01:34 CDT 2012


Author: tzafrir
Date: Thu Mar 22 14:01:32 2012
New Revision: 10596

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10596
Log:
xpp: astribank_hook: wait for udev to settle

When running the astribank_hook (only on Astribanks, in XPP_HOTPLUG_DAHDI
mode), wait for all other Astribanks to create all the required device
files.

Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10585

Modified:
    tools/branches/2.6/xpp/astribank_hook

Modified: tools/branches/2.6/xpp/astribank_hook
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.6/xpp/astribank_hook?view=diff&rev=10596&r1=10595&r2=10596
==============================================================================
--- tools/branches/2.6/xpp/astribank_hook (original)
+++ tools/branches/2.6/xpp/astribank_hook Thu Mar 22 14:01:32 2012
@@ -68,7 +68,34 @@
 NUM_GOOD=`matched_devices | wc -l`
 LOCK="/var/lock/twinstar_startup"
 
+# Wait until udev finished processing our requests
+# so we know the device files were actually created
+# before trying dahdi_cfg et-al.
+wait_for_udev() {
+	UDEV_SETTLE_MAX_TIME=10
+
+	echo "Waiting for udev to settle down..."
+	if [ -x /sbin/udevsettle ]; then
+		# Old system, stand-alone udevsettle command
+		time /sbin/udevsettle --timeout="$UDEV_SETTLE_MAX_TIME"
+	elif [ -x /sbin/udevadm ]; then
+		# Assume modern system, udevadm has settle parameter
+		if ! time /sbin/udevadm settle --timeout="$UDEV_SETTLE_MAX_TIME"
+		then
+			echo "udevadm failed ($?)."
+			echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
+			sleep "$UDEV_SETTLE_MAX_TIME"
+		fi
+	else
+		echo "No udevsettle/udevadm."
+		echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
+		sleep "$UDEV_SETTLE_MAX_TIME"
+	fi
+	sleep 1	# Wait a bit more (races)
+}
+
 start_dahdi() {
+	wait_for_udev
 	script=/etc/init.d/dahdi
 	echo "Starting $script."
 	"$script" start | logger -i -t "$script"




More information about the svn-commits mailing list