Commit 916e89e4 authored by Hartmut Knaack's avatar Hartmut Knaack Committed by Jonathan Cameron

tools:iio:iio_event_monitor: refactor events output

Refactor the code in print_event() to reduce code duplication and better
reflect that the type is output unconditionally, as well as cascade the
dependency of the diff-channel. Saves a few lines of code, as well.
Signed-off-by: default avatarHartmut Knaack <knaack.h@gmx.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 0e799878
...@@ -213,23 +213,19 @@ static void print_event(struct iio_event_data *event) ...@@ -213,23 +213,19 @@ static void print_event(struct iio_event_data *event)
return; return;
} }
printf("Event: time: %lld, ", event->timestamp); printf("Event: time: %lld, type: %s", event->timestamp,
iio_chan_type_name_spec[type]);
if (mod != IIO_NO_MOD) { if (mod != IIO_NO_MOD)
printf("type: %s(%s), ", printf("(%s)", iio_modifier_names[mod]);
iio_chan_type_name_spec[type],
iio_modifier_names[mod]);
} else {
printf("type: %s, ",
iio_chan_type_name_spec[type]);
}
if (diff && chan >= 0 && chan2 >= 0) if (chan >= 0) {
printf("channel: %d-%d, ", chan, chan2); printf(", channel: %d", chan);
else if (chan >= 0) if (diff && chan2 >= 0)
printf("channel: %d, ", chan); printf("-%d", chan2);
}
printf("evtype: %s", iio_ev_type_text[ev_type]); printf(", evtype: %s", iio_ev_type_text[ev_type]);
if (dir != IIO_EV_DIR_NONE) if (dir != IIO_EV_DIR_NONE)
printf(", direction: %s", iio_ev_dir_text[dir]); printf(", direction: %s", iio_ev_dir_text[dir]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment