valpackett / systemstat

Rust library for getting system information | also on https://codeberg.org/valpackett/systemstat
https://crates.io/crates/systemstat
The Unlicense
616 stars 71 forks source link

Battery error if a wireless device with battery is attached #118

Closed l0l67 closed 1 year ago

l0l67 commented 1 year ago

The following error occurs if another device with a battery is attached to the system (and listed under /sys/class/power_supply/): No such file or directory (os error 2)

This occurs if energy_full, charge_full, energy_now, ... are not available under /sys/class/power_supply/

Device: Logitech MX Keys

/sys/class/power_supply/hidpp_battery_1
├── capacity_level
├── device -> ../../../0003:046D:408A.000A
├── hwmon6
│   ├── device -> ../../hidpp_battery_1
│   ├── name
│   ├── power
│   │   ├── autosuspend_delay_ms
│   │   ├── control
│   │   ├── runtime_active_time
│   │   ├── runtime_status
│   │   └── runtime_suspended_time
│   ├── subsystem -> ../../../../../../../../../../../../../../class/hwmon
│   └── uevent
├── manufacturer
├── model_name
├── online
├── power
│   ├── autosuspend_delay_ms
│   ├── control
│   ├── runtime_active_time
│   ├── runtime_status
│   ├── runtime_suspended_time
│   ├── wakeup
│   ├── wakeup_abort_count
│   ├── wakeup_active
│   ├── wakeup_active_count
│   ├── wakeup_count
│   ├── wakeup_expire_count
│   ├── wakeup_last_time_ms
│   ├── wakeup_max_time_ms
│   └── wakeup_total_time_ms
├── powers -> ../../../0003:046D:408A.000A
├── scope
├── serial_number
├── status
├── subsystem -> ../../../../../../../../../../../../../class/power_supply
├── type
├── uevent
└── wakeup47
    ├── active_count
    ├── active_time_ms
    ├── device -> ../../hidpp_battery_1
    ├── event_count
    ├── expire_count
    ├── last_change_ms
    ├── max_time_ms
    ├── name
    ├── prevent_suspend_time_ms
    ├── subsystem -> ../../../../../../../../../../../../../../class/wakeup
    ├── total_time_ms
    ├── uevent
    └── wakeup_count

12 directories, 41 files
valpackett commented 1 year ago

Thanks, good catch! Released 0.2.3 with the fix.