summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2024-06-24 15:56:08 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2024-06-24 15:56:08 +0000
commit26bcb60e80c4b95eca86908efc05597b3eddebce (patch)
tree3182a310a08346a1f49aad3ab868b4646c45881d
parent76decfdb3304e5a7dea81a62c999a8d24442fb42 (diff)
Some machines send AC change notifications to acpibat(4). Forward this
notification to acpiac(4), so that the AC status can be reflected correctly to programs like apm(8). This for example fixes the AC status on the Microsoft Surface Go 4. Help from kettenis@ ok deraadt@, kettenis@
-rw-r--r--sys/dev/acpi/acpibat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c
index e880ccd45fa..75b6a1e44e8 100644
--- a/sys/dev/acpi/acpibat.c
+++ b/sys/dev/acpi/acpibat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpibat.c,v 1.70 2022/04/06 18:59:27 naddy Exp $ */
+/* $OpenBSD: acpibat.c,v 1.71 2024/06/24 15:56:07 mglocker Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -525,6 +525,12 @@ acpibat_notify(struct aml_node *node, int notify_type, void *arg)
case 0x00: /* Poll sensors */
case 0x80: /* _BST changed */
acpibat_getbst(sc);
+ /*
+ * On some machines the Power Source Device doesn't get
+ * notified when the AC adapter is plugged or unplugged,
+ * but the battery does get notified.
+ */
+ aml_notify_dev(ACPI_DEV_AC, 0x80);
break;
case 0x81: /* _BIF/_BIX changed */
acpibat_getbix(sc);