#!/bin/sh
# Copyright 2005 messenjer
# Distributed under the terms of the GNU General Public License v2

PATH=/sbin:/bin

. /lib/lsb/init-functions

if ! test -e /proc/acpi/sony/fnkey ; then
    log_failure_msg "Sony acpi key handler not found"
    exit 1
fi

case "$1" in
    start)
        log_begin_msg "Starting fsfn key handler"
        start-stop-daemon --start \
                    --nicelevel 10 \
                    --pidfile /var/run/fsfn.pid \
                    -x "/usr/local/bin/fsfn"
        log_end_msg $?
    ;;
    stop)
        log_begin_msg "Stopping fsfn key handler"
        start-stop-daemon --stop --pidfile /var/run/fsfn.pid
        log_end_msg $?
    ;;
    *)
        log_success_msg "Usage: /etc/init.d/fsfn {start|stop}"
        exit 1
esac

exit 0
