Skip to content

Commit 2b35312

Browse files
authored
Merge c095216 into e308c36
2 parents e308c36 + c095216 commit 2b35312

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/mge-hid.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,19 @@ static const char *eaton_abm_check_chrg_fun(double value)
558558
if (advanced_battery_monitoring == ABM_UNKNOWN || advanced_battery_monitoring == ABM_DISABLED)
559559
{
560560
if (d_equal(value, 1)) {
561+
/* UPS.PowerSummary.PresentStatus.Charging stays asserted in
562+
* float/maintenance mode on CC-mode devices (e.g. Eaton 5E series)
563+
* that do not expose the ABM HID path. Suppress CHRG once the
564+
* battery is fully charged so that ups.status does not show a
565+
* persistent OL CHRG at 100%. */
566+
const char *charge_str = dstate_getinfo("battery.charge");
567+
if (charge_str != NULL) {
568+
double charge = strtod(charge_str, NULL);
569+
if (charge >= 100.0) {
570+
snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "!chrg");
571+
return mge_scratch_buf;
572+
}
573+
}
561574
snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "chrg");
562575
}
563576
else {

0 commit comments

Comments
 (0)