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

Change the way of checking the charging state #308

Merged
merged 1 commit into from
Dec 16, 2021
Merged

Change the way of checking the charging state #308

merged 1 commit into from
Dec 16, 2021

Conversation

bobslept
Copy link
Contributor

@bobslept bobslept commented Dec 13, 2021

Would always be charging, unless a battery tells us we are discharging, or the AC we found tells us we are connected to a cable.

This would also work on systems where somehow we cannot find an AC but only a battery. Which I have seen in some earlier opened issues.

Works on my system with ACAD as AC and BAT1 as battery

Fixes issue #306
Fixes issue #307
Fixes issue #299

@AdnanHodzic
Copy link
Owner

Thanks for looking into this! This change was originally started as part of #168 based on a lot of user feedback.

Proposed changes looks sound and they also worked on my side (X1 Carbon), I just wish if we had more confirmations that it works on various/different hardware. It would be great if battery detection issues could be solved once and for all, as besides the issues you mentioned, these issues keep popping up.

Let me think about this and in meantime let's wait for confirmations in #307 and #299.

@bobslept
Copy link
Contributor Author

bobslept commented Dec 13, 2021

Yes, I totally understand. I would love to see way more users test this before actually merged into master.

@bobslept
Copy link
Contributor Author

bobslept commented Dec 13, 2021

Note for this PR after reading alot of earlier issues. As seen in #124

"hid" devices may show up under /sys/class/power_supply/ as discharging battery.
It should be no problem to filter any item that contains "hid" before actually looping all the items.
Or just skip them while looping.

@bobslept
Copy link
Contributor Author

bobslept commented Dec 14, 2021

This is really great. Already all the issues are reported as fixed. I have told that we need probably need a little bit more testing before actually merging this.

One other thing that makes me very happy. One person mentioned that the PR #285 had fixed an issue for them, and had positive results with this current PR also. Which is great, because codewise they are totally different. So I think we are on the right track!

Maybe you could make an issue with a request for testing this. I don't see any other way to get people to test this without actually having problems at this moment.

@AdnanHodzic
Copy link
Owner

AdnanHodzic commented Dec 14, 2021

This is definitely the step in right direction. Here's an idea, what if we use logic you implemented as part of this PR as "main" logic, and as a "fallback" (at the end of loop in case nothing was matched) use the old mechanism to determine if device is charging or not?

This way, we could have best of the both worlds. This can also be a transitory thing, where once we've determined that new "main" logic catches every case old mechanism can be completely removed. If we had this I would just merge this with master right away, only remaining question would be how do we know which case/mechanism was used ...

@bobslept
Copy link
Contributor Author

I really don't know. Just leave it here and see how it works out.

@AdnanHodzic
Copy link
Owner

@bobslept I've decided to merge these changes with master, let's just go with it and if there are numerous people complaining about charging state not being detected properly things can be improved as we go.

Please do be aware I will tap you if I see this top of issues 🙂

@AdnanHodzic AdnanHodzic merged commit 3994d4a into AdnanHodzic:master Dec 16, 2021
@bobslept
Copy link
Contributor Author

Really interesting to see what happends. Will be on top of new battery issues 😇

@bobslept bobslept deleted the fix-charging-state branch December 16, 2021 12:17
@AdnanHodzic
Copy link
Owner

@bobslept since you've been involved with auto-cpufreq a lot as of lately, you might be interested in #312 🙂

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.

2 participants