From 26bcb60e80c4b95eca86908efc05597b3eddebce Mon Sep 17 00:00:00 2001 From: Marcus Glocker Date: Mon, 24 Jun 2024 15:56:08 +0000 Subject: 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@ --- sys/dev/acpi/acpibat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 * @@ -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); -- cgit v1.2.3