Skip to content

Commit 45b513f

Browse files
feat(paper pro family): Reset error count for next boot partition (#20)
1 parent 21469a5 commit 45b513f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,19 @@ func switchPaperProBootPartition(newPart int, targetVersion string) error {
777777
newPartLabel = "b"
778778
}
779779

780+
// Reset error count for target partition
781+
errCntPath := fmt.Sprintf("/sys/devices/platform/lpgpr/root%s_errcnt", newPartLabel)
782+
if err := os.WriteFile(errCntPath, []byte("0"), 0644); err != nil {
783+
fmt.Printf("Warning: Could not reset error count at %s: %v\n", errCntPath, err)
784+
if *debug {
785+
logToFile(fmt.Sprintf("Warning: Failed to reset error count: %v", err))
786+
}
787+
} else {
788+
if *debug {
789+
logToFile(fmt.Sprintf("Reset error count at %s", errCntPath))
790+
}
791+
}
792+
780793
// Step 1: If current version is < 3.22, write to sysfs (for current OS to boot correctly)
781794
if !currentIsNew {
782795
if err := os.WriteFile("/sys/devices/platform/lpgpr/root_part", []byte(newPartLabel), 0644); err != nil {

0 commit comments

Comments
 (0)