rickysarraf / laptop-mode-tools

Power Savings tool for Linux
https://www.researchut.com/tags/laptop-mode-tools/
GNU General Public License v2.0
553 stars 47 forks source link

Ignore incorrectly reported batteries and ignore unhandled power_supp… #186

Open labre opened 2 years ago

labre commented 2 years ago

…ly types

Sorry, misinterpreted the Github interface. I’m tired. This PR fixes Bug #183 also for unpatched kernels and will also ignore any unhandled power_supply types. This should prevent issues like this in the future. Of course USB chargers could be handled, if their drivers report a charging state in the future. But even in that case there should be at least one battery found before we assume a mobile device.

Anyway, Closes: #183

labre commented 2 years ago

With the new commit we check correctly for the scope of the battery. Non-system batteries should be ignored, because they may belong to wireless mice or keyboards and basically anything with its own battery, if those devices report their charging status to the kernel.

I’ve tested it and it works as expected. Please merge this bug fix. :)