Passing the trigger-less mode option on the command line causes
iio_generic_buffer to fail searching for an IIO trigger.
Fix this by skipping trigger initialization if trigger-less mode is
requested.
Technically it actually fixes:
7c7e9dad70 where the bug was introduced but as the window to the patch
below that changes the context was very small let's mark it with that.
Signed-off-by: Gregor Boirie <[email protected]>
Fixes: deb4d1fdcb ("iio: generic_buffer: Fix --trigger-num option")
Signed-off-by: Jonathan Cameron <[email protected]>
Uninitialized channel pointer causes segmentation fault when we
call free(channel) during cleanup() with no channels initialized.
This happens when you exit early for usage errors. Initialize
the pointer to NULL when it is declared.
Signed-off-by: Alison Schofield <[email protected]>
Cc: Daniel Baluta <[email protected]>
Tested-by: Gregor Boirie <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Initialize trig_num to -1 and handle trig_num=0 as a valid id.
Fixes: 7c7e9dad (iio: iio_generic_buffer: Add --trigger-num option)
Signed-off-by: Crestez Dan Leonard <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
This makes it possible to distinguish between iio devices with the same
name.
Signed-off-by: Crestez Dan Leonard <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
This will clean (disable buffer/trigger/channels) when doing
something like a CTRL-C. Otherwise restarting generic_buffer requires a
manual echo 0 > buffer/enable
This also cleanup up all the code freeing string buffers at
the end of main. We initialize all pointers to NULL so that cleanup can
all be done under a single error label.
Signed-off-by: Crestez Dan Leonard <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
This makes it clear that generic_buffer is an IIO tool
and also complies with filename conventions in tools/iio.
Signed-off-by: Daniel Baluta <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>