Skip to content

Improve battery reporting reliability

There were a few minor issues left over from !175 (merged) - this tries to address them.

Summary

This changes two method calls to better match intent and fixes a lot of inline comments.

Details

In order to figure out whether a battery was attached to the host device, I had looked at the value of isPresent. This did not work on a Mac OS test environment - the single primary battery was invisible. On the previous Merge Request @broulik suggested I use the isPowerSupply method to filter out unsuitable batteries. It doesn't seem to break the Linux host support, so that's a plus.

I also switched the one remainingTime call to timeToEmpty. There is no real reason not to use that instead.

Merge request reports