]> sigrok.org Git - libsigrok.git/commitdiff
sr: fx2lafw: Move empty_transfer_count to device ctx
authorLars-Peter Clausen <redacted>
Mon, 25 Jun 2012 21:51:38 +0000 (23:51 +0200)
committerUwe Hermann <redacted>
Wed, 27 Jun 2012 22:40:52 +0000 (00:40 +0200)
If one device is failing it should not affect the transfers of other devices.

Signed-off-by: Lars-Peter Clausen <redacted>
hardware/fx2lafw/fx2lafw.c
hardware/fx2lafw/fx2lafw.h

index 904347969803036ed31729939ac2ec4ba7ee9b9c..53a2e09f025c03f0563fa1b9e75e75b20c5f6a57 100644 (file)
@@ -708,8 +708,6 @@ static void resubmit_transfer(struct libusb_transfer *transfer)
 
 static void receive_transfer(struct libusb_transfer *transfer)
 {
 
 static void receive_transfer(struct libusb_transfer *transfer)
 {
-       /* TODO: These statics have to move to the ctx struct. */
-       static int empty_transfer_count = 0;
        gboolean packet_has_error = FALSE;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
        gboolean packet_has_error = FALSE;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_logic logic;
@@ -747,8 +745,8 @@ static void receive_transfer(struct libusb_transfer *transfer)
        }
 
        if (transfer->actual_length == 0 || packet_has_error) {
        }
 
        if (transfer->actual_length == 0 || packet_has_error) {
-               empty_transfer_count++;
-               if (empty_transfer_count > MAX_EMPTY_TRANSFERS) {
+               ctx->empty_transfer_count++;
+               if (ctx->empty_transfer_count > MAX_EMPTY_TRANSFERS) {
                        /*
                         * The FX2 gave up. End the acquisition, the frontend
                         * will work out that the samplecount is short.
                        /*
                         * The FX2 gave up. End the acquisition, the frontend
                         * will work out that the samplecount is short.
@@ -760,7 +758,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
                }
                return;
        } else {
                }
                return;
        } else {
-               empty_transfer_count = 0;
+               ctx->empty_transfer_count = 0;
        }
 
        trigger_offset = 0;
        }
 
        trigger_offset = 0;
@@ -902,6 +900,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data)
        ctx = sdi->priv;
        ctx->session_dev_id = cb_data;
        ctx->num_samples = 0;
        ctx = sdi->priv;
        ctx->session_dev_id = cb_data;
        ctx->num_samples = 0;
+       ctx->empty_transfer_count = 0;
 
        const unsigned int timeout = get_timeout(ctx);
        const unsigned int num_transfers = get_number_of_transfers(ctx);
 
        const unsigned int timeout = get_timeout(ctx);
        const unsigned int num_transfers = get_number_of_transfers(ctx);
index c6ad3ce11d28afb87fcb4f90e8fffd6d7536e71b..727c0fa6d8b9147ba692bf808f0296cfc29c125c 100644 (file)
@@ -84,6 +84,7 @@ struct context {
 
        int num_samples;
        int submitted_transfers;
 
        int num_samples;
        int submitted_transfers;
+       int empty_transfer_count;
 
        void *session_dev_id;
 
 
        void *session_dev_id;