From 240c14482a5a3514267d2f4ef1663425486c1a87 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 12 Jan 2022 15:05:38 +0000 Subject: [PATCH] toggle hw.power based on the ACDI SMR key if available ok kettenis@ --- sys/arch/arm64/dev/aplsmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/arch/arm64/dev/aplsmc.c b/sys/arch/arm64/dev/aplsmc.c index bdb95284033..80f9f52a4c8 100644 --- a/sys/arch/arm64/dev/aplsmc.c +++ b/sys/arch/arm64/dev/aplsmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplsmc.c,v 1.4 2022/01/12 13:08:06 robert Exp $ */ +/* $OpenBSD: aplsmc.c,v 1.5 2022/01/12 15:05:38 robert Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -361,6 +361,7 @@ aplsmc_read_key(struct aplsmc_softc *sc, uint32_t key, void *data, size_t len) void aplsmc_refresh_sensors(void *arg) { + extern int hw_power; struct aplsmc_softc *sc = arg; struct aplsmc_sensor *sensor; int64_t value; @@ -417,5 +418,8 @@ aplsmc_refresh_sensors(void *arg) sc->sc_sensors[i].flags &= ~SENSOR_FUNKNOWN; sc->sc_sensors[i].value = value; } + + if (strcmp(sensor->key, "ACDI") == 0) + hw_power = (value > 0); } } -- 2.20.1