Skip to content

Commit

Permalink
reworked script | v6 FECK
Browse files Browse the repository at this point in the history
  • Loading branch information
OIakera committed Oct 13, 2023
1 parent 418cb08 commit 2b75f3b
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 112 deletions.
15 changes: 15 additions & 0 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,26 @@ require_new_magisk() {
exit 1
}

startup() {
set -x
print
}

#########################
# Load util_functions.sh
#########################

OUTFD=$2
ZIPFILE=$3
SKIPUNZIP=1
MODLOG=/sdcard/Android/high_perf_dac.txt
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=$(getprop ro.hardware 2>/dev/null)
FILE1=$(find /sys/module -name high_perf_mode)
FILE2=$(find /sys/module -name cpe_debug_mode)
FILE3=$(find /sys/module -name impedance_detect_en)

mount /data 2>/dev/null

Expand All @@ -30,4 +44,5 @@ mount /data 2>/dev/null
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk

install_module
startup
exit 0
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
##### High Performance DAC | Magisk Module
##### High perf DAC | Magisk/KSU Module

##### Contact: https://t.me/AkiraSuper

##### - This Magisk module enables the "High Performance DAC" mode of Qualcomm's WCD9xx DAC to maximize it's power and get the best audio quality possible.
##### - This Magisk/KSU module enables the "High Performance DAC" mode of Qualcomm's WCD9xx DAC to maximize it's power and get the best audio quality possible.

##### `Needs Kernel Support`

##### ✓ INSTALLATION: Just flash via Magisk and reboot.
##### ✓ INSTALLATION: Just flash via Magisk/KSU and reboot.

##### Disclaimer: Naturally, you take all the responsibility for what happens to your device when you start messing around with things. I (Akira) will not be responsible for ANY damage caused to anyone's devices due to the use of this module.
##### Disclaimer: Naturally, you take all the responsibility for what happens to your device when you start messing around with things. I (Akera) will not be responsible for ANY damage caused to anyone's devices due to the use of this module.
38 changes: 0 additions & 38 deletions changelog.md

This file was deleted.

50 changes: 23 additions & 27 deletions customize.sh
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
SKIPUNZIP=1
MODLOG="/storage/emulated/0/high_perf_dac.log"
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=$(getprop ro.hardware 2>/dev/null)
REMOVE() {
remove() {
rm -rf $MODLOG 2>/dev/null
rm -rf $MODPATH/changelog.txt 2>/dev/null
rm -rf $MODPATH/LICENSE 2>/dev/null
rm -rf $MODPATH/README.md 2>/dev/null
}
PERMISSION() {
permission() {
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm $MODPATH/post-fs-data.sh 0 0 0777 0777
set_perm $MODPATH/service.sh 0 0 0777 0777
}
EXTRACT() {
extract() {
ui_print "- Extracting module files"
unzip -o "$ZIPFILE" module.prop -d $MODPATH >&2
unzip -o "$ZIPFILE" post-fs-data.sh -d $MODPATH >&2
unzip -o "$ZIPFILE" service.sh -d $MODPATH >&2
}
FUNCTION() {
function() {
if [ "$HARDWARE" == "qcom" ]; then
ui_print ""
ui_print "Installing High Performance DAC, ✓ Qualcomm Detected"
ui_print "✓ Qcom Detected"
ui_print ""
REMOVE
PERMISSION
if [ "$FILE1" && "$FILE2" && "$FILE3" ]; then
ui_print ""
ui_print "• Installing High perf DAC"
ui_print ""
remove
permission
else
ui_print ""
ui_print "- ! Failed because your Kernel is Not Supported"
ui_print ""
abort
fi
else
ui_print ""
ui_print "• Installation High Performance DAC, ! Failed because your Kernel is Not Supported"
ui_print "- ! Shit MTK Detected, Failed"
ui_print ""
abort
fi
}
PRINT() {
ui_print ""
ui_print " ╭━━┳╮╭╮╱╱╱╱╭━━╮ "
ui_print " ┃╭╮┃┣╋╋┳┳━╮┃━━╋┳┳━┳━┳┳╮ "
ui_print " ┃┣┫┃━┫┃╭┫╋╰╋━━┃┃┃╋┃┻┫╭╯ "
ui_print " ╰╯╰┻┻┻┻╯╰━━┻━━┻━┫╭┻━┻╯ "
ui_print " ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ "
print() {
ui_print ""
ui_print "• Device : $MODEL"
ui_print "• Android : $RELEASE"
ui_print "• Hardware : $HARDWARE"
ui_print ""
EXTRACT
extract
ui_print "• Codename : $CODENAME"
FUNCTION
function
}
set -x
PRINT
10 changes: 5 additions & 5 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id=high_perf_dac
name=High Performance DAC
Codename=sonorousness
version=v5.5
versionCode=55
author=akirasup3r
name=High perf DAC
Codename=feck
version=v6
versionCode=60
author=reallyakera
description=This Magisk module enables the "High Performance DAC" mode of Qualcomm's WCD9xx DAC to maximize it's power and get the best audio quality possible.
36 changes: 0 additions & 36 deletions post-fs-data.sh

This file was deleted.

73 changes: 73 additions & 0 deletions service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/system/bin/sh
# Do not remove credit if you're using a part of this mod to your!
# by reallyakera
# 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="/sdcard/Android/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=$(getprop ro.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
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
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
write $FILE2 3
echo "✓ Enabled impedance_detect_en | ${MODDATE}" >> $MODLOG
fi

#End

0 comments on commit 2b75f3b

Please sign in to comment.