summaryrefslogtreecommitdiffstats
path: root/tools/iio
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-05-31 14:40:22 +0200
committerJonathan Cameron <jic23@kernel.org>2015-06-01 08:38:40 +0100
commite06e3d7112f2ec5494d2d934a8641a53885003ee (patch)
tree1f9fe8f625a728d9ab7011bed9d896bdaebdd2b6 /tools/iio
parent1e7c34788de3c0e5b18b6f27c42c191da5811c74 (diff)
downloadblackbird-obmc-linux-e06e3d7112f2ec5494d2d934a8641a53885003ee.tar.gz
blackbird-obmc-linux-e06e3d7112f2ec5494d2d934a8641a53885003ee.zip
tools:iio: rework program parameters
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> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'tools/iio')
-rw-r--r--tools/iio/generic_buffer.c55
-rw-r--r--tools/iio/lsiio.c6
2 files changed, 38 insertions, 23 deletions
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index 62ec398922a0..4eebb6616e5c 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 b1089adb7d3a..b59ee1733924 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);
}
OpenPOWER on IntegriCloud