#!/bin/bash

set -e

if test $# != 2; then
    die "Usage: $(basename $0) sensor_name start|stop
    You can use list-sensor-devs to get a list of all sensors,
    and write your current test application script accordingly."
fi

sensor=$1
shift

if test "$1" != start -a "$1" != stop; then
    die "Usage: $(basename $0) sensor_name [start|stop]"
fi

. $(dirname $0)/get-input-dev-activate-node

sensor_switch=$(get-input-dev-activate-node $sensor)
if test "$1" = start -o "$1" = on; then
    echo 1 > $sensor_switch
else 
    echo 0 > $sensor_switch
fi
