lid_switch revision 1.8
11.1Smycroft#!/bin/sh -
21.1Smycroft#
31.8Smacallan#	$NetBSD: lid_switch,v 1.8 2010/10/28 02:06:02 macallan Exp $
41.1Smycroft#
51.4Sjnemeth# Generic script for lid switch events.  We try to put the system to sleep.
61.1Smycroft#
71.1Smycroft# Arguments passed by powerd(8):
81.1Smycroft#
91.1Smycroft#	device event
101.1Smycroft
111.1Smycroftcase "${2}" in
121.3Sjmcneillpressed)
131.8Smacallan	#if /etc/rc.d/apmd status >/dev/null ; then
141.5Sjmcneill	#	/usr/sbin/apm -S
151.5Sjmcneill	#else
161.5Sjmcneill	#	/usr/sbin/apm -d -S
171.5Sjmcneill	#fi
181.6Smacallan	wsconsctl -d -w backlight=0 >/dev/null
191.3Sjmcneill	exit 0
201.3Sjmcneill	;;
211.3Sjmcneillreleased)
221.8Smacallan	wsconsctl -d -w backlight=1 >/dev/null
231.6Smacallan	exit 0
241.3Sjmcneill	;;
251.1Smycroft*)
261.3Sjmcneill	logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
271.1Smycroft	exit 1
281.1Smycroftesac
29