summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-01-04 23:08:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-01-04 23:08:57 +0000
commitef8edffe9d292eb00c2ab3e2c9d768e2fd79b06e (patch)
tree42646f9fc4eb1b7cc4f06648d2547d2a6812dd58 /sys/arch
parent3f808e58f9b1e56a31e679de60386c10cefbe115 (diff)
Support machdep.lidsuspend support in apm(4) land, at least on thinkpads
which have aps(4). You can now turn off the BIOS option for lid suspends, and control it with sysctl.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/apm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 2499dc6a556..fc6084fa87c 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.94 2010/09/09 04:13:15 deraadt Exp $ */
+/* $OpenBSD: apm.c,v 1.95 2011/01/04 23:08:56 deraadt Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -133,6 +133,7 @@ int cpu_apmwarn = 10;
#define APMDEV_CTL 8
int apm_standbys;
+int apm_lidclose;
int apm_userstandbys;
int apm_suspends;
int apm_resumes;
@@ -531,6 +532,12 @@ apm_periodic_check(struct apm_softc *sc)
if (apm_error || APM_ERR_CODE(&regs) == APM_ERR_NOTCONN)
ret = -1;
+ if (apm_lidclose) {
+ apm_lidclose = 0;
+ /* Fake a suspend request */
+ regs.bx = APM_SUSPEND_REQ;
+ apm_handle_event(sc, &regs);
+ }
if (apm_suspends /*|| (apm_battlow && apm_userstandbys)*/) {
apm_op_inprog = 0;
apm_suspend(APM_SYS_SUSPEND);