* [PATCH] iio: tools: make generic_buffer look for "-trigger"
@ 2016-03-24 8:39 Linus Walleij
2016-03-28 10:16 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2016-03-24 8:39 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio; +Cc: Linus Walleij
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 <linus.walleij@linaro.org>
---
tools/iio/generic_buffer.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
index 01c4f67801e0..c42b7f836b48 100644
--- a/tools/iio/generic_buffer.c
+++ b/tools/iio/generic_buffer.c
@@ -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",
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: tools: make generic_buffer look for "-trigger"
2016-03-24 8:39 [PATCH] iio: tools: make generic_buffer look for "-trigger" Linus Walleij
@ 2016-03-28 10:16 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2016-03-28 10:16 UTC (permalink / raw)
To: Linus Walleij, linux-iio
On 24/03/16 08:39, Linus Walleij wrote:
> 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 <linus.walleij@linaro.org>
It is a bit ugly to do the find_trigger_by_name call twice, but I couldn't
find a cleaner way of doing it either, so fair enough.
Applied to the togreg branch of iio.git. Initially pushed out as testing
for the autobuilders to play with it (possibly - adding tools/iio has been
requested and they weren't against it...)
Jonathan
> ---
> tools/iio/generic_buffer.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
> index 01c4f67801e0..c42b7f836b48 100644
> --- a/tools/iio/generic_buffer.c
> +++ b/tools/iio/generic_buffer.c
> @@ -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",
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-28 10:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 8:39 [PATCH] iio: tools: make generic_buffer look for "-trigger" Linus Walleij
2016-03-28 10:16 ` Jonathan Cameron
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).