summaryrefslogtreecommitdiff
path: root/xpp/utils/xpp_fxloader
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/utils/xpp_fxloader')
-rw-r--r--xpp/utils/xpp_fxloader14
1 files changed, 14 insertions, 0 deletions
diff --git a/xpp/utils/xpp_fxloader b/xpp/utils/xpp_fxloader
index 8c54370..b14f746 100644
--- a/xpp/utils/xpp_fxloader
+++ b/xpp/utils/xpp_fxloader
@@ -75,6 +75,17 @@ REENUM_SLEEP_TIME=3 # only used on manual runs
FPGA_LOAD="/usr/sbin/fpga_load"
+# With Kernels older that 2.6.10 it seems to be possible
+# to trigger a race condition by running fxload or fpga_load
+# immediately after the detection of the device.
+KERNEL_HAS_USB_RACE=0
+case "`uname -r`" in 2.6.[89]*) KERNEL_HAS_USB_RACE=1;; esac
+sleep_if_race() {
+ if [ "$KERNEL_HAS_USB_RACE" = '1' ]; then
+ sleep 2
+ fi
+}
+
find_dev() {
v_id=$1
p_id=$2
@@ -83,6 +94,7 @@ find_dev() {
}
do_fxload() {
+ sleep_if_race
( fxload -t fx2 $* 2>&1 1>/dev/null || exit 1 ) | $LOGGER
}
@@ -120,6 +132,7 @@ load_fpga() {
firm_ver=`hexfile_version $FIRMWARE_DIR/$fw`
$LOGGER "FPGA Firmware $FIRMWARE_DIR/$fw into $dev"
+ sleep_if_race
$FPGA_LOAD -D "$dev" -I "$FIRMWARE_DIR/$fw" 2>&1 >/dev/null | $LOGGER
status=$PIPESTATUS
if [ $status != 0 ]; then
@@ -193,6 +206,7 @@ then
else
FIRM_FPGA="$FIRMWARE_DIR/FPGA_$prod_id.hex"
fi
+ sleep_if_race
$FPGA_LOAD -D "$DEVICE" -I "$FIRM_FPGA" 2>&1 >/dev/null | $LOGGER
;;
esac