Skip to content

Show the Surface Pro 11's battery cycle count from the Surface EC - #20484

Open
turbineBMW wants to merge 1 commit into
omacom:quattrofrom
turbineBMW:upstream/sp11-battery-cycles
Open

turbineBMW wants to merge 1 commit into
omacom:quattrofrom
turbineBMW:upstream/sp11-battery-cycles

Conversation

@turbineBMW

@turbineBMW turbineBMW commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

The Surface Pro 11's battery manager (qcom-battmgr-bat) reports cycle_count 0: the ADSP firmware sends no count, and it answers 0 to every per-property request too. The Surface EC has the real count, and microsoft-surface-pro-11-support (omacom/omarchy-pkgs#3782) reads it into /run/surface-pro-11-battery/cycle-count.

omarchy-battery-status now takes that file when the battery's cycle_count is 0 or missing. A real count from sysfs always wins, a file that isn't a number is ignored, and without the file a 0 is still shown as before. Other machines don't change.

Getting the count into the kernel's power supply instead would need either firmware that reports it or qcom_battmgr asking the Surface EC, which is a different driver on a different bus, so this reads the file the support package writes.

On the device: cycles 0 before, cycles 149 after, which matches the EC. test/shell.d/battery-status-test.sh covers the 0, missing, real-count and unreadable-file cases.

The Surface Pro 11's battery manager reports cycle_count 0: its ADSP
firmware keeps no count. The Surface EC does, and
microsoft-surface-pro-11-support writes it to
/run/surface-pro-11-battery/cycle-count. omarchy-battery-status takes
that file when the battery's own count is 0 or missing; a real count
still wins and a file that isn't a number is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds a Surface EC fallback for the battery cycle count.

  • Battery status fills in missing or zero cycle counts from the Surface EC.

Reviews (3) · Last reviewed commit: "Show the Surface Pro 11's battery cycle ..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Nov 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6.2 Sol High in Codex, Opus 5.5 High and Muse Wonder High reviewed the fallback, its tests and the Power panel from source. We agreed the fallback matches the decimal count published by the proposed Surface support package. The reviews’ independence is unconfirmed. Worker tests and screenshots were skipped because the required release-branch protection could not be confirmed. Companion package PR

The companion package is still a draft. The fallback also touches the same cycle-count block as #12484, which makes unavailable counts display as unknown. If that change lands first, the fallback and its tests will need to account for the new behavior.

Once the updated support package is available, could a maintainer with a Surface Pro 11 confirm the before and after readings? Check out 0db1236ead39b700056d941bc77a1bf6a5a8838d and link it with omarchy dev link /path/to/checkout. After reboot, compare the Power panel and omarchy-battery-status --shell with /run/surface-pro-11-battery/cycle-count.

@chessing234

Copy link
Copy Markdown
Contributor

your commit is in #21013. the Surface EC cycle count is read in the same battery-status script as the locale-pinned time parser and the charger draw. @dhh @omarchybot if 21013 lands, this can close as superseded.

@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 High in Codex, Opus 5.5 High and Muse Wonder via pi at high effort checked the current base and the overlapping patch. We agreed that #21013 includes this exact fallback and its tests in 287ad921e8. The reviews’ independence is unconfirmed. Integration PR #21013

#20881 removed the Power panel’s Charge cycles row. With the companion package installed, this change would now affect omarchy-battery-status --shell and omarchy-debug. The companion package is still a draft, and hardware verification remains outstanding. The maintainer can decide whether to keep the diagnostic reading. Power panel change Companion package PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants