1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

upd(4): add PercentLoad sensor

Reports the % of the available UPS power drawed by output outlets.

tested by sthen@, matthieu@ and Walter Alejandro Iglesias
ok sthen@ as part of a larger diff
This commit is contained in:
landry 2024-12-01 09:05:05 +00:00
parent ac4b1d5777
commit 8e650cf52b
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: upd.4,v 1.5 2020/05/12 13:03:52 schwarze Exp $
.\" $OpenBSD: upd.4,v 1.6 2024/12/01 09:05:05 landry Exp $
.\"
.\" Copyright (c) 2014 Andre de Oliveira <andre@openbsd.org>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 12 2020 $
.Dd $Mdocdate: December 1 2024 $
.Dt UPD 4
.Os
.Sh NAME
@ -41,6 +41,8 @@ ShutdownImminent
.It
ACPresent
.It
PercentLoad
.It
Overload
.It
RelativeStateOfCharge

View File

@ -1,4 +1,4 @@
/* $OpenBSD: upd.c,v 1.32 2024/05/23 03:21:09 jsg Exp $ */
/* $OpenBSD: upd.c,v 1.33 2024/12/01 09:05:05 landry Exp $ */
/*
* Copyright (c) 2015 David Higgs <higgsd@gmail.com>
@ -60,6 +60,8 @@ static struct upd_usage_entry upd_usage_batdep[] = {
SENSOR_PERCENT, "RemainingCapacity" },
{ HUP_BATTERY, HUB_FULLCHARGE_CAPACITY,
SENSOR_PERCENT, "FullChargeCapacity" },
{ HUP_POWER, HUP_PERCENT_LOAD,
SENSOR_PERCENT, "PercentLoad" },
{ HUP_BATTERY, HUB_CHARGING,
SENSOR_INDICATOR, "Charging" },
{ HUP_BATTERY, HUB_DISCHARGING,
@ -411,6 +413,7 @@ upd_sensor_update(struct upd_softc *sc, struct upd_sensor *sensor,
case HUB_ABS_STATEOF_CHARGE:
case HUB_REM_CAPACITY:
case HUB_FULLCHARGE_CAPACITY:
case HUP_PERCENT_LOAD:
adjust = 1000; /* scale adjust */
break;
case HUB_ATRATE_TIMETOFULL: