Skip to content
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

Improve charging detection function #332

Merged
merged 1 commit into from
Dec 24, 2021
Merged

Improve charging detection function #332

merged 1 commit into from
Dec 24, 2021

Conversation

bobslept
Copy link
Contributor

@bobslept bobslept commented Dec 24, 2021

The list of items in power_supply is now sorted. This way the AC is 'always' on top, and checked first. What I noticed is that internal supplies are always use uppercase, and inserted devices all use lowercase.

So if this theory is correct the AC and internal battery will always be checked first.

I also noticed the "scope" file under the hid device with battery. Maybe that file could help identify if an battery is from some other device or not. Will see in future bug reports if that is correct and maybe use that.

If this still not works correctly I've implement an ignorelist. Where we can easily add items or parts of the string from devices we want to be ignored.

Currently in the ignore list is the "hidpp_battery" that came up in every issue so far.

It's just an improvement of what we already have.

Fixes #331

@AdnanHodzic
Copy link
Owner

AdnanHodzic commented Dec 24, 2021

Great stuff, thanks you for taking care of this so quickly!

@AdnanHodzic AdnanHodzic merged commit 64e3382 into AdnanHodzic:master Dec 24, 2021
@bobslept bobslept deleted the power-supply-ignore-list branch December 24, 2021 19:27
@AdnanHodzic
Copy link
Owner

Changes live as part of v1.9.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Battery reported as discharging even it's not
2 participants