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

Commit ebeb0c0e authored by Todd Poynor's avatar Todd Poynor
Browse files

healthd: use warning level for info logs

To allow healthd/charger info to appear in systems where the loglevel
has been bumped to squelch chatty drivers.

Change-Id: I4ab135765700d7584a1ce5d972ea473d77f299f8
parent 40af0929
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -265,7 +265,7 @@ bool BatteryMonitor::update(void) {
                 "battery none");
                 "battery none");
        }
        }


        KLOG_INFO(LOG_TAG, "%s chg=%s%s%s\n", dmesgline,
        KLOG_WARNING(LOG_TAG, "%s chg=%s%s%s\n", dmesgline,
                     props.chargerAcOnline ? "a" : "",
                     props.chargerAcOnline ? "a" : "",
                     props.chargerUsbOnline ? "u" : "",
                     props.chargerUsbOnline ? "u" : "",
                     props.chargerWirelessOnline ? "w" : "");
                     props.chargerWirelessOnline ? "w" : "");
@@ -512,7 +512,7 @@ void BatteryMonitor::init(struct healthd_config *hc) {
    if (!mChargerNames.size())
    if (!mChargerNames.size())
        KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
        KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
    if (!mBatteryDevicePresent) {
    if (!mBatteryDevicePresent) {
        KLOG_INFO(LOG_TAG, "No battery devices found\n");
        KLOG_WARNING(LOG_TAG, "No battery devices found\n");
        hc->periodic_chores_interval_fast = -1;
        hc->periodic_chores_interval_fast = -1;
        hc->periodic_chores_interval_slow = -1;
        hc->periodic_chores_interval_slow = -1;
    } else {
    } else {
+15 −15
Original line number Original line Diff line number Diff line
@@ -75,7 +75,7 @@ char *locale;
#define LAST_KMSG_MAX_SZ        (32 * 1024)
#define LAST_KMSG_MAX_SZ        (32 * 1024)


#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0)
#define LOGI(x...) do { KLOG_INFO("charger", x); } while (0)
#define LOGW(x...) do { KLOG_WARNING("charger", x); } while (0)
#define LOGV(x...) do { KLOG_DEBUG("charger", x); } while (0)
#define LOGV(x...) do { KLOG_DEBUG("charger", x); } while (0)


struct key_state {
struct key_state {
@@ -198,15 +198,15 @@ static void dump_last_kmsg(void)
    unsigned sz = 0;
    unsigned sz = 0;
    int len;
    int len;


    LOGI("\n");
    LOGW("\n");
    LOGI("*************** LAST KMSG ***************\n");
    LOGW("*************** LAST KMSG ***************\n");
    LOGI("\n");
    LOGW("\n");
    buf = (char *)load_file(LAST_KMSG_PSTORE_PATH, &sz);
    buf = (char *)load_file(LAST_KMSG_PSTORE_PATH, &sz);


    if (!buf || !sz) {
    if (!buf || !sz) {
        buf = (char *)load_file(LAST_KMSG_PATH, &sz);
        buf = (char *)load_file(LAST_KMSG_PATH, &sz);
        if (!buf || !sz) {
        if (!buf || !sz) {
            LOGI("last_kmsg not found. Cold reset?\n");
            LOGW("last_kmsg not found. Cold reset?\n");
            goto out;
            goto out;
        }
        }
    }
    }
@@ -225,7 +225,7 @@ static void dump_last_kmsg(void)


        yoink = ptr[cnt];
        yoink = ptr[cnt];
        ptr[cnt] = '\0';
        ptr[cnt] = '\0';
        klog_write(6, "<6>%s", ptr);
        klog_write(6, "<4>%s", ptr);
        ptr[cnt] = yoink;
        ptr[cnt] = yoink;


        len -= cnt;
        len -= cnt;
@@ -235,9 +235,9 @@ static void dump_last_kmsg(void)
    free(buf);
    free(buf);


out:
out:
    LOGI("\n");
    LOGW("\n");
    LOGI("************* END LAST KMSG *************\n");
    LOGW("************* END LAST KMSG *************\n");
    LOGI("\n");
    LOGW("\n");
}
}


static int get_battery_capacity()
static int get_battery_capacity()
@@ -527,10 +527,10 @@ static void process_key(struct charger *charger, int code, int64_t now)
                   all devices. Check the property and continue booting or reboot
                   all devices. Check the property and continue booting or reboot
                   accordingly. */
                   accordingly. */
                if (property_get_bool("ro.enable_boot_charger_mode", false)) {
                if (property_get_bool("ro.enable_boot_charger_mode", false)) {
                    LOGI("[%" PRId64 "] booting from charger mode\n", now);
                    LOGW("[%" PRId64 "] booting from charger mode\n", now);
                    property_set("sys.boot_from_charger_mode", "1");
                    property_set("sys.boot_from_charger_mode", "1");
                } else {
                } else {
                    LOGI("[%" PRId64 "] rebooting\n", now);
                    LOGW("[%" PRId64 "] rebooting\n", now);
                    android_reboot(ANDROID_RB_RESTART, 0, 0);
                    android_reboot(ANDROID_RB_RESTART, 0, 0);
                }
                }
            } else {
            } else {
@@ -568,10 +568,10 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
        request_suspend(false);
        request_suspend(false);
        if (charger->next_pwr_check == -1) {
        if (charger->next_pwr_check == -1) {
            charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME;
            charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME;
            LOGI("[%" PRId64 "] device unplugged: shutting down in %" PRId64 " (@ %" PRId64 ")\n",
            LOGW("[%" PRId64 "] device unplugged: shutting down in %" PRId64 " (@ %" PRId64 ")\n",
                 now, (int64_t)UNPLUGGED_SHUTDOWN_TIME, charger->next_pwr_check);
                 now, (int64_t)UNPLUGGED_SHUTDOWN_TIME, charger->next_pwr_check);
        } else if (now >= charger->next_pwr_check) {
        } else if (now >= charger->next_pwr_check) {
            LOGI("[%" PRId64 "] shutting down\n", now);
            LOGW("[%" PRId64 "] shutting down\n", now);
            android_reboot(ANDROID_RB_POWEROFF, 0, 0);
            android_reboot(ANDROID_RB_POWEROFF, 0, 0);
        } else {
        } else {
            /* otherwise we already have a shutdown timer scheduled */
            /* otherwise we already have a shutdown timer scheduled */
@@ -579,7 +579,7 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
    } else {
    } else {
        /* online supply present, reset shutdown timer if set */
        /* online supply present, reset shutdown timer if set */
        if (charger->next_pwr_check != -1) {
        if (charger->next_pwr_check != -1) {
            LOGI("[%" PRId64 "] device plugged in: shutdown cancelled\n", now);
            LOGW("[%" PRId64 "] device plugged in: shutdown cancelled\n", now);
            kick_animation(charger->batt_anim);
            kick_animation(charger->batt_anim);
        }
        }
        charger->next_pwr_check = -1;
        charger->next_pwr_check = -1;
@@ -678,7 +678,7 @@ void healthd_mode_charger_init(struct healthd_config* /*config*/)


    dump_last_kmsg();
    dump_last_kmsg();


    LOGI("--------------- STARTING CHARGER MODE ---------------\n");
    LOGW("--------------- STARTING CHARGER MODE ---------------\n");


    ret = ev_init(input_callback, charger);
    ret = ev_init(input_callback, charger);
    if (!ret) {
    if (!ret) {