IIO data access
You may have guessed that there are only two ways to access data with the IIO framework: one-shot capture through sysfs channels or continuous mode (triggered buffer) through an IIO character device.
One-shot capture
One-shot data capture is done through the sysfs interface. By reading the sysfs entry that corresponds to a channel, you'll capture only the data specific to that channel. Given a temperature sensor with two channels, one for the ambient temperature, and the other for the thermocouple temperature:
# cd /sys/bus/iio/devices/iio:device0
# cat in_voltage3_raw
6646
# cat in_voltage_scale
0.305175781
The processed value is obtained by multiplying the scale by the raw value:
Voltage value
: 6646 * 0.305175781 = 2028.19824053
The device data sheet says the processed value is given in MV. In our case, it corresponds to 2.02819V.
Buffer data access
To get a triggered acquisition working, trigger support must have been implemented in your driver. Then, to acquire data...