[BACK]Return to sleep_button CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc / powerd / scripts

File: [cvs.NetBSD.org] / src / etc / powerd / scripts / sleep_button (download)

Revision 1.10, Mon Oct 17 23:27:41 2011 UTC (12 years, 4 months ago) by jmcneill
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb8-mediatek-base, matt-nb8-mediatek, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, localcount-20160914, khorben-n900, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, agc-symver-base, agc-symver
Branch point for: netbsd-7
Changes since 1.9: +7 -3 lines

restart dhcpcd if we get a "released" event from the vmt0 driver

#!/bin/sh -
#
#	$NetBSD: sleep_button,v 1.10 2011/10/17 23:27:41 jmcneill Exp $
#
# Generic script for sleep button events.
#
# Arguments passed by powerd(8):
#
#	device event

case "${2}" in
pressed)

	/etc/rc.d/bluetooth stop
	/etc/rc.d/ntpd stop
	/etc/rc.d/dhclient stop
	/etc/rc.d/network stop
	/etc/rc.d/wpa_supplicant stop

	if /sbin/sysctl -q hw.acpi.sleep.state; then
		/sbin/sysctl -w hw.acpi.sleep.state=3
	elif /sbin/sysctl -q machdep.xen.suspend; then
		/sbin/sysctl -w machdep.xen.suspend=1
	else
		sleep 1
		if /etc/rc.d/apmd onestatus >/dev/null ; then
			/usr/sbin/apm -z
		else
			/usr/sbin/apm -d -z
		fi
		# ... waking up
		sleep 1
	fi

	/etc/rc.d/wpa_supplicant start
	/etc/rc.d/network start
	/etc/rc.d/dhclient start
	/etc/rc.d/ntpdate start
	/etc/rc.d/ntpd start
	/etc/rc.d/bluetooth start
	;;

released)
	case "${1}" in
	vmt0)
		# Virtual machine is resuming, restart the network
		/etc/rc.d/dhcpcd restart
		;;
	esac
	;;
*)
	logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
	exit 1
	;;
esac