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 //! # 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). /// Additional time zones to display (short name, full name).
pub const TZS: [(char, &str); 2] = [('A', "America/Buenos_Aires"), ('U', "UTC")]; pub const TZS: [(char, &str); 2] = [('A', "America/Buenos_Aires"), ('U', "UTC")];

View File

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

View File

@ -37,7 +37,7 @@ fn main() {
std::process::exit(1); 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![]; let mut stats = vec![];
loop { loop {