summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/dev
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-02-26 17:19:48 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-02-26 17:19:48 +0000
commit1b0c7d8f045e292360d8b3b7e0cf000c18ce1cb2 (patch)
tree10398925663347dafd1909d8a4b4492736f22212 /sys/arch/macppc/dev
parentea40a2de385d5e8b5b0fb8ebdd11092a68306c43 (diff)
Add a two new ioctls to the apm(4) interface.
APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend where a call to zzz suspended the machine immediately, not giving anyone listening for apm events (other than apmd) a chance to deal with the upcoming change. This hit X hard since the introduction of drm, since it needs to have time to idle the 3d engine and otherwise get the device into a recoverable state. Such things are needed until we support modesetting in the kernel. Now, instead of forcing a suspend, using ioctl sends out an event similar to if you had put the lid down, giving all userland applications a chance to reply. tested by sthen@ and beck@, especial thanks to sthen for sitting there while I tried to debug this remotely, I owe him beer. Prompted by and ok deraadt@
Diffstat (limited to 'sys/arch/macppc/dev')
-rw-r--r--sys/arch/macppc/dev/apm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/arch/macppc/dev/apm.c b/sys/arch/macppc/dev/apm.c
index 68b594ed9c2..03b23391551 100644
--- a/sys/arch/macppc/dev/apm.c
+++ b/sys/arch/macppc/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.13 2007/12/11 15:44:00 tedu Exp $ */
+/* $OpenBSD: apm.c,v 1.14 2009/02/26 17:19:47 oga Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -286,7 +286,14 @@ apmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
power->battery_state = APM_BATT_LOW;
}
break;
-
+ case APM_IOC_STANDBY_REQ:
+ if ((flag & FWRITE) == 0)
+ error = EBADF;
+ break;
+ case APM_IOC_SUSPEND_REQ:
+ if ((flag & FWRITE) == 0)
+ error = EBADF;
+ break;
default:
error = ENOTTY;
}