From 307efbb999647fd7eec2f285f8977bb4a71289d5 Mon Sep 17 00:00:00 2001 From: Mitchell Scott <10804314+rmitchellscott@users.noreply.github.com> Date: Sat, 1 Nov 2025 08:01:29 -0600 Subject: [PATCH] fix(paper pro family): Reset error count for next boot partition --- main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.go b/main.go index adb3bfe..aebb4b4 100644 --- a/main.go +++ b/main.go @@ -777,6 +777,19 @@ func switchPaperProBootPartition(newPart int, targetVersion string) error { newPartLabel = "b" } + // Reset error count for target partition + errCntPath := fmt.Sprintf("/sys/devices/platform/lpgpr/root%s_errcnt", newPartLabel) + if err := os.WriteFile(errCntPath, []byte("0"), 0644); err != nil { + fmt.Printf("Warning: Could not reset error count at %s: %v\n", errCntPath, err) + if *debug { + logToFile(fmt.Sprintf("Warning: Failed to reset error count: %v", err)) + } + } else { + if *debug { + logToFile(fmt.Sprintf("Reset error count at %s", errCntPath)) + } + } + // Step 1: If current version is < 3.22, write to sysfs (for current OS to boot correctly) if !currentIsNew { if err := os.WriteFile("/sys/devices/platform/lpgpr/root_part", []byte(newPartLabel), 0644); err != nil {