-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix unknown sensors #31
Conversation
On my computer `sensors` wive me a list of sensors but with names that the sysinfo library doesn't recognize, so I decided to make a fix for it. if the sensor isn't found in sysinfo, instead of giving an error everytime, only throw 1 error and a list of found sensors (on my computer it was `nct6797 CPUTIN` which `sensors` did not lists under that name)
When the specified network interface isn't found, it gives the user a list of all the recognized interfaces
src/providers/sysinfo.rs
Outdated
warn!("couldn't find sensor `{}`", self.sensor_name); | ||
Ok(()) | ||
})?; | ||
}); |
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.
This result is unused. That could lead to it having no effect. Can you fix that? You can use cargo clippy
to find mistakes like these.
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.
Yes I will try to fix that, it's my first time in rust so there's a lot that I have to learn
src/providers/sysinfo.rs
Outdated
).is_none(){ | ||
warn!("Couldn't find network interface `{}`", net_interface_name); | ||
info!("Instead, found those interfaces:"); | ||
for (interface_name, _unused) in sys.networks() { |
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.
Better would be for (interface_name, _) in sys.networks()
I think I modified the code to something you could like, please let me know if there are other things that bother you |
Looks good, thank you! |
My computer is weird, my system doesn't use eth0 for the ethernet and the temperature sensor given by the command
sensor
isn't recognized by rust.So I edited the code to give the user a list of available sensor/interface when the default one doesn't works.