| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- --- a/anykernel.sh 2026-05-23 20:16:58.305522267 -0400
- +++ b/anykernel.sh 2026-05-23 21:32:11.537813431 -0400
- @@ -45,6 +45,72 @@
- ui_print " " " -> Wild Kernels Supported: $ksu_supported"
- $ksu_supported || abort " -> Non-GKI device, abort."
-
- +handle_input() {
- + # 1) try picking a node that advertises volume/power keys via /proc
- + if [ -r /proc/bus/input/devices ]; then
- + node=$(awk -v RS= '/KEY/ && /KEY_VOLUMEUP|KEY_VOLUMEDOWN|KEY_POWER/ {
- + if (match($0, /event[0-9]+/)) print "/dev/input/" substr($0, RSTART, RLENGTH)
- + }' /proc/bus/input/devices | head -n1)
- + if [ -n "$node" ] && [ -e "$node" ]; then
- + case $(getevent -lqc "$node" 2>/dev/null | grep -m1 'DOWN' || true) in
- + *KEY_VOLUMEUP*) echo "bypass"; return 0 ;;
- + *KEY_VOLUMEDOWN*) echo "normal"; return 0 ;;
- + *KEY_POWER*) echo "cancel"; return 0 ;;
- + esac
- + fi
- + fi
- +
- + # 2) fallback: scan a small range of common event nodes
- + for ev in /dev/input/event{0..12}; do
- + [ -e "$ev" ] || continue
- + case $(getevent -lqc "$ev" 2>/dev/null | grep -m1 'DOWN' || true) in
- + *KEY_VOLUMEUP*) echo "bypass"; return 0 ;;
- + *KEY_VOLUMEDOWN*) echo "normal"; return 0 ;;
- + *KEY_POWER*) echo "cancel"; return 0 ;;
- + esac
- + done
- +
- + # 3) final global attempt (may block on some recoveries)
- + case $(getevent -lqc 2>/dev/null | grep -m1 'DOWN' || true) in
- + *KEY_VOLUMEUP*) echo "bypass"; return 0 ;;
- + *KEY_VOLUMEDOWN*) echo "normal"; return 0 ;;
- + *KEY_POWER*) echo "cancel"; return 0 ;;
- + esac
- +
- + return 1
- +}
- +
- +choose_flash_mode() {
- + ui_print " "
- + ui_print " -> Most users do not need Bypass; try Normal first!"
- + ui_print " -> This only swaps the Image for compatibility workarounds."
- + ui_print " -> VOL+ = Bypass | VOL- = Normal | POWER = Cancel"
- + ui_print " "
- +
- + while true; do
- + case $(handle_input) in
- + normal)
- + ui_print " -> Selected: Normal"
- + return 0
- + ;;
- + bypass)
- + ui_print " -> Selected: Bypass"
- + if [ -f "$AKHOME/Bypass-Image" ]; then
- + cp -f "$AKHOME/Bypass-Image" "$AKHOME/Image"
- + ui_print " -> Using Bypass-Image for this flash"
- + return 0
- + fi
- + abort " -> ERROR: Bypass-Image not found. Abort."
- + ;;
- + cancel)
- + abort " -> Cancelled by POWER button. Abort."
- + ;;
- + esac
- + done
- +}
- +
- +choose_flash_mode
- +
- # boot install
- split_boot
-
|