]> sigrok.org Git - libsigrok.git/commitdiff
ASIX Sigma: Fix firmware loading bug.
authorUwe Hermann <redacted>
Fri, 25 Mar 2011 12:44:16 +0000 (13:44 +0100)
committerUwe Hermann <redacted>
Fri, 25 Mar 2011 12:44:16 +0000 (13:44 +0100)
When no firmware file is found, return the right error code so sigrok
doesn't continue running with no firmware loaded.

Thanks Martin StensgĂ„rd <redacted> for the patch!

hardware/asix-sigma/asix-sigma.c

index 5b6417d9b8c1cbba135c8b4b045adabbb483a8da..3cd83d358a7b7a94e6228a1cb5e6ec6dc1ddca21 100644 (file)
@@ -1205,11 +1205,10 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        struct sr_datafeed_packet packet;
        struct sr_datafeed_header header;
        struct clockselect_50 clockselect;
-       int frac;
+       int frac, triggerpin, ret;
        uint8_t triggerselect;
        struct triggerinout triggerinout_conf;
        struct triggerlut lut;
-       int triggerpin;
 
        session_device_id = session_device_id;
 
@@ -1219,8 +1218,10 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        sigma = sdi->priv;
 
        /* If the samplerate has not been set, default to 200 KHz. */
-       if (sigma->cur_firmware == -1)
-               set_samplerate(sdi, SR_KHZ(200));
+       if (sigma->cur_firmware == -1) {
+               if ((ret = set_samplerate(sdi, SR_KHZ(200))) != SR_OK)
+                       return ret;
+       }
 
        /* Enter trigger programming mode. */
        sigma_set_register(WRITE_TRIGGER_SELECT1, 0x20, sigma);