From 485d77feea6925a228f28a8140276719487c9b52 Mon Sep 17 00:00:00 2001 From: canacar Date: Sat, 7 Aug 2010 16:55:38 +0000 Subject: [PATCH] Generate power change events for APM. Makes powerup and powerdown scripts work with ACPI. ok deraadt@, phessler@, feedback kettenis@ --- sys/dev/acpi/acpiac.c | 5 ++++- sys/dev/acpi/acpibat.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpi/acpiac.c b/sys/dev/acpi/acpiac.c index 1e534c44703..d4b48cf0780 100644 --- a/sys/dev/acpi/acpiac.c +++ b/sys/dev/acpi/acpiac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiac.c,v 1.27 2009/03/11 20:37:46 jordan Exp $ */ +/* $OpenBSD: acpiac.c,v 1.28 2010/08/07 16:55:38 canacar Exp $ */ /* * Copyright (c) 2005 Marco Peereboom * @@ -16,11 +16,13 @@ */ #include +#include #include #include #include #include +#include #include #include @@ -95,6 +97,7 @@ acpiac_refresh(void *arg) acpiac_getsta(sc); sc->sc_sens[0].value = sc->sc_ac_stat; + acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); } int diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c index ee6bcdb9977..882846b6c60 100644 --- a/sys/dev/acpi/acpibat.c +++ b/sys/dev/acpi/acpibat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibat.c,v 1.56 2010/07/21 19:35:15 deraadt Exp $ */ +/* $OpenBSD: acpibat.c,v 1.57 2010/08/07 16:55:38 canacar Exp $ */ /* * Copyright (c) 2005 Marco Peereboom * @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -279,6 +280,7 @@ acpibat_refresh(void *arg) sc->sc_sens[7].status = SENSOR_S_UNSPEC; sc->sc_sens[7].flags = 0; } + acpi_record_event(sc->sc_acpi, APM_POWER_CHANGE); } int -- 2.20.1