diff --git a/hosts/common/programs/sane-input-handler/sane-input-handler b/hosts/common/programs/sane-input-handler/sane-input-handler index 0d6109eb..a99d649f 100755 --- a/hosts/common/programs/sane-input-handler/sane-input-handler +++ b/hosts/common/programs/sane-input-handler/sane-input-handler @@ -61,6 +61,24 @@ KEYBOARD="${KEYBOARD:-wvkbd-mobintl}" action="$1" +showHelp() { + echo "usage: sane-input-handler " + echo "" + echo "where action is one of:" + echo "- power_tap_{1,2}" + echo "- power_hold" + echo "- power_tap_1_hold" + echo "- power_and_volup" + echo "- power_and_voldown" + echo "- power_then_volup" + echo "- power_then_voldown" + echo "- volup_tap_{1,2,3}" + echo "- volup_hold_{1,2,3}" + echo "- voldown_tap_{1,2,3}" + echo "- voldown_hold_{1,2,3}" + echo "- voldown_start" +} + log() { printf "sane-input-handler: %s\n" "$1" } @@ -242,19 +260,31 @@ dispatchInhibited() { esac } -_isAllOn="$(isAllOn && echo 1 || true)" +dispatchToplevel() { + _isAllOn="$(isAllOn && echo 1 || true)" -if [ -z "$_isAllOn" ]; then - dispatchOff -else - _isInhibited="$(isInhibited && echo 1 || true)" - if [ -n "$_isInhibited" ]; then - dispatchInhibited + if [ -z "$_isAllOn" ]; then + dispatchOff else - dispatchOn + _isInhibited="$(isInhibited && echo 1 || true)" + if [ -n "$_isInhibited" ]; then + dispatchInhibited + else + dispatchOn + fi fi -fi -dispatchDefault + dispatchDefault +} + +case "$action" in + (--help) + showHelp + exit 0 + ;; + (*) + dispatchToplevel + handleWith unmapped + ;; +esac -handleWith unmapped