diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-07-20 19:32:33 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-07-20 19:32:33 +0000 |
commit | 7fe310970cf140f769fcf1d1cd812e225818bb0a (patch) | |
tree | e1fc55b94a6db5511492d088d03329df7728b06d | |
parent | 313ddef3118e388c02f2d78db96dc12693627dc1 (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.
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@8951 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | xpp/xpp_fxloader | 15 |
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 |