-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanykernel.sh
executable file
·99 lines (91 loc) · 2.13 KB
/
anykernel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# AnyKernel3 Ramdisk Mod Script
# osm0sis @ xda-developers
## AnyKernel setup
# begin properties
properties() { '
kernel.string=
do.devicecheck=1
do.modules=0
do.cleanup=1
do.cleanuponabort=0
device.name1=violet
device.name2=
device.name3=
device.name4=
device.name5=
supported.versions=
supported.patchlevels=
'; } # end properties
INSTALLER=$PWD
block=/dev/block/bootdevice/by-name/boot;
is_slot_device=0;
. tools/ak3-core.sh;
split_boot;
KEYCHECK=$INSTALLER/keycheck
chmod 755 $KEYCHECK
keytest() {
(/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events) || return 1
return 0
}
choose() {
#note from chainfire @xda-developers: getevent behaves weird when piped, and busybox grep likes that even less than toolbox/toybox grep
while true; do
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep VOLUME | /system/bin/grep " DOWN" > $INSTALLER/events
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUME >/dev/null`); then
break
fi
done
if (`cat $INSTALLER/events 2>/dev/null | /system/bin/grep VOLUMEUP >/dev/null`); then
return 0
else
return 1
fi
}
chooseold() {
# Calling it first time detects previous input. Calling it second time will do what we want
$KEYCHECK
$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ $SEL -eq $UP ]; then
return 0
elif [ $SEL -eq $DOWN ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}
ui_print " "
if [ -z $NEW ]; then
if keytest; then
FUNCTION=choose
else
FUNCTION=chooseold
ui_print " "
ui_print "- Vol Key Programming -"
ui_print " Press Volume Up Key: "
$FUNCTION "UP"
ui_print " Press Volume Down Key: "
$FUNCTION "DOWN"
fi
ui_print " "
ui_print "- Select Option -"
ui_print " Choose the refresh rate you want:"
ui_print " Volume Up = 66hz, Volume Down = 60hz"
if $FUNCTION; then
NEW=true
else
NEW=false
fi
else
ui_print " Option specified in zipname!"
fi
if $NEW; then
flash_dtbo 66
else
flash_dtbo 60
fi