Skip to content

Commit

Permalink
iio: tools: make generic_buffer look for "-trigger"
Browse files Browse the repository at this point in the history
All the ST Sensors use the old "<foo>-trigger" rather than the
standard "<foo>-devN" new standard suffix for triggers. Now much
to do about it since it is ABI, but make the testing tools
recognize it too.

Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
linusw authored and jic23 committed Apr 3, 2016
1 parent fb12b6c commit 793d6b5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tools/iio/generic_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,19 @@ int main(int argc, char **argv)
}
}

/* Verify the trigger exists */
/* Look for this "-devN" trigger */
trig_num = find_type_by_name(trigger_name, "trigger");
if (trig_num < 0) {
/* OK try the simpler "-trigger" suffix instead */
free(trigger_name);
ret = asprintf(&trigger_name,
"%s-trigger", device_name);
if (ret < 0) {
ret = -ENOMEM;
goto error_free_dev_dir_name;
}
}

trig_num = find_type_by_name(trigger_name, "trigger");
if (trig_num < 0) {
fprintf(stderr, "Failed to find the trigger %s\n",
Expand Down

0 comments on commit 793d6b5

Please sign in to comment.