-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: battery health command #57
Comments
This is interesting. Would you like to help with this, @HarshDobariya79? |
Thank you for the opportunity @tshakalekholoane, I would love to but unfortunately I don't have any experience in GO language. |
Okay, @HarshDobariya79. I will leave it open in case you or someone else wants to pick this up in future. |
I implemented this health feature in my fork of this repo, but I think the repos have already diverged quite a bit... https://github.com/pepa65/bat |
Ah.. That's bad. Seems like the entire repo has been re-fractored. |
This repo has recently been refactored a lot, and since I liked to give a different CLI experience, it's divergent. But the core ideas are exactly the same. |
Yes, it seemed overly complex so I did a rewrite. @pepa65, is that the |
I thought |
I believe so. For ASUS devices the charge threshold seems to be in linux/drivers/platform/x86/asus-wmi.c. The others i.e. |
On |
I see. You're right, it probably also depends on the battery model. |
Hello @tshakalekholoane I was looking at battery health too. Upower calculates it using main...sravan-s:bat:feat/health |
A note about the implementation of @sravan-s: it uses |
@pepa65 I found something interesting in this doc ->
And from upower docs ->
So, as you said, energy/capacity either should be fine. .If neither exist, we can assume power source have some issue |
Interesting about the Ampere vs. Watt, so yes, don't mix them..! How I have implemented it, they don't, so that's good. |
Hi @sravan-s. It appears so! Thank you for sharing.
@pepa65, I do have those Although I do have a preference for something more minimal so something like what @sravan-s did except with var v, w int
_, err := fmt.Sscanf(mustRead("energy_full"), "%d\n", &v)
// ... I also like @pepa65's implementation of the calculation, You are both welcome to file a pull requests or I can just do it and credit you both since you did the bulk of the research. Also, the upower documentation you linked seems to say (full-design / full) * 100 which would be > 1, unless I am missing something? But either way, thank you all for you contribution! |
@pepa65 Feel free to make PR 😃 |
@sravan-s Don't you already have a ready-to-go implementation? (I guess you don't handle In any case, my fork is too divergent. 🤷🏼♂️ |
Subject of the issue
There should be a command to check battery health which is the maximum storage capacity in percentage.
Eg.
Your system
OS: Ubuntu 22.04 Linux x86_64
Host: Asus TUF A15 FA506IH
Kernel: 5.19.0-45-generic
Version
0.12 (Latest)
The text was updated successfully, but these errors were encountered: