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

Commit 3282861b authored by Johan Redestig's avatar Johan Redestig
Browse files

Add support for USB_HVDCP chargers

and print a warning message containing the type
when the battery monitor fails to recognize a power supply.

Change-Id: I02ebd89736f7444f8bf7f28550afeec82d57e107
parent f330e546
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String
            { "Mains", ANDROID_POWER_SUPPLY_TYPE_AC },
            { "USB", ANDROID_POWER_SUPPLY_TYPE_USB },
            { "USB_DCP", ANDROID_POWER_SUPPLY_TYPE_AC },
            { "USB_HVDCP", ANDROID_POWER_SUPPLY_TYPE_AC },
            { "USB_CDP", ANDROID_POWER_SUPPLY_TYPE_AC },
            { "USB_ACA", ANDROID_POWER_SUPPLY_TYPE_AC },
            { "USB_C", ANDROID_POWER_SUPPLY_TYPE_AC },
@@ -147,8 +148,10 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String
        return ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;

    ret = (BatteryMonitor::PowerSupplyType)mapSysfsString(buf, supplyTypeMap);
    if (ret < 0)
    if (ret < 0) {
        KLOG_WARNING(LOG_TAG, "Unknown power supply type '%s'\n", buf);
        ret = ANDROID_POWER_SUPPLY_TYPE_UNKNOWN;
    }

    return ret;
}