.\" Copyright (c) 2018-2020 Robin Getz
.\" Copyright (c) 2018-2020 Analog Devices Inc.
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, see
.\" .
.\" %%%LICENSE_END
.\"
.TH iio_readdev 1 "29 September 2024" "libiio-0.26" "LibIIO Utilities"
.IX iio_readdev_
.SH NAME
iio_readdev \- read buffers from an IIO device
.SH SYNOPSIS
.B iio_readdev
[
.I options
]
[-n ] [-t ] [-T ] [-b ] [-s ] [ ...]
.SH DESCRIPTION
.B iio_reg
is a utility for reading buffers from connected IIO devices, and sending resutls to standard out.
.SH OPTIONS
.TP
.B \-h, \-\-help
Tells
.I iio_readdev
to display some help, and then quit.
.TP
.B \-V, \-\-version
Prints the version information for this particular copy of
.I iio_readdev
and the version of the libiio library it is using. This is useful for knowing if the version of the library and
.I iio_readdev
on your system are up to date. This is also useful when reporting bugs.
.TP
.B \-S, \-\-scan [backends]
Scan for available IIO contexts, optional arg of specific backend(s) 'ip', 'usb' or 'ip:usb'.
Specific options for USB include Vendor ID, Product ID to limit scanning to specific devices 'usb=0456,b673'.
vid,pid are hexadecimal numbers (no prefix needed), "*" (match any for pid only)
If no argument is given, it checks all that are available.
.TP
.B \-t \-\-trigger
Use the specified trigger, if needed on the specified channel
.TP
.B \-b \-\-buffer-size
Size of the capture buffer. Default is 256.
.TP
.B \-s \-\-samples
Number of samples (not bytes) to capture, 0 = infinite. Default is 0.
.TP
.B \-T \-\-timeout
Buffer timeout in milliseconds. 0 = no timeout. Default is 0.
.TP
.B \-u, \-\-uri
The Uniform Resource Identifier
.I (uri)
for connecting to devices, can be one of:
.RS
.IP ip:[address]
network address, either numeric (192.168.0.1) or network hostname
.IP ip:
blank, if compiled with zeroconf support, will find an IIO device on network
.IP usb:[device:port:instance]
normally returned from
.B iio_readdev -S
.IP serial:[port],[baud],[settings]
which are controlled, and need to match the iiod (or tinyiiod) on the other end of the serial port.
.RS
.IP [port]
is something like '/dev/ttyUSB0' on Linux, and 'COM4' on Windows.
.IP [baud]
is is normally one of 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200 [default], 128000 or 256000, but can vary system to system.
.IP [settings]
would normally be configured as '8n1' this is controlled by:
.RS
.IP data_bits:
(5, 6, 7, 8 [default], or 9)
.IP parity_bits:
('n' none [default], 'o' odd, 'e' even, 'm' mark, or 's' space)
.IP stop_bits:
(1 [default, or 2)
.IP flow_control:
('0' none [default], 'x' Xon Xoff, 'r' RTSCTS, or 'd' DTRDSR)
.RE
.RE
.IP local:
with no address part.
.RE
.SH RETURN VALUE
If the specified device is not found, a non-zero exit code is returned.
.SH "USAGE"
.PP
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:
.RS
.B \f(CWiio_readdev -a\fP
.br
Using auto-detected IIO context at URI "usb:3.10.5"
.br
Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage0
.br
Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage1
.br
Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage2
.br
Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc voltage3
.br
Example : iio_readdev -u usb:3.10.5 -b 256 -s 1024 cf-ad9361-lpc
.RE
.PP
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
.RS
.B \f(CWiio_readdev \-a \-s 1024 cf-ad9361-lpc voltage0 voltage1 > samples.dat\fP
.RE
.PP
And plots the data with gnuplot.
.RS
.B \f(WCgnuplot \-e \(dq\&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;\(dq\&\fP
.RE
.SH "SEE ALSO"
.ad l
.BR iio_attr (1),
.BR iio_info (1),
.BR iio_readdev (1),
.BR iio_reg (1),
.BR iio_writedev (1),
.BR libiio (3)
.PP
libiio home page:
.BR \%https://wiki.analog.com/resources/tools-software/linux-software/libiio
.PP
libiio code:
.BR \%https://github.com/analogdevicesinc/libiio
.PP
Doxygen for libiio
.BR \%https://analogdevicesinc.github.io/libiio/
.SH BUGS
All bugs are tracked at:
.BR \%https://github.com/analogdevicesinc/libiio/issues