From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>, linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Roberta Dobrescu <roberta.dobrescu@gmail.com>,
Daniel Baluta <daniel.baluta@intel.com>,
Irina Tirdea <irina.tirdea@intel.com>
Subject: Re: [PATCH 29/32] tools:iio: rework program parameters
Date: Mon, 01 Jun 2015 08:40:00 +0100 [thread overview]
Message-ID: <556C0C50.2040505@kernel.org> (raw)
In-Reply-To: <cd3645ea3071573bbdc97304943ed16f5b712d6f.1433072539.git.knaack.h@gmx.de>
On 31/05/15 13:40, Hartmut Knaack wrote:
> In generic_buffer.c: sort program parameters alphabetically and provide
> usage information
> In lsiio.c: drop unused parameters
>
> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Applied.
> ---
> tools/iio/generic_buffer.c | 55 ++++++++++++++++++++++++++++++----------------
> tools/iio/lsiio.c | 6 ++---
> 2 files changed, 38 insertions(+), 23 deletions(-)
>
> diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
> index f17b168..c546852 100644
> --- a/tools/iio/generic_buffer.c
> +++ b/tools/iio/generic_buffer.c
> @@ -168,6 +168,19 @@ void process_scan(char *data,
> printf("\n");
> }
>
> +void print_usage(void)
> +{
> + printf("Usage: generic_buffer [options]...\n"
> + "Capture, convert and output data from IIO device buffer\n"
> + " -c <n> Do n conversions\n"
> + " -e Disable wait for event (new data)\n"
> + " -g Use trigger-less mode\n"
> + " -l <n> Set buffer length to n samples\n"
> + " -n <name> Set device name (mandatory)\n"
> + " -t <name> Set trigger name\n"
> + " -w <n> Set delay between reads in us (event-less mode)\n");
> +}
> +
> int main(int argc, char **argv)
> {
> unsigned long num_loops = 2;
> @@ -193,29 +206,19 @@ int main(int argc, char **argv)
>
> struct iio_channel_info *channels;
>
> - while ((c = getopt(argc, argv, "l:w:c:et:n:g")) != -1) {
> + while ((c = getopt(argc, argv, "c:egl:n:t:w:")) != -1) {
> switch (c) {
> - case 'n':
> - device_name = optarg;
> - break;
> - case 't':
> - trigger_name = optarg;
> - datardytrigger = 0;
> - break;
> - case 'e':
> - noevents = 1;
> - break;
> case 'c':
> errno = 0;
> num_loops = strtoul(optarg, &dummy, 10);
> if (errno)
> return -errno;
> break;
> - case 'w':
> - errno = 0;
> - timedelay = strtoul(optarg, &dummy, 10);
> - if (errno)
> - return -errno;
> + case 'e':
> + noevents = 1;
> + break;
> + case 'g':
> + notrigger = 1;
> break;
> case 'l':
> errno = 0;
> @@ -223,16 +226,30 @@ int main(int argc, char **argv)
> if (errno)
> return -errno;
> break;
> - case 'g':
> - notrigger = 1;
> + case 'n':
> + device_name = optarg;
> + break;
> + case 't':
> + trigger_name = optarg;
> + datardytrigger = 0;
> + break;
> + case 'w':
> + errno = 0;
> + timedelay = strtoul(optarg, &dummy, 10);
> + if (errno)
> + return -errno;
> break;
> case '?':
> + print_usage();
> return -1;
> }
> }
>
> - if (device_name == NULL)
> + if (device_name == NULL) {
> + printf("Device name not set\n");
> + print_usage();
> return -1;
> + }
>
> /* Find the device requested */
> dev_num = find_type_by_name(device_name, "iio:device");
> diff --git a/tools/iio/lsiio.c b/tools/iio/lsiio.c
> index b1089ad..b59ee17 100644
> --- a/tools/iio/lsiio.c
> +++ b/tools/iio/lsiio.c
> @@ -164,7 +164,7 @@ int main(int argc, char **argv)
> {
> int c, err = 0;
>
> - while ((c = getopt(argc, argv, "d:D:v")) != EOF) {
> + while ((c = getopt(argc, argv, "v")) != EOF) {
> switch (c) {
> case 'v':
> verblevel++;
> @@ -179,9 +179,7 @@ int main(int argc, char **argv)
> if (err || argc > optind) {
> fprintf(stderr, "Usage: lsiio [options]...\n"
> "List industrial I/O devices\n"
> - " -v, --verbose\n"
> - " Increase verbosity (may be given multiple times)\n"
> - );
> + " -v Increase verbosity (may be given multiple times)\n");
> exit(1);
> }
>
>
next prev parent reply other threads:[~2015-06-01 21:17 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-31 12:39 [PATCH 00/32] iio-tools out-of-staging cleanup Hartmut Knaack
2015-05-31 12:39 ` [PATCH 01/32] tools:iio:generic_buffer: fix order of freeing data Hartmut Knaack
2015-05-31 16:13 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 02/32] tools:iio:generic_buffer: free dev_dir_name on exit Hartmut Knaack
2015-05-31 16:17 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 03/32] tools:iio:iio_utils: free scan_el_dir " Hartmut Knaack
2015-05-31 16:19 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 04/32] tools:iio: free channel-array completely Hartmut Knaack
2015-05-31 16:20 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 05/32] tools:iio:iio_utils: fix allocation handling Hartmut Knaack
2015-05-31 16:23 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 06/32] tools:iio:generic_buffer: add check before free Hartmut Knaack
2015-05-31 16:29 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 07/32] tools:iio:lsiio: add closedir before exit Hartmut Knaack
2015-05-31 16:30 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 08/32] tools:iio: save errno first Hartmut Knaack
2015-05-31 16:33 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 09/32] tools:iio:iio_event_monitor: save right errno Hartmut Knaack
2015-05-31 16:34 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 10/32] tools:iio:generic_buffer: fix check of errno Hartmut Knaack
2015-05-31 16:35 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 11/32] tools:iio:generic_buffer: pass up right error code Hartmut Knaack
2015-05-31 16:36 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 12/32] tools:iio:generic_buffer: sign-extend and shift data Hartmut Knaack
2015-05-31 16:41 ` Jonathan Cameron
2015-05-31 12:39 ` [PATCH 13/32] tools:iio:iio_utils: check amount of matches Hartmut Knaack
2015-05-31 16:41 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 14/32] tools:iio:iio_utils: implement digit calculation Hartmut Knaack
2015-05-31 18:19 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 15/32] tools:iio:iio_utils: mark private function static Hartmut Knaack
2015-05-31 12:40 ` [PATCH 16/32] tools:iio: catch errors in string allocation Hartmut Knaack
2015-05-31 18:21 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 17/32] tools:iio:generic_buffer: catch errors for arguments conversion Hartmut Knaack
2015-05-31 12:40 ` [PATCH 18/32] tools:iio:generic_buffer: add error handling Hartmut Knaack
2015-05-31 12:40 ` [PATCH 19/32] tools:iio:iio_event_monitor: " Hartmut Knaack
2015-05-31 18:25 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 20/32] tools:iio:iio_event_monitor: check if event is fully read Hartmut Knaack
2015-05-31 18:36 ` Jonathan Cameron
2015-06-01 22:00 ` Hartmut Knaack
2015-05-31 12:40 ` [PATCH 21/32] tools:iio:iio_utils: add error handling Hartmut Knaack
2015-05-31 18:44 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 22/32] tools:iio:lsiio: " Hartmut Knaack
2015-05-31 18:45 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 23/32] tools:iio:iio_utils: add missing documentation Hartmut Knaack
2015-06-01 7:33 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 24/32] tools:iio: return values directly Hartmut Knaack
2015-06-01 7:34 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 25/32] tools:iio:iio_event_monitor: refactor events output Hartmut Knaack
2015-06-01 7:34 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 26/32] tools:iio:iio_utils: refactor assignment of is_signed Hartmut Knaack
2015-06-01 7:35 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 27/32] tools:iio:iio_utils: move up reset of sysfsfp Hartmut Knaack
2015-06-01 7:37 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 28/32] tools:iio:iio_utils: initialize count during declaration Hartmut Knaack
2015-06-01 7:38 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 29/32] tools:iio: rework program parameters Hartmut Knaack
2015-06-01 7:40 ` Jonathan Cameron [this message]
2015-05-31 12:40 ` [PATCH 30/32] tools:iio:iio_utils: pass strings as const Hartmut Knaack
2015-06-01 7:40 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 31/32] tools:iio: adjust coding style Hartmut Knaack
2015-06-01 7:46 ` Jonathan Cameron
2015-05-31 12:40 ` [PATCH 32/32] tools:iio: rename variables Hartmut Knaack
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=556C0C50.2040505@kernel.org \
--to=jic23@kernel.org \
--cc=daniel.baluta@intel.com \
--cc=irina.tirdea@intel.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=roberta.dobrescu@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.