iio_readdev(1)

NAME
iio_readdev - read buffers from an IIO device

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

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

OPTIONS
##COMMON_COMMANDS_START## ##COMMON_COMMANDS_STOP##

-t --trigger
    Use the specified trigger, if needed on the specified channel

-b --buffer-size
    Size of the capture buffer. Default is 256.

-s --samples
    Number of samples (not bytes) to capture, 0 = infinite. Default is 0.

-T --timeout
    Buffer timeout in milliseconds. 0 = no timeout. Default is 0. ##COMMON_OPTION_START## ##COMMON_OPTION_STOP##

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

USAGE

You use iio_readdev in the same way you use many of the other libiio utilities. You should specify a IIO device, and the specific channel to read. Since this is a read, channels must be input. If no channel is provided, iio_readdev will read from all input channels. If no device is provided, iio_readdev will print a few examples:
    iio_readdev -a
    Using auto-detected IIO context at URI "usb:3.10.5"
    Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage0
    Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage1
    Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage2
    Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage3
    Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc

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;"