giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.32k stars 1.39k forks source link

Exclude external batteries from sensors_battery #2305

Open RodoMa92 opened 1 year ago

RodoMa92 commented 1 year ago

Summary

Description

The single check for battery in powersupply was causing sometimes to grab external device battery statuses since they have the form of hid\<mac>_battery, which match the bat filter.

However they do not have an ACPI path to the system itself.

This takes into account that detail and properly exclude them from being included as an internal battery.

jardon commented 3 months ago

@RodoMa92 @giampaolo if this only requires signing the commit, can we get this pushed through?

RodoMa92 commented 3 months ago

@RodoMa92 @giampaolo if this only requires signing the commit, can we get this pushed through?

I'm not sure if this will not break under other platforms like arm, so it should be properly tested before a merge. Might not behave like on x86, but I do not have such hardware available to me.