[GH-ISSUE #21] FSTemperatureMonitor needs some love #21

Closed
opened 2026-02-26 00:31:32 +03:00 by kerem · 5 comments
Owner

Originally created by @ntninja on GitHub (Aug 14, 2015).
Original GitHub issue: https://github.com/hirschmann/nbfc/issues/21

As we've discussed in #18 the current implementation of FSTemperatureMonitor is somewhat confusing.

Some things I'd suggest doing:

  • Rename the whole thing to LinuxTemperatureMonitor. Neither does the hwmon work only on file systems (the current code ignores everything except CPUs), nor is it portable to anything except Linux.
  • Get rid of the configuration file: Hardware is dynamic and the code should reflect this. It's OK to check the list of available sensors (additionally to their values) every second, the additional overhead for you're usual <10 sensors is negligible.
  • If you do want to keep the configuration file around, use it only to allow the user to set additional temperature sensors and blacklist known bad ones instead of using as "temperature sensor law".

Please let me know what you think about these points.

Originally created by @ntninja on GitHub (Aug 14, 2015). Original GitHub issue: https://github.com/hirschmann/nbfc/issues/21 As we've discussed in #18 the current implementation of `FSTemperatureMonitor` is somewhat confusing. Some things I'd suggest doing: - Rename the whole thing to `LinuxTemperatureMonitor`. Neither does the `hwmon` work only on file systems (the current code ignores everything except CPUs), nor is it portable to anything except Linux. - Get rid of the configuration file: Hardware is dynamic and the code should reflect this. It's OK to check the list of available sensors (additionally to their values) every second, the additional overhead for you're usual `<10` sensors is negligible. - If you do want to keep the configuration file around, use it only to allow the user to set additional temperature sensors and blacklist known bad ones instead of using as "temperature sensor law". Please let me know what you think about these points.
kerem 2026-02-26 00:31:32 +03:00
Author
Owner

@ntninja commented on GitHub (Aug 15, 2015):

You might already know this, but (for reference) here's the reference sheet for the hwmon sysfs interface:
https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface

Also wouldn't it make sense to measure the temperature of all available hardware devices (instead of just CPUs) and return the maximum temperature measured instead of the average one. If some process really stresses my GPU, for instance, I'd want my fan to start doing some extra cooling as well…

<!-- gh-comment-id:131390478 --> @ntninja commented on GitHub (Aug 15, 2015): You might already know this, but (for reference) here's the reference sheet for the `hwmon` sysfs interface: https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface Also wouldn't it make sense to measure the temperature of all available hardware devices (instead of just CPUs) and return the maximum temperature measured instead of the average one. If some process really stresses my GPU, for instance, I'd want my fan to start doing some extra cooling as well…
Author
Owner

@hirschmann commented on GitHub (Aug 15, 2015):

These are some pretty good suggestions and I agree with most of them.
I think a temperature monitoring plugin dedicated to Linux is a pretty good idea.

I have already read the sysfs-interface documentation and there is one sentence I want to highlight:

An alternative method that some programs use is to access the sysfs
files directly. [...]
That said, such programs will have to implement conversion, labeling and hiding of inputs. For
this reason, it is still not recommended to bypass the library.

I think the plugin should use libsensors to read temperatures from various temperature sensors instead of directly accessing the sysfs files.
Because there is nothing in the FSTemperatureMonitor code which could be reused, I prefer to create a new plugin project which will supersede FSTemperatureMonitor once it is finished.

<!-- gh-comment-id:131395695 --> @hirschmann commented on GitHub (Aug 15, 2015): These are some pretty good suggestions and I agree with most of them. I think a temperature monitoring plugin dedicated to Linux is a pretty good idea. I have already read the sysfs-interface documentation and there is one sentence I want to highlight: > An alternative method that some programs use is to access the sysfs > files directly. [...] > That said, such programs will have to implement conversion, labeling and hiding of inputs. **For > this reason, it is still not recommended to bypass the library.** I think the plugin should use `libsensors` to read temperatures from various temperature sensors instead of directly accessing the `sysfs` files. Because there is nothing in the `FSTemperatureMonitor` code which could be reused, I prefer to create a new plugin project which will supersede `FSTemperatureMonitor` once it is finished.
Author
Owner

@ntninja commented on GitHub (Aug 15, 2015):

I'll look into this, but looking at the search results I found I fear I'll have to create a libsensor C# binding (involving unsafe code and whatnot) myself. :-(
Please let me know if you know of bindings/reimplementations of libsensor for C#, I's not actually a language I use very often so your the expert here. ;-) Otherwise I'll get to work writing that binding tomorrow.

Note to self: Some demo code

<!-- gh-comment-id:131437192 --> @ntninja commented on GitHub (Aug 15, 2015): I'll look into this, but looking at the search results I found I fear I'll have to create a `libsensor` C# binding (involving unsafe code and whatnot) myself. :-( Please let me know if you know of bindings/reimplementations of `libsensor` for C#, I's not actually a language I use very often so your the expert here. ;-) Otherwise I'll get to work writing that binding tomorrow. Note to self: [Some demo code](http://stackoverflow.com/a/8565176/277882)
Author
Owner

@hirschmann commented on GitHub (Aug 16, 2015):

I know of a C# wrapper for libsensors , which is exactly what you've probably been looking for.

If you want to implement the new plugin, please let me know, so that I don't work on the same stuff as you. ;)

<!-- gh-comment-id:131539844 --> @hirschmann commented on GitHub (Aug 16, 2015): I know of a [C# wrapper for libsensors ](https://code.google.com/p/sensorium/source/browse/trunk/Sensorium2/libsensorsPlugin/libsensorsWrapper.cs), which is exactly what you've probably been looking for. If you want to implement the new plugin, please let me know, so that I don't work on the same stuff as you. ;)
Author
Owner

@github-actions[bot] commented on GitHub (Dec 13, 2019):

This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed

<!-- gh-comment-id:565242996 --> @github-actions[bot] commented on GitHub (Dec 13, 2019): This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nbfc-hirschmann#21
No description provided.