[dahdi-commits] tzafrir: branch tools/2.3 r8624 - in /tools/branches/2.3: ./ xpp/xpp_fxloader

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Sat May 15 16:24:25 CDT 2010


Author: tzafrir
Date: Sat May 15 16:24:19 2010
New Revision: 8624

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8624
Log:
Load xpp firmware in the background (udev)

Move loading the the xpp firmwares (when called from udev) to a background
sub-process. This helps with:
* Don't block udev
* It seems that with older systems (e.g. CentOS 5) we need to wait a bit
  for the device file to appear (in one of the upcoming udev events). If we
  keep blocking udev, we won't have the device file.

Merged revisions 8580 via svnmerge from 
http://svn.digium.com/svn/dahdi/tools/trunk

Modified:
    tools/branches/2.3/   (props changed)
    tools/branches/2.3/xpp/xpp_fxloader

Propchange: tools/branches/2.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat May 15 16:24:19 2010
@@ -1,1 +1,1 @@
-/tools/trunk:8529,8535,8589
+/tools/trunk:8529,8535,8580,8589

Propchange: tools/branches/2.3/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat May 15 16:24:19 2010
@@ -1,1 +1,1 @@
-/tools/trunk:1-8509,8528-8529,8535,8589
+/tools/trunk:1-8509,8528-8529,8535,8580,8589

Modified: tools/branches/2.3/xpp/xpp_fxloader
URL: http://svnview.digium.com/svn/dahdi/tools/branches/2.3/xpp/xpp_fxloader?view=diff&rev=8624&r1=8623&r2=8624
==============================================================================
--- tools/branches/2.3/xpp/xpp_fxloader (original)
+++ tools/branches/2.3/xpp/xpp_fxloader Sat May 15 16:24:19 2010
@@ -67,6 +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}"
 
 USB_FW="${USB_FW:-USB_FW.hex}"
 
@@ -313,8 +314,23 @@
 	exit 0
 fi
 
-if [ "$ACTION" = "add" ] && [ -w "$DEVICE" ]
-then
+if [ "$ACTION" != add ]; then
+	exit 0;
+fi
+
+# This procedure is run in the background to do the actual work of loading the
+# firmware. Running it in the background allows udev to continue doing other tasks
+# and thus provide a faster startup.
+#
+# 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() {
+	# Make sure the new device is writable:
+	sleep "$XPP_UDEV_SLEEP_TIME"
+	if [ ! -w "$DEVICE" ]; then
+		return;
+	fi
+
 	$LOGGER "Trying to find what to do for product $PRODUCT, device $DEVICE"
 	prod_id=`echo "$PRODUCT" | cut -d/ -f2`
 	case "$PRODUCT" in
@@ -333,4 +349,7 @@
 		load_fw_device "$DEVICE" "$FIRM_FPGA"
 		;;
 	esac	
-fi
+}
+
+udev_delayed_load &
+




More information about the dahdi-commits mailing list