Hardware monitor and battery paths are not a configuration option

This commit is contained in:
Wojciech Kozlowski 2019-01-02 10:58:39 +08:00
parent ce2fe133d5
commit dc4e3c2c70
3 changed files with 4 additions and 10 deletions

View File

@ -1,10 +1,4 @@
//! # rwmstatus configuration
/// Path to monitors.
pub const HW_MON_PATH: &str = "/sys/devices/virtual/hwmon";
/// Path to power supply information.
pub const BATT_PATH: &str = "/sys/class/power_supply";
/// Additional time zones to display (short name, full name).
pub const TZS: [(char, &str); 2] = [('A', "America/Buenos_Aires"), ('U', "UTC")];

View File

@ -103,10 +103,10 @@ struct Tz {
impl RwmStatus {
/// Build a new RwmStatus object. This function collects all the monitor
/// and battery paths for later use.
pub fn new(hw_mon_path: &str, batt_path: &str, tzs: &[(char, &str)]) -> RwmStatus {
pub fn new(tzs: &[(char, &str)]) -> RwmStatus {
RwmStatus {
hw_mons: RwmStatus::get_paths(hw_mon_path, "hwmon"),
batts: RwmStatus::get_paths(batt_path, "BAT"),
hw_mons: RwmStatus::get_paths("/sys/devices/virtual/hwmon", "hwmon"),
batts: RwmStatus::get_paths("/sys/class/power_supply", "BAT"),
tzs: tzs.iter()
.map(|tz| {
Tz {

View File

@ -37,7 +37,7 @@ fn main() {
std::process::exit(1);
}
let rwmstatus = RwmStatus::new(config::HW_MON_PATH, config::BATT_PATH, &config::TZS[..]);
let rwmstatus = RwmStatus::new(&config::TZS[..]);
let mut stats = vec![];
loop {