From: Gerhard Sittig Date: Sun, 30 Sep 2018 02:36:39 +0000 (+0200) Subject: serial-dmm: count analog DMM channels starting at 1 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=48e2992f8684ece7200fc9aabc2bf45625be8ef0 serial-dmm: count analog DMM channels starting at 1 Commit 556a926d432dd introduced support for multiple displays in subdrivers of serial-dmm, but also changed user visible channel numbers to start from 0. Restore the previous behaviour, start counting from 1 which users may perceive as more natural (serial-dmm used to start at P1 in the past, scopes start with CH1 as well). --- diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index 04053181..88e3b88a 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -137,7 +137,9 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) if (dmm->packet_parse == sr_metex14_4packets_parse) dmm->channel_count = 4; for (ch_idx = 0; ch_idx < dmm->channel_count; ch_idx++) { - snprintf(ch_name, sizeof(ch_name), "P%zu", ch_idx); + size_t ch_num; + ch_num = ch_idx + 1; + snprintf(ch_name, sizeof(ch_name), "P%zu", ch_num); sr_channel_new(sdi, ch_idx, SR_CHANNEL_ANALOG, TRUE, ch_name); } devices = g_slist_append(devices, sdi);