Script needs root privileges to check /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq. The act of running sudo impacts this value on lower end boards. Since root permission are always required to run this script, if the script isn't run as root I have the script run itself with sudo. This removes the need for sudo to be inline with the check for cpuinfo_cur_freq. In addition since the script is now running as root I also removed any other sudo calls.
An alternative approach would be to have this script use scaling_cur_freq instead of cpuinfo_cur_freq. Scaling _cur_freq is maintained by the linux kernel, while cpuinfo_cur_freq actually pulls the value from the hardware.
Script needs root privileges to check /sys/devices/system/cpu/cpu4/cpufreq/cpuinfo_cur_freq. The act of running sudo impacts this value on lower end boards. Since root permission are always required to run this script, if the script isn't run as root I have the script run itself with sudo. This removes the need for sudo to be inline with the check for cpuinfo_cur_freq. In addition since the script is now running as root I also removed any other sudo calls. An alternative approach would be to have this script use scaling_cur_freq instead of cpuinfo_cur_freq. Scaling _cur_freq is maintained by the linux kernel, while cpuinfo_cur_freq actually pulls the value from the hardware.