-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hwmon: refactor & support lookup of all indices #226
base: master
Are you sure you want to change the base?
Conversation
This should allow the user to omit the indices: config field if a sensor input is sufficiently specified by other criteria. In this case, thinkfan should pick up all pwm/temp files found for the given sensor. A major caveat being that the number of available temperature inputs won't be known before a sensors has been successfully looked up...
auto subdir = path + "/" + entries[i]->d_name; | ||
free(entries[i]); | ||
|
||
for (const filesystem::path &subdir : dir_entries<filter_subdirs>(path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const filesystem::path &subdir : dir_entries<filter_subdirs>(path)) { | |
for (const auto &subdir : dir_entries<filter_subdirs>(path)) { |
and elsewhere in this PR
@@ -231,7 +251,7 @@ string HwmonInterface<HwmonT>::lookup() | |||
if (paths.size() != 1) { | |||
string msg(path + ": "); | |||
if (paths.size() == 0) { | |||
msg += "Could not find a hwmon with this name: " + name_.value(); | |||
msg += "Could not find an hwmon with this name: " + name_.value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, hwmon
stands for hardware monitor
so perhaps it was correct as a
. But I'm not a
English speaker so not really sure :D
else | ||
found_paths_.push_back(path); | ||
else { | ||
vector<filesystem::path> paths = dir_entries<filter_driver_file>(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vector<filesystem::path> paths = dir_entries<filter_driver_file>(path); | |
auto paths = dir_entries<filter_driver_file>(path); |
found_paths_.push_back(path); | ||
else { | ||
vector<filesystem::path> paths = dir_entries<filter_driver_file>(path); | ||
found_paths_.assign(paths.begin(), paths.end()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found_paths_.assign(paths.begin(), paths.end()); | |
found_paths_.swap(paths); |
Also why don't we assign found_paths_
directly in #285?
This should allow the user to omit the indices: config field if a sensor input is sufficiently specified by other criteria. In this case, thinkfan should pick up all pwm/temp files found for the given sensor. A major caveat being that the number of available temperature inputs won't be known before a sensors has been successfully looked up...