Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: event_monitor: report unsupported events

This makes the event monitor bail out with a helpful error
message if a device does not support events, as a related
fix to iio core now makes it return -ENODEV properly.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Linus Walleij and committed by
Jonathan Cameron
672f93b6 a0175b9c

+5 -1
+5 -1
tools/iio/iio_event_monitor.c
··· 284 284 ret = ioctl(fd, IIO_GET_EVENT_FD_IOCTL, &event_fd); 285 285 if (ret == -1 || event_fd == -1) { 286 286 ret = -errno; 287 - fprintf(stderr, "Failed to retrieve event fd\n"); 287 + if (ret == -ENODEV) 288 + fprintf(stderr, 289 + "This device does not support events\n"); 290 + else 291 + fprintf(stderr, "Failed to retrieve event fd\n"); 288 292 if (close(fd) == -1) 289 293 perror("Failed to close character device file"); 290 294