DOKK / manpages / debian 11 / libiio-utils / iio_readdev.1.en
iio_readdev(1) LibIIO Utilities iio_readdev(1)

iio_readdev - read buffers from an IIO device

iio_readdev [ options ] [-n <hostname>] [-t <trigger>] [-T <timeout-ms>] [-b <buffer-size>] [-s <samples>] <iio_device> [<channel> ...]

iio_reg is a utility for reading buffers from connected IIO devices, and sending resutls to standard out.

Tells iio_readdev to display some help, and then quit. -n, --network Use the network backend with the provided hostname
The Uniform Resource Identifier (uri) for connecting to devices, can be one of:
network address, either numeric (192.168.0.1) or network hostname
blank, if compiled with zeroconf support, will find an IIO device on network
normally returned from iio_info -s
with no address part
Use the specified trigger, if needed on the specified channel
Size of the capture buffer. Default is 256.
Number of samples (not bytes) to capture, 0 = infinite. Default is 0.
Buffer timeout in milliseconds. 0 = no timeout. Default is 0.
Scan for available contexts and if only one is available use it.

If the specified device is not found, a non-zero exit code is returned.

You use iio_readdev in the same way you use many of the other libiio utilities. You must specify a IIO device, and the specific channel to read. Since this is a read, channels must be input. It is easy to use iio_attr to find out what the channels are called.

This identifies the device, and channel that can be used.

iio_attr -a -i -c .
Using auto-detected IIO context at URI "usb:3.10.5"
dev 'cf-ad9361-lpc', channel 'voltage0' (input, index: 0, format: le:S12/16>>0)
dev 'cf-ad9361-lpc', channel 'voltage1' (input, index: 1, format: le:S12/16>>0)

This captures 1024 samples of I and Q data from the USB attached AD9361, and stores it (as raw binary) into the file samples.dat

iio_readdev -a -s 1024 cf-ad9361-lpc voltage0 voltage1 > samples.dat

And plots the data with gnuplot.

gnuplot -e "set term png; set output 'sample.png'; plot 'sample.dat' binary format='%short%short' using 1 with lines, 'sample.dat' binary format='%short%short' using 2 with lines;"

iio_attr(1), iio_info(1), iio_readdev(1), iio_reg(1), iio_writedev(1), libiio(3)

libiio home page: https://wiki.analog.com/resources/tools-software/linux-software/libiio

libiio code: https://github.com/analogdevicesinc/libiio

Doxygen for libiio https://analogdevicesinc.github.io/libiio/

All bugs are tracked at: https://github.com/analogdevicesinc/libiio/issues

19 November 2020 libiio-0.21