summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-07-21 15:56:17 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-07-21 15:56:17 +0000
commit4f07db9e92ba13294cd9c163d8a5071551449be0 (patch)
treed2fccc4936d312e6980143586ae6d31dff3afc21
parent8215e5443e44e007ed9d85a91ed998976a678d8d (diff)
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. Merged revisions 8951 via svnmerge from http://svn.digium.com/svn/dahdi/tools/trunk git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/branches/2.3@8963 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--xpp/xpp_fxloader15
1 files changed, 12 insertions, 3 deletions
diff --git a/xpp/xpp_fxloader b/xpp/xpp_fxloader
index 943adcd..0287032 100644
--- a/xpp/xpp_fxloader
+++ b/xpp/xpp_fxloader
@@ -67,7 +67,7 @@ USB_PREFIX=
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 @@ fi
# 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