linux/tools/iio
Alexandru Ardelean 8827faab2c tools: iio: convert iio_generic_buffer to use new IIO buffer API
This change makes use of the new IIO buffer API to read data from an IIO
buffer.
It doesn't read the /sys/bus/iio/devices/iio:deviceX/scan_elements dir
anymore, it reads /sys/bus/iio/devices/iio:deviceX/bufferY, where all the
scan_elements have been merged together with the old/classical buffer
attributes.

And it makes use of the new IIO_BUFFER_GET_FD_IOCTL ioctl to get an FD for
the IIO buffer for which to read data from.
It also does a quick sanity check to see that -EBUSY is returned if reading
the chardev after the ioctl() has succeeded.

This was tested with the following cases:
 1. Tested buffer0 works with ioctl()
 2. Tested that buffer0 can't be opened via /dev/iio:deviceX after ioctl()
    This check should be omitted under normal operation; it's being done
    here to check that the driver change is sane
 3. Moved valid buffer0 to be buffer1, and tested that data comes from it

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-25-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11 20:47:07 +00:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Build tools: iio: Correctly add make dependency for iio_utils 2019-11-10 17:11:06 +00:00
iio_event_monitor.c iio: add IIO_MOD_O2 modifier 2020-08-22 10:53:12 +01:00
iio_generic_buffer.c tools: iio: convert iio_generic_buffer to use new IIO buffer API 2021-03-11 20:47:07 +00:00
iio_utils.c tools: iio: convert iio_generic_buffer to use new IIO buffer API 2021-03-11 20:47:07 +00:00
iio_utils.h tools: iio: convert iio_generic_buffer to use new IIO buffer API 2021-03-11 20:47:07 +00:00
lsiio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile tools: iio: convert iio_generic_buffer to use new IIO buffer API 2021-03-11 20:47:07 +00:00