From 64f628bf8a7b94073de14e34d70a2b23c955f1b0 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 17 May 2017 01:07:56 +0200 Subject: [PATCH] hantek-6xxx: Only list DC coupling once. Avoid incorrect indexing and the follow-up segfault. This fixes bug #822. --- src/hardware/hantek-6xxx/api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; } }