-
Notifications
You must be signed in to change notification settings - Fork 4
/
service.sh
73 lines (63 loc) · 1.89 KB
/
service.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
#!/system/bin/sh
# Do not remove credit if you're using a part of this mod to your!
# by oiakera
# Function to write values to files
write() {
local file="$1"
local value="$2"
# Check if the file exists
if [ ! -f "$file" ]; then
log-error "Error: File $file does not exist."
return 1
fi
# Make file writable
chmod +w "$file" 2>/dev/null
# Write new value, bail out if it fails
if ! echo "$value" >"$file" 2>/dev/null; then
echo "Error: Failed to write to $file."
return 1
else
return 0
fi
}
# Vars
MODDIR=${0%/*}
MODLOG="/data/akera/high_perf_dac.txt"
MODDATE=$(date +"%d-%m-%Y %r")
CODENAME=$(grep_prop Codename $MODPATH/module.prop 2>/dev/null)
MODEL=$(getprop ro.product.system.model 2>/dev/null)
RELEASE=$(getprop ro.system.build.version.release 2>/dev/null)
HARDWARE=$(cat /proc/cpuinfo | grep Hardware 2>/dev/null)
# Check if file exist
FILE1=$(find /sys/module -name high_perf_mode)
FILE2=$(find /sys/module -name cpe_debug_mode)
FILE3=$(find /sys/module -name impedance_detect_en)
# O_o
touch $MODLOG
echo "# Device : $MODEL" > $MODLOG
echo "# Android : $RELEASE" >> $MODLOG
echo "# Hardware : $HARDWARE" >> $MODLOG
echo "# Codename : $CODENAME" >> $MODLOG
echo "×---------------------------------------------------×" >> $MODLOG
# DAC Mode
if $FILE1; then
echo "! Cannot find high_perf_mode file | ${MODDATE}" >> $MODLOG
else
busybox write $FILE1 1
echo "✓ Enabled high_perf_mode | ${MODDATE}" >> $MODLOG
fi
# CPE Debug Mode
if $FILE2; then
echo "! Cannot find cpe_debug_mode file | ${MODDATE}" >> $MODLOG
else
busybox write $FILE2 1
echo "✓ Enabled cpe_debug_mode | ${MODDATE}" >> $MODLOG
fi
# Impedance Detect EN
if $FILE3; then
echo "! Cannot find impedance_detect_en file | ${MODDATE}" >> $MODLOG
else
busybox write $FILE3 1
echo "✓ Enabled impedance_detect_en | ${MODDATE}" >> $MODLOG
fi
#End