简体   繁体   中英

*Linux Driver Development* Is there a way to expose extra settings through sysfs using the IIO framework?

The driver I'm developing has a number of settings I want the user to be able to change that don't really fit into the IIO framework. For example, using the IIO_CHAN_INFO_SAMP_FREQ enum in my read function exposes a variable in /sys/bus/iio/devices/iio:device0/ called "in_voltage_sampling_frequency" that allows the user to change the frequency on-the-go. I would also like to be able to pass in different modes (a string) through a similar mechanism. How would I do this? It doesn't look like the IIO interface supports ioctl calls.

Found a solution.

I used the sysfs device attribute stuff as seen here:

https://www.kernel.org/doc/Documentation/driver-model/device.txt

Another solution to this problem may be to use module_param which registers parameters that can be set during loading via modprobe/insmod and at runtime through sysfs:

int myint = 3;
module_param(myint, int, 0);

For more information, see: https://www.tldp.org/LDP/lkmpg/2.6/html/x323.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM