nokyan / resources

Keep an eye on system resources
GNU General Public License v3.0
706 stars 56 forks source link

Logitech mouse and keyboard battery info is missing #265

Closed meybonomme closed 2 months ago

meybonomme commented 3 months ago

Is there an existing issue for this?

Current Behavior

There is no useful information about Logitech mouse and keyboard batteries

Expected Behavior

If the batteries are visible in the selection, they should provide useful information.

Steps To Reproduce

No response

Environment

App version 1.5.0
Flatpak
Fedora 40

Screenshot from 2024-06-28 02-40-01 Screenshot from 2024-06-28 02-39-33

jojo2357 commented 3 months ago

Ditto

image

tree /sys/class/power_supply/hidpp_battery_3

.
├── capacity_level
├── device -> ../../../0003:046D:405E.0016
├── hwmon8
│   ├── device -> ../../hidpp_battery_3
│   ├── name
│   ├── power
│   │   ├── async
│   │   ├── autosuspend_delay_ms
│   │   ├── control
│   │   ├── runtime_active_kids
│   │   ├── runtime_active_time
│   │   ├── runtime_enabled
│   │   ├── runtime_status
│   │   ├── runtime_suspended_time
│   │   └── runtime_usage
│   ├── subsystem -> ../../../../../../../../../../../class/hwmon
│   └── uevent
├── manufacturer
├── model_name
├── online
├── power
│   ├── async
│   ├── autosuspend_delay_ms
│   ├── control
│   ├── runtime_active_kids
│   ├── runtime_active_time
│   ├── runtime_enabled
│   ├── runtime_status
│   ├── runtime_suspended_time
│   ├── runtime_usage
│   ├── 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:405E.0016
├── scope
├── serial_number
├── status
├── subsystem -> ../../../../../../../../../../class/power_supply
├── type
├── uevent
└── wakeup37
    ├── active_count
    ├── active_time_ms
    ├── device -> ../../hidpp_battery_3
    ├── event_count
    ├── expire_count
    ├── last_change_ms
    ├── max_time_ms
    ├── name
    ├── prevent_suspend_time_ms
    ├── subsystem -> ../../../../../../../../../../../class/wakeup
    ├── total_time_ms
    ├── uevent
    └── wakeup_count
nokyan commented 3 months ago

Hi, thanks for the issue and for the tree output. Some Logitech mice apparently do at least offer the current battery charge as info. I'll implement a fix, which will make Resources ignore batteries that don't at least have the current battery charge in SysFS. :)

meybonomme commented 3 months ago

In my opinion, it should be limited to just showing the laptop battery information. However, Recources is more of a system monitoring and management tool than for managing external devices. Too many options make an app bloated, especially if they don't add significant value.

Most of the batteries of external devices do not give any other information than the charge level anyway (even that only roughly), especially if it is a non-rechargeable battery. Moreover, GNOME Setting shows the battery level of external devices well enough, and GNOME shell also sends a notification when the battery level is too low:

Screenshot from 2024-06-29 22-32-15

nokyan commented 3 months ago

In my opinion, it should be limited to just showing the laptop battery information. However, Recources is more of a system monitoring and management tool than for managing external devices. Too many options make an app bloated, especially if they don't add significant value.

Most of the batteries of external devices do not give any other information than the charge level anyway (even that only roughly), especially if it is a non-rechargeable battery. Moreover, GNOME Setting shows the battery level of external devices well enough, and GNOME shell also sends a notification when the battery level is too low:

Screenshot from 2024-06-29 22-32-15

Yeah, that's a good point as well. I'll think about it, maybe others can voice their opinion here too

nokyan commented 2 months ago

I've pushed a change to battery-fixes: non-notebook batteries will be ignored. I'd appreciate if you could test it :)

meybonomme commented 2 months ago

How can I test it? I'm currently using the Flathub version.

nokyan commented 2 months ago

How can I test it? I'm currently using the Flathub version.

You'd have to build Resources yourself. It should work like this:

git clone https://github.com/nokyan/resources.git
cd resources
git checkout battery-fixes
flatpak install org.gnome.Sdk//46 org.freedesktop.Sdk.Extension.rust-stable//23.08 org.gnome.Platform//46 org.freedesktop.Sdk.Extension.llvm18//23.08
flatpak-builder --user flatpak_app build-aux/net.nokyan.Resources.Devel.json
flatpak-builder --run flatpak_app build-aux/net.nokyan.Resources.Devel.json resources

You'd need Rust and flatpak-builder installed. Alternatively, if you don't want to do that, I'd also appreciate if you could tell me what Resources says in the "Device" entry of your normal laptop battery. :)

meybonomme commented 2 months ago

If I have a bit more time, I can test. My laptop battery info:

pilt

nokyan commented 2 months ago

If I have a bit more time, I can test. My laptop battery info:

pilt

Thanks! I'd like to release 1.5.1 with this fix tomorrow, so I'll merge the branch since your battery should be detected as a laptop battery with the new fix.

meybonomme commented 2 months ago

I can confirm that Resources now only shows the laptop battery.