Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

#!/bin/sh -
#
#	$NetBSD: sleep_button,v 1.11 2017/07/13 13:50:48 roy Exp $
#
# Generic script for sleep button events.
#
# Arguments passed by powerd(8):
#
#	device event

case "${2}" in
pressed)
	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
	;;

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