xref: /netbsd-src/etc/powerd/scripts/lid_switch (revision e26a5e9d52ff33a04636578ddea151cb2c93b369)
187c704caSmycroft#!/bin/sh -
287c704caSmycroft#
3*e26a5e9dSjruoho#	$NetBSD: lid_switch,v 1.9 2010/12/31 09:33:10 jruoho Exp $
487c704caSmycroft#
5*e26a5e9dSjruoho# Generic script for lid switch events.
687c704caSmycroft#
787c704caSmycroft# Arguments passed by powerd(8):
887c704caSmycroft#
987c704caSmycroft#	device event
1087c704caSmycroft
1187c704caSmycroftcase "${2}" in
12d54c2134Sjmcneillpressed)
13*e26a5e9dSjruoho
14*e26a5e9dSjruoho	# If you want to put the system into sleep when the lid
15*e26a5e9dSjruoho	# is closed, see the sleep_button -script for examples.
16*e26a5e9dSjruoho	#
170b888e55Smacallan	wsconsctl -d -w backlight=0 >/dev/null
18d54c2134Sjmcneill	exit 0
1987c704caSmycroft	;;
20*e26a5e9dSjruoho
21d54c2134Sjmcneillreleased)
223f7245fdSmacallan	wsconsctl -d -w backlight=1 >/dev/null
230b888e55Smacallan	exit 0
24d54c2134Sjmcneill	;;
25*e26a5e9dSjruoho
26d54c2134Sjmcneill*)
27d54c2134Sjmcneill	logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
28d54c2134Sjmcneill	exit 1
2987c704caSmycroftesac
30