Repository navigation
Conversation
Some HP/ACPI firmware exposes a readable power_now whose read() fails, so [[ -r ]] passes but the value is empty and awk coerces it to 0W. Only trust numeric reads, otherwise keep UPower energy-rate. Fixes omacom#6895.
|
No actionable issue found in source review of Verified by source inspection: The two added regression cases cover empty Review informationTest scope: Source inspection of the changed script and regression tests. No runtime-validation claim; actual firmware Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review. Automated AI review: Astra Medium initial inspection, independent Opus 5.5 High and GPT 6 Sol Xhigh technical assessments, followed by Astra synthesis and verification of the stated claims against the source. |
|
Reviewed at Reproduction: with UPower stubbed at 16.8W, I pointed Second opinion: none. The configured reviewer (Codex Medium) was out of its daily review budget, so this rests on one model's review (Claude Opus 5.5). Related: this also fixes #12735, the same ENODEV report from a second HP Pavilion, which is now linked. #12755 makes the same change to the same lines. #13009 and #13111 rework the same block to handle numeric but implausible readings, a different failure; whichever lands first will conflict with the others. Waiting on a second opinion before this can be marked ready, then on the maintainer. |
|
Tested this on an HP laptop (Omarchy 4.0.4) with the same What this machine exposes while discharging:
UPower presumably gets its rate from the same Suggested follow-up: estimate from charge movementWhen the guarded sysfs reads and UPower both give 0 while the battery is The panel already re-runs the script every 5 s while open, so it fills in after about a minute (0W until then) and settles as the window grows. On this machine it reads a plausible 4–6 W at idle. Machines with a working I also folded the reads into a small Diff on top of this PR (
|
|
Thanks for the field report — this is exactly the case #12649 doesn't cover, and I'd rather you filed it than sat on it waiting. It doesn't need to wait for #12649. The patch is written as a diff on Two things in the patch I'd want fixed before it goes up for review: 1. 2. Two smaller notes, take or leave:
On triage, so you're not surprised: this one won't verify automatically. The repro is specific to your firmware, so expect to be asked to justify the 15-minute retention window and the 60s warmup, and writing both rate and time-remaining from accumulated on-disk state is a larger surface than a read-guard. That's appropriate scrutiny rather than an objection — it's just the right call for what it's doing. #12649 is up and |
The guard for unreadable sysfs reads risks rejecting valid firmware values instead of just failed ones, and power_now had no coverage at all: the fixture only ever created it empty. Pin the happy path so an over-tight regex fails here rather than silently degrading to UPower's rate on real hardware.
|
|
Re-reviewed at Reproduction: with UPower stubbed at 16.8W, a Second opinion: Codex Medium reviewed the change and found nothing to fix, agreeing with this review; independence between the two is not guaranteed. Asked to choose between this and #12755 without being told an answer, it chose this one: #12755 also tries Related: #12755 makes the same fix and is newer. #13009 and #13111 handle numeric but implausible readings, a different failure, and will conflict with this block whichever lands first. The case @chiazaekpele reported, where UPower's own rate is also 0W, is outside what this fixes. Waiting on the maintainer. |
|
Still a real bug on live quattro: readable-but-ENODEV Near-duplicate open PR #12755 (“fail or are non-numeric”) looks like the broader fix; #13111 is related (implausible sysfs rate → UPower). Prefer #12755 and close this as duplicate once it covers the empty-read case (your tests for empty power_now/current_now are worth carrying over). |
|
The collapse to one is right, and agreed the empty-read tests should carry over — that's the part I'd insist on. One correction on the premise: #12755 already covers the empty-read code path ( For the record, it's also not purely broader — I've offered @anandude a deal on #12755: they take the signed regex and my two empty-read tests, I close this one in their favour. |
|
Compared the PRs for the 0 W power reading when sysfs
#12649 is the one to merge: it passes every case, keeps the live sysfs reading when it is good, and already closes #6895 and #12735. #12755, #15541, #15389 and #15377 fix the same bug and can be closed as duplicates; #13009 and #13111 cover it too as part of larger plausibility checks and both conflict. Suggestion: add |
|
Adding the one row where these two actually differ, since it decides whether they are duplicates. The difference is where the numeric guard sits. #12649 keeps the outer Measured just now on one stub harness (UPower 5.5W;
They agree everywhere except the readable-but-unusable case, where #12755 reports the live sensor and #12649 reports UPower's lagging rate. Both are a long way from the 0W in #15373, so neither leaves the bug open — it is a difference in which non-zero number the panel shows, and that extra path is the case the last review on #12755 turned on. Not arguing for either: both are green on |
|
Closing in favour of #12755, as I said I would once it was green and back to The negative- One row for the record, not an objection: on a readable-but-unusable @paulogeyer — your harness pointed at this PR, so flagging that I've gone the other way on that one row rather than on your table, which I think is right as measured. #15373 is the newest report of the same fault and should carry the |
…mment The issue it points at is closed, so the comparison cannot be followed up.
Single-battery HP/ACPI machines expose a
power_nowthat passes[[ -r ]]but whoseread()fails withENODEV, so the script gets""andawkcoerces it to0W, discarding UPower's correctenergy-rate(~16-30W).Only trust numeric sysfs reads, otherwise keep UPower's
energy-rate. Same guard for thecurrent_now/voltage_nowfallback, which had the identical coerce-to-0 hole.Split out from #6845 per @bjarneo's request — that PR grew to cover 3 failure modes and was closed as a dup of #10392, which only handles multi-battery percentage and keeps this bug. This is the minimal fix for #6895 with regression tests for both empty-read cases.
Fixes #6895.
Extracted from #6845 (
3c40745).Verified: existing
battery-status-test.sh+ 2 new ENODEV cases pass.Fixes #12735
Edit: adds a regression case for the numeric
power_nowpath (6a29528d). The guard's real risk is rejecting valid firmware values rather than only failed reads, andpower_nowpreviously had no coverage at all — the fixture only ever created it empty.This is one of four open PRs on this block. #13009 and #13111 address a different failure: the read succeeds but the value is implausible. Those guards are complementary rather than competing, so whichever lands first should keep both. #12755 is a near-duplicate of this PR; the comparison is posted there.