[svn-commits] tzafrir: tools/trunk r8951 - /tools/trunk/xpp/xpp_fxloader

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 20 14:32:37 CDT 2010


Author: tzafrir
Date: Tue Jul 20 14:32:33 2010
New Revision: 8951

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8951
Log:
xpp_fxloader: replace a sleep with a sleep loop

For newer kernels there's no need to sleep at all. For Centos5 systems
there seems to be a need for a large sleep for firmware load at boot time.
So let's make it a loop.

Modified:
    tools/trunk/xpp/xpp_fxloader

Modified: tools/trunk/xpp/xpp_fxloader
URL: http://svnview.digium.com/svn/dahdi/tools/trunk/xpp/xpp_fxloader?view=diff&rev=8951&r1=8950&r2=8951
==============================================================================
--- tools/trunk/xpp/xpp_fxloader (original)
+++ tools/trunk/xpp/xpp_fxloader Tue Jul 20 14:32:33 2010
@@ -67,7 +67,7 @@
 FIRMWARE_DIR="${FIRMWARE_DIR:-/usr/share/dahdi}"
 ASTRIBANK_HEXLOAD=${ASTRIBANK_HEXLOAD:-/usr/sbin/astribank_hexload}
 ASTRIBANK_TOOL=${ASTRIBANK_TOOL:-/usr/sbin/astribank_tool}
-XPP_UDEV_SLEEP_TIME="${XPP_UDEV_SLEEP_TIME:-1}"
+XPP_UDEV_SLEEP_TIME="${XPP_UDEV_SLEEP_TIME:-5}"
 
 USB_FW="${USB_FW:-USB_FW.hex}"
 
@@ -325,9 +325,18 @@
 # On some systems (e.g. CentOS 5) we get the relevant udev event before the device
 # file is ready. Which is why we want the background process to wait a bit first.
 udev_delayed_load() {
+	sleep 0.2
 	# Make sure the new device is writable:
-	sleep "$XPP_UDEV_SLEEP_TIME"
-	if [ ! -w "$DEVICE" ]; then
+	usb_dev_writable=0
+	for i in `seq $XPP_UDEV_SLEEP_TIME`; do
+		if [ -w "$DEVICE" ]; then
+			usb_dev_writable=1;
+			break;
+		fi
+		sleep 1
+	done
+	if [ $usb_dev_writable != 1 ]; then
+		$LOGGER "Device $DEVICE not writable. Can't load firmware."
 		return;
 	fi
 




More information about the svn-commits mailing list