Which filesystem to use to expose readings/limits for temperature sensor

霸气de小男生 提交于 2020-01-06 02:19:11

问题


I currently have the trouble of some hardware overheating regularly. Looking through the Linux kernel, I found that the thermal sensors are currently fully supported, however the preconfigured limits seem much too high. I am currently looking to modify the kernel module, but I am not sure what would be the best way to modify it. I would like the following:

  • Have a file somewhere, where I can read the current temperature
  • Have a couple of files I can use from userspace to modify the current limits

Now I am not sure what virtual file interface I should use for this. So far I see the following options:

  • Expose all data via the /dev/ filesystem, use ioctl() to modify limits
  • Add the files in sysfs
  • Add the files in debugfs

I am not sure what the pros and cons of each of these methods would be. So far I have looked at sysfs, and it seems that this is not the right way to go. The number of sensors is highly hardware dependent, and I would have to add various hacks to get one file per sensor (or one directory per sensor), possibly adding another kobject for each sensor so I can add files in the resulting directory. Previously the sensor data seemed to have been available through /sys/class/hwmon/hwmon0/device/temp1_input, however it was removed there.

debugfs also does not seem like the right way to go, since I am not so much interested in kernel debugging, but rather providing a nicer way to configure and read the sensors.

devfs however seems like a lot of overkill for such a simple setup.

What would be the best way to expose the sensor data and make the limits configurable through user space?


回答1:


According to Documentation/hwmon/sysfs-interface, temp[1-*]_max and temp[1-*]_crit are already defined for that pupose and should be implemented read-write when possible. If that is not already the case for your driver, then that is what you want to implement.



来源:https://stackoverflow.com/questions/33873221/which-filesystem-to-use-to-expose-readings-limits-for-temperature-sensor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!