4 ms·
> On other systems, you'd need to compile a program using some special kernel API to query the batteries and then check their stats (say, checking charge levels
by dooglius 1y ago
> On other systems, you'd need to compile a program using some special kernel API to query the batteries and then check their stats (say, checking charge levels)
I asked an LLM how to do this on Windows and got
> wmic path Win32_Battery get EstimatedChargeRemaining
Which doesn't seem meaningfully worse than looking at some sys path; it's not clear what the file abstraction adds for me there.
- yjftsjthsd-h 1y agoSo you used an existing binary that hits the special kernel API to query the batteries. If you want to do it yourself (ex. to make your own graphical widget or something) then you have to hit that API yourself. And yes, sysfs is sort of an API too, but it's a simple, uniform API that in many cases can just be used via read() instead of needing to figure out some specialized interface.