From 21a344671779a0a72dde98698a89ee7f318675c0 Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 14 Nov 2022 11:11:17 +0000 Subject: [PATCH] Turns out the power button on the Mac mini and the touchid button on the various Macbook models generate different events. So rename the existing constant for a "short press" of the touchid button and add support for the power button on the Mac mini such that is can be resumed. ok tobhe@, patrick@ --- sys/arch/arm64/dev/aplsmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arch/arm64/dev/aplsmc.c b/sys/arch/arm64/dev/aplsmc.c index e2b618e63f9..e3a82a7dd6f 100644 --- a/sys/arch/arm64/dev/aplsmc.c +++ b/sys/arch/arm64/dev/aplsmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aplsmc.c,v 1.17 2022/11/10 23:21:15 kettenis Exp $ */ +/* $OpenBSD: aplsmc.c,v 1.18 2022/11/14 11:11:17 kettenis Exp $ */ /* * Copyright (c) 2021 Mark Kettenis * @@ -92,7 +92,8 @@ struct aplsmc_sensor { /* Button events */ #define SMC_PWRBTN_OFF 0x00 -#define SMC_PWRBTN_SHORT 0x06 +#define SMC_PWRBTN_SHORT 0x01 +#define SMC_PWRBTN_TOUCHID 0x06 #define SMC_PWRBTN_LONG 0xfe #define APLSMC_BE (1 << 0) @@ -346,6 +347,7 @@ aplsmc_handle_notification(struct aplsmc_softc *sc, uint64_t data) case SMC_EV_TYPE_BTN: switch (SMC_EV_SUBTYPE(data)) { case SMC_PWRBTN_SHORT: + case SMC_PWRBTN_TOUCHID: if (SMC_EV_DATA(data) == 1) { #ifdef SUSPEND if (cpu_suspended) { -- 2.20.1