Change config_to_json.py to Reconfigure Config Files (Fixes #10) #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes fix #10 after running the xml/Makefile with the
transform_to_json
argument. Tested on an HP EliteBook 8560p, which had the same issue before these changes. I didn't include all the reconfigured scripts as I didn't want to bloat this request and make it difficult to review, so you will have to do this and then push the updated config files yourself.Original problem:
The logic in NBFC Linux that handles
TemperatureThresholds
differs to that of the original NBFC service:UpThreshold
.UpThreshold
.We can bring the behaviour in line with the original service by making a small change to:
nbfc-linux/src/temperature_threshold_manager.c
Line 29 in dfce6ae
(by simply changing it to
while (i < size - 1 && temperature >= my.thresholds.data[i+1].UpThreshold) ++i;
)However, I prefer the current logic of NBFC Linux, as the handling of
UpThreshold
is consistent with that ofDownThreshold
, and is more intuitive. With that said, it appears that the community sourced config files were not reconfigured to account for this, and as such, they currently do not behave the same way as they do in the original service. I have made changes to tools/config_to_json.py to account for this, and have used it to reconfigure the config file for my notebook, which I have included as an example (tested and works for all config files). In addition, I have added these details to the README so that new users can get up to speed quickly.As for #10, several config files had a
TemperatureThresholds
entry whereFanSpeed
,UpThreshold
, andDownThreshold
were all 0. This entry was designed to keep the fans turned off to preserve power and make less noise when cooling is unnecessary. However, in NBFC Linux, when theUpThreshold
of the current entry is 0, the queried temperature always exceeds it and so theFanSpeed
of the next entry is selected instead. This is why the desiredFanSpeed
of 0 was never being set.Solution:
The new logic in tools/config_to_json.py simply shifts each
UpThreshold
value down an entry (after sorting in ascending order, of course), and sets the highestUpThreshold
to theCriticalTemperature
value (a change to src/model_config.c was required to allow for this). From there, there is no nextTemperatureThresholds
entry to move to, and so NBFC Linux will simply enable critical mode if the temperature ever exceeds theCriticalTemperature
value, and thus the desired behaviour is preserved.With that said, I'd like to say thank you for the hard work on this project, I really do appreciate and prefer this lightweight implementation of NBFC :).