#!/bin/sh
#
# Called by switchevd with
# $1 = /dev/input/eventX - the device that triggered the switch event
# $2 = 00000000 - The switch bits status (in hex)

if [ -z "$1" -o -z "$2" ]; then
    echo "Incorrect usage"
    exit 1
fi

if [ "x$SWITCH_EVENT_ZHINGE" = "x1" -a -x /etc/zaurusd/scripts/zaurus-hinge ]; then
    /etc/zaurusd/scripts/zaurus-hinge $(( 0x$2 & 3 ))
fi

if [ "x$SWITCH_EVENT_ZMIXER" = "x1" -a -x /etc/zaurusd/scripts/zaurus-mixer ]; then
    /etc/zaurusd/scripts/zaurus-mixer $(( (0x$2 & 0x4) >> 2 ))
fi
