From: Uwe Hermann Date: Tue, 16 May 2017 23:07:56 +0000 (+0200) Subject: hantek-6xxx: Only list DC coupling once. X-Git-Tag: libsigrok-0.5.0~62 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=64f628bf8a7b94073de14e34d70a2b23c955f1b0;p=libsigrok.git hantek-6xxx: Only list DC coupling once. Avoid incorrect indexing and the follow-up segfault. This fixes bug #822. --- diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index c05290be..08062add 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -52,7 +52,7 @@ static const char *channel_names[] = { }; static const char *dc_coupling[] = { - "DC", "DC", + "DC", }; 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]); break; 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; } }