Skip to content

Commit

Permalink
iio: generic_buffer: Fix --trigger-num option
Browse files Browse the repository at this point in the history
Initialize trig_num to -1 and handle trig_num=0 as a valid id.

Fixes: 7c7e9da (iio: iio_generic_buffer: Add --trigger-num option)
Signed-off-by: Crestez Dan Leonard <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
Crestez Dan Leonard authored and jic23 committed Jun 11, 2016
1 parent b915507 commit deb4d1f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/iio/iio_generic_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ int main(int argc, char **argv)

char *data = NULL;
ssize_t read_size;
int dev_num = -1, trig_num;
int dev_num = -1, trig_num = -1;
char *buffer_access = NULL;
int scan_size;
int noevents = 0;
Expand Down Expand Up @@ -456,7 +456,7 @@ int main(int argc, char **argv)

if (notrigger) {
printf("trigger-less mode selected\n");
} if (trig_num > 0) {
} if (trig_num >= 0) {
char *trig_dev_name;
ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num);
if (ret < 0) {
Expand Down

0 comments on commit deb4d1f

Please sign in to comment.