From d27b264360563c5d32e5e0647a1a461786534d83 Mon Sep 17 00:00:00 2001 From: Dan Nechita Date: Wed, 22 Jan 2025 11:57:05 +0200 Subject: [PATCH] iio-monitor: Display the channel label if it exists Signed-off-by: Dan Nechita --- examples/iio-monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/iio-monitor.c b/examples/iio-monitor.c index 1500c39dc..29c14e583 100644 --- a/examples/iio-monitor.c +++ b/examples/iio-monitor.c @@ -165,7 +165,7 @@ static void * read_thd(void *d) while (!stop) { struct iio_device *dev; - const char *name; + const char *name, *label; int row, col, len, align, line = 2; unsigned int i, nb_channels, nb = 0; char buf[1024]; @@ -208,9 +208,12 @@ static void * read_thd(void *d) nb++; name = iio_channel_get_name(chn); + label = iio_channel_get_label(chn); id = iio_channel_get_id(chn); if (!name) name = id; + if (label) + name = label; unit = id_to_unit(id); iio_snprintf(buf, sizeof(buf), "%s",