lid_switch revision 1.6
11.1Smycroft#!/bin/sh - 21.1Smycroft# 31.6Smacallan# $NetBSD: lid_switch,v 1.6 2010/09/14 04:37:04 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.5Sjmcneill #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 backlight >/tmp/backlight 191.6Smacallan wsconsctl -d -w backlight=0 >/dev/null 201.3Sjmcneill exit 0 211.3Sjmcneill ;; 221.3Sjmcneillreleased) 231.6Smacallan if [ -f "/tmp/backlight" ]; then 241.6Smacallan wsconsctl -d -w `cat /tmp/backlight` 251.6Smacallan fi 261.6Smacallan exit 0 271.3Sjmcneill ;; 281.1Smycroft*) 291.3Sjmcneill logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 301.1Smycroft exit 1 311.1Smycroftesac 32