]> sigrok.org Git - libsigrok.git/commitdiff
sr/drivers: fix off-by-one if frontend-initiated probe configuration
authorBert Vermeulen <redacted>
Tue, 24 Jul 2012 15:13:25 +0000 (17:13 +0200)
committerBert Vermeulen <redacted>
Fri, 3 Aug 2012 09:29:00 +0000 (11:29 +0200)
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/driver.c
hardware/fx2lafw/fx2lafw.c
hardware/hantek-dso/api.c
hardware/openbench-logic-sniffer/ols.c
hardware/zeroplus-logic-cube/zeroplus.c

index ea12da8b863caf82abdc872ecb0e9c8f42c24723..5cb6130c29ae8723bbbab76ae310228848314a6b 100644 (file)
@@ -683,7 +683,7 @@ static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
 
        for (l = probes; l; l = l->next) {
                probe = (struct sr_probe *)l->data;
-               probebit = 1 << (probe->index - 1);
+               probebit = 1 << (probe->index);
 
                if (!probe->enabled || !probe->trigger)
                        continue;
index 168bb73a049e5e415006877e686287bc9147c5b2..2b697bbb27953f7fe2971413db1b1a36b5ba0f5f 100644 (file)
@@ -354,7 +354,7 @@ SR_PRIV int configure_probes(struct context *ctx, const GSList *probes)
                        return SR_ERR;
                }
 
-               probe_bit = (1 << (probe->index - 1));
+               probe_bit = (1 << (probe->index));
 
                /* Configure the probe's trigger mask and trigger pattern. */
                for (tc = probe->trigger; tc && *tc; tc++) {
index 3e67c5f54e31ee47d75f012655e60999c8958831..4863da5ef22b7b5798c40789b657fb59e1b4423e 100644 (file)
@@ -315,10 +315,10 @@ static int configure_probes(struct context *ctx, GSList *probes)
                if (probe->enabled == FALSE)
                        continue;
 
-               if (probe->index > 8)
+               if (probe->index > 7)
                        ctx->sample_wide = TRUE;
 
-               probe_bit = 1 << (probe->index - 1);
+               probe_bit = 1 << (probe->index);
                if (!(probe->trigger))
                        continue;
 
index 72f7079365b627dda049cb796d750047d141ce9f..fbb84760386b3e9ab58e9e7e44e134e69ec9bc02 100644 (file)
@@ -193,9 +193,9 @@ static int configure_probes(struct context *ctx, const GSList *probes)
        ctx->ch1_enabled = ctx->ch2_enabled = FALSE;
        for (l = probes; l; l = l->next) {
                probe = (struct sr_probe *)l->data;
-               if (probe->index == 1)
+               if (probe->index == 0)
                        ctx->ch1_enabled = probe->enabled;
-               else if (probe->index == 2)
+               else if (probe->index == 1)
                        ctx->ch2_enabled = probe->enabled;
        }
 
index d0fb487890a0d0f98d76390176df484bc77e3598..970f779331b84e29e8a9431d7aad02dba4ab9715 100644 (file)
@@ -154,7 +154,7 @@ static int configure_probes(struct context *ctx, const GSList *probes)
                 * Set up the probe mask for later configuration into the
                 * flag register.
                 */
-               probe_bit = 1 << (probe->index - 1);
+               probe_bit = 1 << (probe->index);
                ctx->probe_mask |= probe_bit;
 
                if (!probe->trigger)
index 07f38366203da11ea2ff772fcee647c03b8db33b..683203aef28630a8ba69722eefdf98abbe91f7d9 100644 (file)
@@ -203,7 +203,7 @@ static int configure_probes(const struct sr_dev_inst *sdi, const GSList *probes)
                probe = (struct sr_probe *)l->data;
                if (probe->enabled == FALSE)
                        continue;
-               probe_bit = 1 << (probe->index - 1);
+               probe_bit = 1 << (probe->index);
                ctx->probe_mask |= probe_bit;
 
                if (probe->trigger) {