hantek-6xxx: Only list DC coupling once.

Avoid incorrect indexing and the follow-up segfault.

This fixes bug #822.
This commit is contained in:
Uwe Hermann 2017-05-17 01:07:56 +02:00
parent 01dd7a4cc7
commit 64f628bf8a
1 changed files with 3 additions and 2 deletions

View File

@ -52,7 +52,7 @@ static const char *channel_names[] = {
}; };
static const char *dc_coupling[] = { static const char *dc_coupling[] = {
"DC", "DC", "DC",
}; };
static const char *acdc_coupling[] = { static const char *acdc_coupling[] = {
@ -385,7 +385,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
*data = g_variant_new("(tt)", vdiv[0], vdiv[1]); *data = g_variant_new("(tt)", vdiv[0], vdiv[1]);
break; break;
case SR_CONF_COUPLING: case SR_CONF_COUPLING:
*data = g_variant_new_string(devc->coupling_vals[devc->coupling[ch_idx]]); *data = g_variant_new_string((devc->coupling[ch_idx] \
== COUPLING_DC) ? "DC" : "AC");
break; break;
} }
} }