Recently Written · git

assistkey

Hardware key remapper for the Viwoods AiPaper Reader: AI key, volume keys and power, with multi-tap, hold and chords

git clone https://github.com/equwal/assistkey

Log | Files | Refs


tools/ai-key (1035 bytes)

1 #!/usr/bin/env bash
2 # Points the firmware's AI key hook at AssistKey, or hands it back.
3 #
4 # With the stock hook the firmware opens its AI screen on every press, whether
5 # or not an app acted on the key. Hooked, each press goes straight to AssistKey
6 # and nothing else opens. Android lets no app change this setting, hence adb.
7 #
8 #   tools/ai-key hook      AssistKey owns the AI key (taps; Power, then AI key)
9 #   tools/ai-key unhook    back to the firmware default (AI crop)
10 #   tools/ai-key status
11 set -euo pipefail
12 export MSYS_NO_PATHCONV=1
13 OURS=dev.equwal.assistkey/dev.equwal.assistkey.channel.AiKeyActivity
14 STOCK=com.viwoods.launcher/com.viwoods.libfloating.activity.ScreenCaptureActivity   # factory default; pick another in the reader's own key settings
15 case "${1:-}" in
16   hook)   adb shell settings put system CustomAiKey "$OURS";;
17   unhook) adb shell settings put system CustomAiKey "$STOCK";;
18   status) ;;
19   *) sed -n '2,11p' "$0"; exit 2;;
20 esac
21 echo "CustomAiKey = $(adb shell settings get system CustomAiKey | tr -d '\r')"