sane-input-handler: add a --help command

This commit is contained in:
2024-05-30 12:30:41 +00:00
parent 847414ac1f
commit 3fdeacc336

View File

@@ -61,6 +61,24 @@ KEYBOARD="${KEYBOARD:-wvkbd-mobintl}"
action="$1" action="$1"
showHelp() {
echo "usage: sane-input-handler <action>"
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() { log() {
printf "sane-input-handler: %s\n" "$1" printf "sane-input-handler: %s\n" "$1"
} }
@@ -242,19 +260,31 @@ dispatchInhibited() {
esac esac
} }
_isAllOn="$(isAllOn && echo 1 || true)" dispatchToplevel() {
_isAllOn="$(isAllOn && echo 1 || true)"
if [ -z "$_isAllOn" ]; then if [ -z "$_isAllOn" ]; then
dispatchOff dispatchOff
else
_isInhibited="$(isInhibited && echo 1 || true)"
if [ -n "$_isInhibited" ]; then
dispatchInhibited
else else
dispatchOn _isInhibited="$(isInhibited && echo 1 || true)"
if [ -n "$_isInhibited" ]; then
dispatchInhibited
else
dispatchOn
fi
fi fi
fi
dispatchDefault dispatchDefault
}
case "$action" in
(--help)
showHelp
exit 0
;;
(*)
dispatchToplevel
handleWith unmapped
;;
esac
handleWith unmapped