]> sigrok.org Git - libsigrok.git/commitdiff
fx2lafw: fix broken firmware upload timeout
authorBert Vermeulen <redacted>
Tue, 26 Jun 2012 23:02:39 +0000 (01:02 +0200)
committerBert Vermeulen <redacted>
Tue, 26 Jun 2012 23:02:39 +0000 (01:02 +0200)
Also corner case error init.

hardware/fx2lafw/fx2lafw.c

index 76c5019d1da3929e455699f380aa4f25e04bba63..2e88241ecfec61e0b17f71b5a4972172fcf578cf 100644 (file)
@@ -467,8 +467,7 @@ static int hw_dev_open(int dev_index)
         * If the firmware was recently uploaded, wait up to MAX_RENUM_DELAY_MS
         * milliseconds for the FX2 to renumerate.
         */
-       ret = 0;
-
+       ret = SR_ERR;
        if (ctx->fw_updated > 0) {
                sr_info("fx2lafw: Waiting for device to reset.");
                /* takes at least 300ms for the FX2 to be gone from the USB bus */
@@ -480,9 +479,8 @@ static int hw_dev_open(int dev_index)
                        g_usleep(100 * 1000);
 
                        timediff_us = g_get_monotonic_time() - ctx->fw_updated;
-                       timediff_ms = timediff_us / G_USEC_PER_SEC;
-                       sr_spew("fx2lafw: timediff: %" PRIi64 " us.",
-                               timediff_us);
+                       timediff_ms = timediff_us / 1000;
+                       sr_spew("fx2lafw: waited %" PRIi64 " ms", timediff_ms);
                }
                sr_info("fx2lafw: Device came back after %d ms.", timediff_ms);
        } else {