From: mglocker Date: Mon, 24 Jun 2024 15:56:07 +0000 (+0000) Subject: Some machines send AC change notifications to acpibat(4). Forward this X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6a17c0b7bcb83b86d761af696b661c135483e739;p=openbsd 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@ --- 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);