From: millert Date: Mon, 3 Apr 2023 13:38:18 +0000 (+0000) Subject: acpibtn_notify: ignore duplicate ACPI lid transitions X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0ebc3444e13935a453808f08eedd88397e7f2302;p=openbsd 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@ --- 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)