save backlight level and turn it off on lid close, restore on lid open

This commit is contained in:
macallan 2010-09-14 04:37:04 +00:00
parent 51ce031b55
commit 0b888e557e

View File

@ -1,6 +1,6 @@
#!/bin/sh -
#
# $NetBSD: lid_switch,v 1.5 2008/06/20 02:38:00 jmcneill Exp $
# $NetBSD: lid_switch,v 1.6 2010/09/14 04:37:04 macallan Exp $
#
# Generic script for lid switch events. We try to put the system to sleep.
#
@ -15,9 +15,15 @@ pressed)
#else
# /usr/sbin/apm -d -S
#fi
wsconsctl -d backlight >/tmp/backlight
wsconsctl -d -w backlight=0 >/dev/null
exit 0
;;
released)
if [ -f "/tmp/backlight" ]; then
wsconsctl -d -w `cat /tmp/backlight`
fi
exit 0
;;
*)
logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1