bypass.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --- a/AnyKernel3/anykernel.sh
  2. +++ b/AnyKernel3/anykernel.sh
  3. @@ -46,6 +46,48 @@
  4. $ksu_supported || abort " -> Non-GKI device, abort."
  5. +handle_input() {
  6. + /system/bin/getevent -lq 2>/dev/null | while IFS= read -r line; do
  7. + case "$line" in
  8. + *KEY_VOLUMEUP*DOWN*) echo "bypass"; break ;;
  9. + *KEY_VOLUMEDOWN*DOWN*) echo "normal"; break ;;
  10. + *KEY_POWER*DOWN*) echo "cancel"; break ;;
  11. + esac
  12. + done
  13. +}
  14. +
  15. +choose_flash_mode() {
  16. + ui_print " "
  17. + ui_print " -> Most users do not need Bypass; try Normal first!"
  18. + ui_print " -> This only swaps the Image for compatibility workarounds."
  19. + ui_print " -> VOL+ = Bypass | VOL- = Normal | POWER = Cancel"
  20. + ui_print " "
  21. +
  22. + while true; do
  23. + case $(handle_input) in
  24. + normal)
  25. + ui_print " -> Selected: Normal"
  26. + return 0
  27. + ;;
  28. + bypass)
  29. + ui_print " -> Selected: Bypass"
  30. + if [ -f "$AKHOME/Bypass-Image" ]; then
  31. + cp -f "$AKHOME/Bypass-Image" "$AKHOME/Image"
  32. + ui_print " -> Using Bypass-Image for this flash"
  33. + return 0
  34. + fi
  35. + abort " -> ERROR: Bypass-Image not found. Abort."
  36. + ;;
  37. + cancel)
  38. + abort " -> Cancelled by POWER button. Abort."
  39. + ;;
  40. + esac
  41. + done
  42. +}
  43. +
  44. +choose_flash_mode
  45. +
  46. # boot install