[Micromax A106 Unite 2] eyesfortech:
Update on script

Hi [MENTION=4279499]umangleekha[/MENTION],

Again nice job :good:

But I have a suggestion (you can opt to take it or not). As you have mentioned the Level 0 is the stock value so you recommend us to install it whenever we want to revert. However there are a few of us who have already tweaked the values of what your script intends to change. And curious people like me would want to try your script as well. So to make things a little bit flexible and friendly, I did a little modification on your script and an uninstaller so that people can revert back to their previous settings.

I Pm'd you the scripts so you can decide if you want to update your set of installers. The uninstaller will can be applied to any of the Level installer they used.

Here's a little bit explanation of how it works, I am taking Level 6 for example:

Updated scipt

#!/system/bin/sh
#hotplug governer tweaks_umangleekha

#variables
up_threshold=/sys/devices/system/cpu/cpufreq/hotplug/up_threshold
cpu_up_threshold=/sys/devices/system/cpu/cpufreq/hotplug/cpu_up_threshold
sampling_rate=/sys/devices/system/cpu/cpufreq/hotplug/sampling_rate
cpu_down_differential=/sys/devices/system/cpu/cpufreq/hotplug/cpu_down_differential
down_differential=/sys/devices/system/cpu/cpufreq/hotplug/down_differential
powersave_bias=/sys/devices/system/cpu/cpufreq/hotplug/powersave_bias
sampling_rate_min=/sys/devices/system/cpu/cpufreq/hotplug/sampling_rate_min
cpu_num_limit=/sys/devices/system/cpu/cpufreq/hotplug/cpu_num_limit

hotplugbak=/data/hotplug
hotpluglog=/data/hotplug.log

rm -f $hotpluglog
touch $hotpluglog

if [ -s $hotplugbak ] ; then
echo "hotplug original values were stored." | tee -a $hotpluglog;
else
touch $hotplugbak;
echo "#!/system/bin/sh" | tee -a $hotplugbak;
echo "# This contains the original values" | tee -a $hotpluglog;
echo "" | tee -a $hotplugbak;
echo "hotplug will run the first time..." | tee -a $hotpluglog;
#creating a backup first
echo "echo $( cat $up_threshold ) > $up_threshold" | tee -a $hotplugbak;
echo "echo $( cat $cpu_up_threshold ) > $cpu_up_threshold" | tee -a $hotplugbak;
echo "echo $( cat $sampling_rate ) > $sampling_rate" | tee -a $hotplugbak;
echo "echo $( cat $cpu_down_differential ) > $cpu_down_differential" | tee -a $hotplugbak;
echo "echo $( cat $down_differential ) > $down_differential" | tee -a $hotplugbak;
echo "echo $( cat $powersave_bias ) > $powersave_bias" | tee -a $hotplugbak;
echo "echo $( cat $sampling_rate_min ) > $sampling_rate_min" | tee -a $hotplugbak;
echo "echo $( cat $cpu_num_limit ) > $sampling_rate_min" | tee -a $hotplugbak;
fi;

# applying hotplug now
echo 95 > $up_threshold
echo 95 > $cpu_up_threshold
echo 40000 > $sampling_rate
echo 1 > $cpu_down_differential
echo 1 > $down_differential
echo 250 > $powersave_bias
echo 40000 > $sampling_rate_min
echo 2 > $cpu_num_limit

What it does is it will create a backup named "hotplug" inside /data directory. And this will not be changed and will be done once (check the IF statement). And if the backup is already there, the first IF will be bypassed and it will proceed to the changes you need. If the backup is not there, it will create the backup first. Basically that's going to be your installer.

For the Uninstaller

So the script is pretty straightforward, it will delete the existing hotplug from the init.d and then execute the shell script which was previously backed up from the installer.

#!/system/bin/sh
#
# This will revert all the changes made by the battery tweak from Umang Leekha
##################################################################################

# Let us start

#mounting /system
mount -o rw,remount /system
mount -o rw,remount /data

# Deleting the hotplug
rm -rf /system/etc/init.d/hotplug;
/system/bin/sh /data/hotplug;

# Updating the correct permission
chmod 777 /system/etc/init.d/*

I hope this helps and more power!