diff options
author | Irina Tirdea <irina.tirdea@intel.com> | 2015-07-24 16:28:06 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-08-02 18:39:27 +0100 |
commit | e7231491ce6ae2053569166f60835a5594b3c0af (patch) | |
tree | 9ee0a10bd8c495902cf87390a79f8b922f6a3ee2 /tools | |
parent | ae067cb68d2ef42d4a84eeaf07411fe2936f48c4 (diff) |
tools: iio: print error message when buffer enable fails
Running generic_buffer without enabling any channel of the
sensor will fail without printing any error message.
Add an error message that indicates buffer enable failed.
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/iio/generic_buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 32f389ebb94d..9f7b85bf6ada 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -364,8 +364,11 @@ int main(int argc, char **argv) /* Enable the buffer */ ret = write_sysfs_int("enable", buf_dir_name, 1); - if (ret < 0) + if (ret < 0) { + fprintf(stderr, + "Failed to enable buffer: %s\n", strerror(-ret)); goto error_free_buf_dir_name; + } scan_size = size_from_channelarray(channels, num_channels); data = malloc(scan_size * buf_len); |