[One (M7) Original Android Development] Headless96:
Wow that is one messy script.... :silly:

Firstly none of the lines from '#Fast Charge' all the way to '#MultiCorePowersavings' will apply, you've made the same error on all of them haha. Basically I'll take the fast charge one for example, you've written:

echo 1 /sys/kernel/fast_charge/force_fast_charge

... And what you should've written is:

echo 1 [B]>[/B] /sys/kernel/fast_charge/force_fast_charge

You forgot to put in the '>' .. Very important as otherwise none of them will apply, fix that on all the lines before the cpu stuff and they'll work. Also if you actually want Sweep2Sleep then the value is 2 not 0.

Now the cpu stuff... (This is gonna be long, so I hid it to prevent a stupidly long post :p)

You've written:

if [ -e /data/local/cpu_protection ] ; then
echo failed > /data/local/cpu_failed
chmod 777 /data/local/cpu_failed
exit
fi

I don't know where you found this but we don't have a file called cpu_protection in that directory so this command is useless (get rid of it)

Now the next bit:

echo applied > /data/local/cpu_protection
chmod 777 /data/local/cpu_protection
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1674000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "384000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

Change this to:

chmod 666 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 444 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 666 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1674000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 444 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 666 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod 444 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

Changes:

Deleted cpu protection lines

Added chmod 444 lines

Fixed chmod lines (put a > in the command)

Took out quotation marks on things like 'ondemand' as they are unneeded

Repeat this exact procedure (copy and paste) for cpu1, cpu2 and cpu3. So for example:

chmod 666 > /sys/devices/system/cpu/cpu[COLOR="Red"]1[/COLOR]/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu[COLOR="red"]1[/COLOR]/cpufreq/scaling_governor
chmod 444 > /sys/devices/system/cpu/cpu[COLOR="red"]1[/COLOR]/cpufreq/scaling_governor

And so on....

Note: Not 100% sure how long these will apply for, since pnpmgr is still in play, guess that's down to you to test. Theoretically it should work though

Next bit:

echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/down_differential
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/enable_boost_cpu
echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load
echo 1026000,1026000,810000,810000 > /sys/devices/system/cpu/cpufreq/ondemand/input_event_min_freq
echo 0 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 918000 > /sys/devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 0 > /sys/devices/system/cpu/cpufreq/ondemand/powersave_bias
echo 3 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 20000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 10000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate_min
echo 594000 > /sys/devices/system/cpu/cpufreq/ondemand/sync_freq
echo 20000 > /sys/devices/system/cpu/cpufreq/ondemand/ui_sampling_rate
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/ui_timeout
echo 90 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 80 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo 70 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core

This should stay applied even without chmod'ing every file but imo you shouldn't change these. The stock ondemand values have the perfect balance between performance and battery.

Moving on....

#GOVERNOR="ondemand"

#echo GOVERNOR /sys/devices/system/cpu/#cpu0/cpufreq/scaling_governor
#echo GOVERNOR /sys/devices/system/cpu/#cpu1/cpufreq/scaling_governor
#echo GOVERNOR /sys/devices/system/cpu/#cpu2/cpufreq/scaling_governor
#echo GOVERNOR /sys/devices/system/cpu/#cpu3/cpufreq/scaling_governor

Completely irrelevant since cpu governor has already been applied previously. Plus as you said without chmod 444'ing the relevant files, the governor's reset to stock values.

# Set IO Sheduler

SHEDULER="bfq"

echo SHEDULER /sys/block/mmcblk0/queue/scheduler

This'll work once you've fixed the command (forgot the > again) but if you want to shorten the script and make it easier to read, change to:

echo bfq > /sys/block/mmcblk0/queue/scheduler

And lastly the IO r/a line you need the '>' again.

In case you get completely stuck I made your script but completely fixed up for a reference point:

Wow that took me way longer than I thought.. :laugh: