1 1.1 mycroft #!/bin/sh - 2 1.1 mycroft # 3 1.7 abs # $NetBSD: lid_switch,v 1.7 2010/09/19 21:47:28 abs Exp $ 4 1.1 mycroft # 5 1.4 jnemeth # Generic script for lid switch events. We try to put the system to sleep. 6 1.1 mycroft # 7 1.1 mycroft # Arguments passed by powerd(8): 8 1.1 mycroft # 9 1.1 mycroft # device event 10 1.1 mycroft 11 1.1 mycroft case "${2}" in 12 1.3 jmcneill pressed) 13 1.7 abs #if /etc/rc.d/apmd onestatus >/dev/null ; then 14 1.5 jmcneill # /usr/sbin/apm -S 15 1.5 jmcneill #else 16 1.5 jmcneill # /usr/sbin/apm -d -S 17 1.5 jmcneill #fi 18 1.6 macallan wsconsctl -d backlight >/tmp/backlight 19 1.6 macallan wsconsctl -d -w backlight=0 >/dev/null 20 1.3 jmcneill exit 0 21 1.3 jmcneill ;; 22 1.3 jmcneill released) 23 1.6 macallan if [ -f "/tmp/backlight" ]; then 24 1.6 macallan wsconsctl -d -w `cat /tmp/backlight` 25 1.6 macallan fi 26 1.6 macallan exit 0 27 1.3 jmcneill ;; 28 1.1 mycroft *) 29 1.3 jmcneill logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 30 1.1 mycroft exit 1 31 1.1 mycroft esac 32