-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autodetect relevant batteries instead of relying on hardcoded filenames. #448
Autodetect relevant batteries instead of relying on hardcoded filenames. #448
Conversation
Debug bash output on Dell XPS 9345:
On A x86 Dell laptop:
HP Elitebook 840 G4 x86 laptop:
|
Flatpak run fails, but seems a internal error not this PR. I can't rerun I guess |
Thank you for the effort! I'll check it out later today or tomorrow!
Yeah, likely to be a Flatpak action thing (again). I'll look into getting it fixed soon, I'll tell you when I'm done so you can merge main again.
That's okay, no worries. |
Hi, I've merged a fix for the CI pipeline. :) |
Ah nice, I guess I merge in main and push again? |
Correct |
…ion' into feature/power_supply_auto_detection
Hmm, I rebased, maybe I should have normal merged? Sorry, figuring out a bit how this works with PRs and Github. |
The way you did it is correct, you've basically taken your changes and "put them on top" of the newest commit of |
Battery on my Dell XPS 9345 Snapdragon X didn't show up in Resources. Turns out the naming of the battery in
/sys/class/power_supply/
is notBATx
but a whole differentqcom-battmgr-bat
. So it seems it's not very wise to rely on a hardcoded detection of^BAT
.I did some research and figured out a quite simple way to detect which of the
power_supply/*
items are indeed system batteries and not your Mouse/Keyboard ones.Or to get a quick debug output:
This was tested by a another user with a Dell laptop with a BAT0 entry. I tested it with my Snapdragon laptop. And will try to test it on another laptop as well. But it seems quite solid. Ofcourse, some extra testing would be really nice to see if we regress.
I wanted to add unittests for the logic, but there is no way to mock the
fs
part, and not sure if we want to use a temp filesystem structure. From what I see in the project the sysfs reading logic is not really tested, so I omitted them.