Open mohabmetwalli opened 1 year ago
Hi.
It can't. I don't really know how to tackle this problem, either. I also don't have the hardware to try and write an implementation. It would be very appreciated if you or others alike could give us a hand with this problem.
Even if multiple batteries are present, shouldn't macchina just report the status of the first one?
@mohabmetwalli: Can you show the directory listing of /sys/class/power_supply/BAT0
?
Even if multiple batteries are present, shouldn't macchina just report the status of the first one?
Yes, indeed. I'll see what I can do to fix this. Adding support for this could prove to be a lot of work in libmacchina
— dual-battery friends, if you really want to see support for multi-battery reports, please contribute your patches to libmacchina
seeing as I don't have the hardware to do any meaningful tests.
Hi,
Regarding batteries, this library might be helpful,
https://crates.io/crates/starship-battery
It has one API which lists batteries and their info and works with most major operating systems (including NetBSD thanks to my port) except OpenBSD for now. (I wanted to do it but the Rust ecosystem was broken on OpenBSD when I tried and I did not want to fight with segfaults and resource over use / stalls with the LSP).
If I make this proposal despite macchina having already some battery reading features is because, this library basically provide an iterator with all available batteries + update methods, and this would ease the process of reading multiple batteries on any operating system with a single implementation on macchina's side.
The example directory in that library shows how to use the library, iterate over batteries and so on.
When we fetch things, we like to call libmacchina, that's the only backend we wish to use. So it would be best if we wrote our own implementation, we're already borrowing quite a few things from other libraries in libmacchina and I don't like that we do that.
It was just a proposal to make things simpler and use the systems' APIs instead of running shell commands. (At least in the netbsd's case).
To be fair it would not make sense to make a rewrite at it would mostly be about making a clone. The entire library's purpose is to provide battery info, and nothing else. It's not a "do it all" library.
And of course it would be used in libmacchina, I though this repo and issue feed was for the project overall.
I wasn't sure if I should open this issue as a bug or a feature request, so I thought I should ask this question first.
My laptop has two batteries, and I suspect this is the reason
macchina
cannot read battery percentage.macchina --doctor
output:ls /sys/class/power_supply --all
output: