ublue-os / bazzite

Bazzite is a custom image built upon Fedora Atomic Desktops that brings the best of Linux gaming to all of your devices - including your favorite handheld.
https://bazzite.gg
Apache License 2.0
3.67k stars 217 forks source link

ublue-update failing hardware check on battery of hid device #285

Closed daegalus closed 8 months ago

daegalus commented 1 year ago

Per our conversation in discord.

On my system, ublue-update fails to run because the battery hardware check is noticing the battery of my bluetooth keyboard.

  /sys/class/power_supply                                                                                                                                                                                              at  21:37:09
❯ ls
hid-34:88:5d:42:f7:c8-battery

Digging into the folder, we find the following:

  /sys/class/power_supply/hid-34:88:5d:42:f7:c8-battery                                                                                                                                                                at  21:41:01
❯ cat device/input/input28/name 
Keyboard K380 Keyboard

The workaround solution was to set min_battery_percent in /etc/ublue-update/ublue-update.toml to 0, as suggested by Gerblesh.

This might be an upstream issue with psutil not filtering out hid- batteries, but needs more investigation.

RodoMa92 commented 1 year ago

Yeah, I've got a similar issue three days ago, probably for the same source (I've got a bluetooth keyboard + mouse combo with battery reporting). I'll try to dig further if I can reproduce it again.

RodoMa92 commented 1 year ago

Oh, found the issue, it's here: https://github.com/giampaolo/psutil/blob/77e5b7445748d30d22c0e3b2e651414da96a88b4/psutil/_pslinux.py#L1476

They are checking if the nodes in the folder has the text 'battery' in them in the folder /sys/class/power_supply, but that includes also batteries reported from bluetooth hardware peripherals (since they have the format of hid-\<mac address>-battery), so they also match.

I'll see if I can pull additional information from a battery source, I might already have an idea for it.

RodoMa92 commented 1 year ago

PR is open: https://github.com/giampaolo/psutil/pull/2305