linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alin Arhip <alin.g.arhip@intel.com>
To: jic23@kernel.org
Cc: knaack.h@gmx.de, lars@metafoo.de, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Alin Gabriel Arhip <alin.g.arhip@intel.com>
Subject: [PATCH] tools: iio: Add help option for generic_buffer
Date: Fri, 27 Mar 2015 14:42:19 +0200	[thread overview]
Message-ID: <1427460139-5136-1-git-send-email-alin.g.arhip@intel.com> (raw)

From: Alin Gabriel Arhip <alin.g.arhip@intel.com>

This patch adds usage instructions and -h parameter to view available
command line parameters.

Signed-off-by: Alin Gabriel Arhip <alin.g.arhip@intel.com>
---
 tools/iio/generic_buffer.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index 8f8f058..8dd77ac 100644
--- a/tools/iio/generic_buffer.c
+++ b/tools/iio/generic_buffer.c
@@ -166,7 +166,17 @@ int main(int argc, char **argv)
 
 	struct iio_channel_info *channels;
 
-	while ((c = getopt(argc, argv, "l:w:c:et:n:g")) != -1) {
+	if (argc <= 1) {
+		printf("Usage: %s -n <device_name> -t <trigger_name>\n"
+			"\tIf trigger name is not specified the program\n"
+			"\tassumes you want a dataready trigger associated\n"
+			"\twith the device and goes looking for it.\n"
+			"\tUse -h to see available command line parameters.\n",
+			argv[0]);
+		return -1;
+	}
+
+	while ((c = getopt(argc, argv, "l:w:c:et:n:gh")) != -1) {
 		switch (c) {
 		case 'n':
 			device_name = optarg;
@@ -190,7 +200,15 @@ int main(int argc, char **argv)
 		case 'g':
 			notrigger = 1;
 			break;
-		case '?':
+		case '?': case 'h':
+			printf("Usage: %s -n <device_name> to set device name\n"
+				"\t-t <trigger_name> to set trigger name\n"
+				"\t-e to set noevents to 1\n"
+				"\t-c <num_loops> to set number of loops\n"
+				"\t-w <timedelay> to set time delay\n"
+				"\t-l <buf_len> to set buffer length\n"
+				"\t-g to set notrigger to 1\n"
+				"\t-h to see this help\n", argv[0]);
 			return -1;
 		}
 	}
-- 
1.9.1


             reply	other threads:[~2015-03-27 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 12:42 Alin Arhip [this message]
2015-03-28 11:11 ` [PATCH] tools: iio: Add help option for generic_buffer 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=1427460139-5136-1-git-send-email-alin.g.arhip@intel.com \
    --to=alin.g.arhip@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.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;
as well as URLs for NNTP newsgroup(s).