sr/drivers: fix off-by-one if frontend-initiated probe configuration
This commit is contained in:
parent
d6a8df467d
commit
b35c829306
|
@ -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;
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue