sr/drivers: fix off-by-one if frontend-initiated probe configuration

This commit is contained in:
Bert Vermeulen 2012-07-24 17:13:25 +02:00
parent d6a8df467d
commit b35c829306
6 changed files with 8 additions and 8 deletions

View 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;

View 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++) {

View 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;

View 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;
}

View 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)

View 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) {