Skip to content

SMCBatteryManager improvements#81

Merged
usr-sse2 merged 3 commits into
masterfrom
power-notifications
Apr 9, 2026
Merged

SMCBatteryManager improvements#81
usr-sse2 merged 3 commits into
masterfrom
power-notifications

Conversation

@usr-sse2
Copy link
Copy Markdown
Contributor

@usr-sse2 usr-sse2 commented Apr 9, 2026

  1. Post notification about external power status only when the status is changed, not on every refresh. It reduces the PMRD: clamshell closed 0, disabled 0/0, desktopMode 0, ac 0 spam in kernel log.
  2. Do not pause polling when running on AC power with a fully charged battery. The polling is needed in the following situation:
  • The system is connected to a too weak power source, for example, a 20W iPhone charger.
  • It was in sleep mode (or turned off), which allowed the battery to charge to 100%.
  • The system was turned on.
    In this case the battery is fully charged, external power source is connected, but the battery is actually draining, so we need to refresh its status periodically, or else it will continue to show 100% until the power is disconnected or it is drained completely.

…ery is full

The AC adapter may provide insufficient power, so the battery may be actually discharging
@usr-sse2 usr-sse2 requested a review from vit9696 April 9, 2026 13:24
Copy link
Copy Markdown
Contributor

@vit9696 vit9696 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, left a tiny note regarding style.

Please fix this and update Changelog.md file.
Feel free to merge afterwards.

Comment thread Sensors/SMCBatteryManager/BatteryManager.cpp Outdated
Michael Belyaev added 2 commits April 9, 2026 16:43
This prevents repeated "PMRD: clamshell closed 0, disabled 0/0, desktopMode 0, ac 0" messages in kernel log
@usr-sse2 usr-sse2 force-pushed the power-notifications branch from fde6570 to e63277b Compare April 9, 2026 13:44
@usr-sse2 usr-sse2 merged commit b15991d into master Apr 9, 2026
6 checks passed
@usr-sse2 usr-sse2 deleted the power-notifications branch April 9, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants