mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Irina Tirdea <irina.tirdea@intel.com>
To: Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>
Cc: linux-kernel@vger.kernel.org, Irina Tirdea <irina.tirdea@intel.com>
Subject: [PATCH v2 2/2] tools: iio: print error message when buffer enable fails
Date: Fri, 24 Jul 2015 16:28:06 +0300	[thread overview]
Message-ID: <1437744486-16456-3-git-send-email-irina.tirdea@intel.com> (raw)
In-Reply-To: <1437744486-16456-1-git-send-email-irina.tirdea@intel.com>

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>
---
 tools/iio/generic_buffer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index 32f389eb..9f7b85b 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);
-- 
1.9.1


  parent reply	other threads:[~2015-07-24 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 13:28 [PATCH v2 0/2] tools: iio: generic_buffer fixes Irina Tirdea
2015-07-24 13:28 ` [PATCH v2 1/2] tools: iio: fix mask for 32 bit sensor data Irina Tirdea
2015-08-02 17:38   ` Jonathan Cameron
2015-07-24 13:28 ` Irina Tirdea [this message]
2015-07-24 18:23   ` [PATCH v2 2/2] tools: iio: print error message when buffer enable fails Hartmut Knaack
2015-08-02 17:39     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437744486-16456-3-git-send-email-irina.tirdea@intel.com \
    --to=irina.tirdea@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®