This post will give a simple introduction to Linux kernel module(Part III.).
Linux kernel module简介(三)
In this post we will discuss how to call kernel driver in user space.
In last two posts we use a IIO(Linux Industrial I/O Subsystem) device st_uvis25 as a example to show how to write a kernel module. There are a lot of devices fall into this subsystem:
- Capacitance to Digital Converters (CDCs)
- Pressure Sensors
- Color, Light and Proximity Sensors
- Temperature Sensors
- DDS (Direct Digital Synthesis)
- PLLs (Phase Locked Loops)
- Variable/Programmable Gain Amplifiers (VGA, PGA)
In st_uvis25_core.c, a iio_info has been defined and assigned to a iio_dev in probe function:
// st_uvis25_core.c, Line 267
If devm_iio_device_register success and iio_info.read_raw has been registered, a file will be created at :
In terminal, you can read it by cat
In C/C++ applications, you can use fopen because it’s a file.