# Calculate comment=# chmod=0755
#!/sbin/openrc-run
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/files/acpid-2.0.3-init.d,v 1.1 2010/04/04 16:39:09 ssuominen Exp $

depend() {
	after *
}

start() {
	ebegin "Configure laptop"
	setkeycodes e002 227   # Fn+F4 maps to switchvidmode
	setkeycodes e003 236   # Fn+F2 maps to battery
	setkeycodes e004 148   # Fn+F5 maps to prog1
	setkeycodes e006 238   # Fn+F9 maps to wlan
#?load(char,/sys/bus/pci/devices/0000:00:02.0/vendor,root)!=0x8086||load(char,/sys/bus/pci/devices/0000:00:02.0/device,root)!=0x2a42#
	setkeycodes e008 225   # Fn+Up maps to brightnessup
	setkeycodes e009 224   # Fn+Dn maps to brightnessdown
#!load#
	setkeycodes e008 230   # Fn+Up maps to brightnessup
	setkeycodes e009 229   # Fn+Dn maps to brightnessdown
	/usr/bin/backlight set aa
#load#
	setkeycodes e031 149   # Fn+F7 maps to prog2
	setkeycodes e033 202   # Fn+F8 maps to prog3
	setkeycodes e077 191   # Fn+F10 maps to F21 whenever the touchpad is enabled
	setkeycodes e079 192   # Fn+F10 maps to F22 whenever the touchpad is disabled

	# Ensure key release events occur for all except Fn+F7, which properly reports a key release for some reason
	echo 130,131,132,134,136,137,179,247,249 > /sys/devices/platform/i8042/serio0/force_release
	eend $?
}

stop() {
	eend 0
}

