From 0ebc3444e13935a453808f08eedd88397e7f2302 Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 3 Apr 2023 13:38:18 +0000 Subject: [PATCH] acpibtn_notify: ignore duplicate ACPI lid transitions A Dell Precision 5510 produces two _LID events when the lid is closed. This results in acpibtn_notify() adding two sleep tasks. The laptop suspends and resumes successfully, but on resume the second sleep task runs and it goes right back to sleep. Making the lid transition a no-op when the existing value matches new _LID value works around the problem. OK miod@ jcs@ --- sys/dev/acpi/acpibtn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpi/acpibtn.c b/sys/dev/acpi/acpibtn.c index d9254850c8e..a16cb32ab0a 100644 --- a/sys/dev/acpi/acpibtn.c +++ b/sys/dev/acpi/acpibtn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibtn.c,v 1.49 2022/04/06 18:59:27 naddy Exp $ */ +/* $OpenBSD: acpibtn.c,v 1.50 2023/04/03 13:38:18 millert Exp $ */ /* * Copyright (c) 2005 Marco Peereboom * @@ -232,6 +232,8 @@ acpibtn_notify(struct aml_node *node, int notify_type, void *arg) if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_LID", 0, NULL, &lid)) return (0); + if (sc->sc_sens.value == lid) + break; sc->sc_sens.value = lid; if (lid != 0) -- 2.20.1