Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content