Skip to content

Commit

Permalink
iio-monitor: Display the channel label if it exists
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Nechita <[email protected]>
  • Loading branch information
dNechita committed Jan 22, 2025
1 parent 30044cf commit 066d1ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/iio-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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), "</%u></B>%s<!B><!%u>",
Expand Down

0 comments on commit 066d1ef

Please sign in to comment.