From 440153e7d8b014dce8222743afe082e1a5f4cb11 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 14 Dec 2016 11:14:59 +1100 Subject: [PATCH] CPU: Don't simplify option names for no reason --- config/config | 7 ++++--- neofetch | 11 ++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/config/config b/config/config index 219d51b3..53b809b5 100644 --- a/config/config +++ b/config/config @@ -134,11 +134,12 @@ shell_version="on" # CPU speed type # -# Default: 'bios' -# Values: 'current', 'min', 'max', 'bios', +# Default: 'bios_limit' +# Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. # Flag: --speed_type # Supports: Linux with 'cpufreq' -speed_type="bios" +# NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. +speed_type="bios_limit" # Shorten the output of the CPU function # diff --git a/neofetch b/neofetch index 655b873b..b057f4a2 100755 --- a/neofetch +++ b/neofetch @@ -734,23 +734,16 @@ get_cpu() { "Android"*) cpu="$(getprop ro.product.board)" ;; *) cpu="$(awk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)" ;; esac + speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" temp_dir="/sys/class/hwmon/hwmon0/temp1_input" # Get cpu speed if [[ -d "$speed_dir" ]]; then - case "$speed_type" in - "current") speed_type="scaling_cur_freq" ;; - "min") speed_type="scaling_min_freq" ;; - "max") speed_type="scaling_max_freq" ;; - "bios") speed_type="bios_limit" ;; - esac - - # Fallback to cpuinfo_max_freq if $speed_type fails + # Fallback to bios_limit if $speed_type fails. speed="$(< "${speed_dir}/${speed_type}")" || \ speed="$(< "${speed_dir}/bios_limit")" || \ speed="$(< "${speed_dir}/scaling_max_freq")" - speed="$((speed / 100000))" else