Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0af90f6f authored by Todd Poynor's avatar Todd Poynor
Browse files

charger: dump pstore ram console DO NOT MERGE

Change-Id: I7f612d49418272e2ac867f64c10149ad616391cd
parent a91a47c3
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@
#define BATTERY_FULL_THRESH     95

#define LAST_KMSG_PATH          "/proc/last_kmsg"
#define LAST_KMSG_PSTORE_PATH   "/sys/fs/pstore/console-ramoops"
#define LAST_KMSG_MAX_SZ        (32 * 1024)

#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
@@ -211,11 +212,15 @@ static void dump_last_kmsg(void)
    LOGI("\n");
    LOGI("*************** LAST KMSG ***************\n");
    LOGI("\n");
    buf = load_file(LAST_KMSG_PSTORE_PATH, &sz);

    if (!buf || !sz) {
        buf = load_file(LAST_KMSG_PATH, &sz);
        if (!buf || !sz) {
            LOGI("last_kmsg not found. Cold reset?\n");
            goto out;
        }
    }

    len = min(sz, LAST_KMSG_MAX_SZ);
    ptr = buf + (sz - len);