Repository navigation
Report combined battery percentage from UPower DisplayDevice - #10392
calledtoconstruct wants to merge 11 commits into
Conversation
|
@bjarneo @calledtoconstruct @geirolafs — mapping the overlap here so nothing gets lost in the untangle, since several PRs were closed in favour of #6845 which is now closed itself: #10392 (this PR) fixes the base case: dual-battery machines showing only the first What it doesn't cover, and where it relates:
Suggested way forward: land this PR + #12649 (both small, independent), then a stacked follow-up on top of this PR for the #7916 liveness rebuild + cycles/scope pieces. Happy to draft that if that's the split you want — or go another way if you prefer. What's the call? |
|
@ujo4eva that split is the one I would make. Land this PR for the dual-pack Do not fold #11750's The rest (live sysfs watt sum across |
d3aa5f2 to
f3c5419
Compare
[Medium impact] The PR appears safe to merge; no new actionable issue was established. SummaryReports combined battery readings through UPower’s
The earlier unnumbered test-coverage comment is addressed: the dual-pack test explicitly requires the combined 12W rate.
|
|
Reviewed at f3c5419 against Reproduction, on a disposable Omarchy worker VM: I stubbed Tests on the worker: Second opinion: Codex at medium effort reviewed the diff over two rounds. It raised one possible false "Holding" state on dual-pack machines. That depends on DisplayDevice reporting Two things this pull request deliberately leaves alone. They are not reasons to hold it:
Competing fixes: #12024 and #12445 fix the same bug by summing the packs in the script. When asked which of the three to bring forward, without being given my answer, Codex chose this one: it is the smallest, and it reads the same combined device as the bar icon. Both of the others also have problems of their own. #12445's whitespace This now waits on the maintainer. |
|
Tested f3c5419 on a Surface Book 2 with two batteries (tablet + keyboard base). Percentage, size and time now match UPower's DisplayDevice, where before the panel showed the tablet battery only. Works as described. |
|
Pushed three commits to this branch, now at 4d42c01. Claude Opus 5.5 made the changes, and Codex Medium reviewed them in two rounds. The second round found nothing left to fix. What changed, and why:
Checked on an Omarchy worker VM:
Left as it is: Codex also pointed out that on a dual-pack machine, "holding" compares the combined percentage with the first pack's charge limit. That check only fires when AC is connected and the combined draw is at most 0.2 W. In that state the machine really is not charging, and the limit it shows is that pack's real limit. Codex agreed nothing in this branch needs to change for it. Independence between the two reviews is not guaranteed. Waiting on the maintainer. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The branch conflicted with What the merge brings in: How the two fit together: On a dual-pack machine, Checked on an Omarchy worker VM:
Independence between the reviews is not guaranteed. This is now waiting on CI and then on the maintainer. |
|
Tested on real dual-battery hardware: ThinkPad T480 Setup: internal BAT0 (LGC 01AV420, worn, 3.7 Wh full) + external BAT1 (01AV425, 22.4 Wh full). Omarchy 4.0.6-1, UPower 1.91.5, kernel 7.2.8. Charge thresholds 75–80% on both packs. I ran this PR's
This fixes the mismatch between the bar and the panel on this machine. Three notes:
This test and comment were done by Claude (Anthropic's AI) on my machine at my request; I reviewed it before posting. — Chris |
quattro's omacom#17265 rewrote the sysfs rate read to take a value only when it is a number. Keep that, and keep this branch's gate that skips it under DisplayDevice, whose rate already sums every pack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quattro's unreadable-rate case removes CMB0's power_now before the dual-pack case runs, so the assertion that DisplayDevice's rate wins would hold even without the gate. Put a live reading back so taking the first pack's would show as 7.3W. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
The merge: #17265 changed the live-rate read so it only takes a sysfs value that is a number, and otherwise keeps UPower's rate. That collided with this branch's check that skips the sysfs read under DisplayDevice. The resolution keeps both. On one pack, a numeric The test fix: #17265's new test case deletes CMB0's Checked on an Omarchy worker VM:
@igi-chris, thank you for the T480 run. It is the first test of this change on real dual-pack hardware. On your three notes (the reviewers agreed with this sorting, and independence between the reviews is not guaranteed):
This is waiting on CI for the new head, and then on the maintainer. |
|
Friendly nudge: #12789 is stacked on this one and builds on it to fix the dead-pack case in #7916, where DisplayDevice still counts the dead pack's advertised capacity. This branch is mergeable, has been tested on a T480, and omarchybot's last review found nothing. Once it lands I'll rebase #12789 onto |
A removed pack may remain in UPower enumeration with power supply: yes. Counting it switches a single present pack to DisplayDevice and takes cycle counts and charge limits from the removed slot. Skip candidates explicitly marked absent, preserving the live sysfs path and metadata for the remaining pack. This carries the absent-pack check from omacom#17639 without changing the first-pack metadata policy or dropping zero-capacity packs. Co-Authored-By: Dean Blank <blankdean@gmail.com> Co-Authored-By: GPT-6 in Codex (effort unspecified) <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
|
Pushed 2127907, carrying the removed-pack check from @blankdean's #17639 with co-authorship credit. A pack explicitly marked On a disposable Omarchy worker, a separate simulated T480 reproduction reports 98% / fully charged / 24Wh on These captures show the status command with identical simulated inputs; they establish the selection change, not a hardware result. GPT-6 in Codex (effort unspecified) performed the review and worker checks. Opus 5.5 High and muse-wonder via pi, thinking high reviewed this head and found no actionable defect. Their agreement is not independent proof. The locale and combined-charging improvements from @Sebo1411's #14861 are already included. Separate fixes remain in #12484 for unavailable cycle counts, #12058 for percentage rounding, and #13292 for choosing a nonzero-capacity pack with a fallback. First-pack metadata remains as described in this PR; #12789 remains the follow-up for a dead pack that still advertises capacity. This waits for hardware confirmation of the full commit above. The earlier T480 result tested a previous head, so I removed curl -fsSL https://raw.githubusercontent.com/calledtoconstruct/omarchy/2127907e21ca38b03eb9bedc8db185ed926250a6/bin/omarchy-battery-status -o /tmp/omarchy-battery-status-pr-10392
bash /tmp/omarchy-battery-status-pr-10392 --shell
upower -e
upower -i /org/freedesktop/UPower/devices/DisplayDevicePlease include |
The power panel now reports health and charge-limit controls. Keep those readings and the firmware threshold query on the same physical pack as the cycle count, while DisplayDevice supplies charge, state, and rate for multiple packs. Co-Authored-By: GPT-6.2 in Codex <noreply@openai.com>
The combined display has no firmware charge controls. Exercise the case from omacom#14861 where the physical pack advertises support but leaves the enabled property out of its formatted output, so resolving the wrong D-Bus device fails. Co-Authored-By: Sebo1411 <sebastijan.krklec11@gmail.com> Co-Authored-By: GPT-6.2 in Codex <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
|
I pushed On a disposable Omarchy worker, the simulated T480 reported 98% and 24 Wh on GPT-6.2 Sol High in Codex ran the worker checks. Opus 5.5 High reviewed this head and found no actionable issues. Opus 5.5 High and muse-wonder via pi, thinking high, also compared #14861 and #17639 with this fix. The reviews agreed, and their independence is uncertain. {CI_RESULT} Could @vcelletti or a maintainer with a dual-battery laptop test this exact commit on a current Omarchy install? Please report whether the percentage agrees with UPower's DisplayDevice and whether the reported charge-limit state matches the active setting. If one pack is removable, please also check the readings after removing it. curl -fsSL https://raw.githubusercontent.com/calledtoconstruct/omarchy/caaf569f677a29c724d7215e82830f64681d8a45/bin/omarchy-battery-status -o /tmp/omarchy-battery-status-pr-10392
bash /tmp/omarchy-battery-status-pr-10392 --shell
upower -i /org/freedesktop/UPower/devices/DisplayDevice |
|
Tested on a ThinkPad T480 (20L6SHKY00) with two packs: internal BAT0 (LGC, 23.4 Wh, 2 cycles) and external BAT1 (SANYO, 23.0 Wh, 4 cycles). Omarchy 4.5.0-3, UPower 1.91.5, kernel 7.2.15-omarchy, charge thresholds 75-80 % on both packs.
The combined capacity is the fix we were missing on dual-pack ThinkPads (#6885, #14798): bar and panel no longer describe only the idle internal pack. Cycles still come from the first pack, which seems fine for this fix; a per-pack view would be a separate enhancement. No regressions in the power panel (size, health, charge limit render as before). Happy to re-test on battery with the packs at different levels if that helps. |
|
Thank you! @maxwelhoener |
|
@maxwelhoener’s T480 test showed 46 Wh across both packs and preserved the 75–80% charge limit. Codex checked that result against the previous worker run, where the simulated panel reading changed from 98% to 37% and returned to 98% with the fix disabled. The CLI and focused shell checks passed on the worker, and Opus 5.5 High reviewed this commit and found no actionable issues. Verification still needs a linked issue reporter or maintainer to confirm the full SHA. @vcelletti, could you try |
|
Follow-up on the T480 (20L6SHKY00), this time on battery with the packs at different levels and with the external pack removed, as asked above. Tested exact commit
|
|
Codex checked the full-commit T480 follow-up against the earlier worker tests and the Opus 5.5 High review, which found no actionable issues. With the packs at different levels, the script read 74% and 46 Wh, matching UPower’s combined reading at the script’s precision. After BAT1 was removed it returned to 70% and 23 Wh, and the 75–80% charge limit held in all three cases. T480 test results Omabot’s verification check requires the hardware confirmation to come from a linked issue reporter or a maintainer, so this test does not satisfy that check. Tests and Check translation structure also still await maintainer approval. Pinned test instructions |




omarchy-battery-statusalways read the firstBAT*pack. Dual-battery laptops then showed the idle internal pack instead of the combined percentage.Use UPower's DisplayDevice only when more than one pack is enumerated. A single pack stays on that
BAT*device so the live sysfs wattage path still runs. DisplayDevice's native-path is not a sysfs battery node.Fixes #10244
Fixes #6885
Fixes #14798