使用哪个文件系统公开温度传感器的读数/限制 [英] Which filesystem to use to expose readings/limits for temperature sensor

查看:135
本文介绍了使用哪个文件系统公开温度传感器的读数/限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前经常遇到一些硬件过热的麻烦.通过Linux内核查看,我发现当前已完全支持热传感器,但是预配置的限制似乎太高了.我目前正在寻找修改内核模块的方法,但是我不确定修改它的最佳方法是什么.我想要以下内容:

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:

  • 在某个地方保存文件,我可以在其中读取当前温度
  • 我可以从用户空间使用几个文件来修改当前限制

现在,我不确定应该为此使用哪个虚拟文件接口.到目前为止,我看到以下选项:

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

  • 通过/dev/文件系统公开所有数据,使用ioctl()修改限制
  • 在sysfs中添加文件
  • 在debugfs中添加文件
  • Expose all data via the /dev/ filesystem, use ioctl() to modify limits
  • Add the files in sysfs
  • Add the files in debugfs

我不确定这些方法中每种方法的优缺点.到目前为止,我已经看过sysfs,看来这不是正确的方法.传感器的数量与硬件高度相关,因此我必须添加各种技巧才能使每个传感器获得一个文件(或每个传感器获得一个目录),可能为每个传感器添加另一个kobject,以便我可以在结果目录中添加文件.以前,传感器数据似乎可以通过/sys/class/hwmon/hwmon0/device/temp1_input获得,但是在此已将其删除.

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似乎也不是正确的方法,因为我对内核调试不太感兴趣,而是提供了一种更好的配置和读取传感器的方法.

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似乎过于矫kill过头.

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?

推荐答案

根据文档/hwmon/sysfs接口temp[1-*]_maxtemp[1-*]_crit,并应在可能的情况下以读写方式实现. 如果您的驱动程序还不是这种情况,那么这就是您要实现的.

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.

这篇关于使用哪个文件系统公开温度传感器的读数/限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆