From 712cf097f4fbb4847000b731246efdfa67ab4268 Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Tue, 6 Sep 2022 12:03:40 -0400 Subject: [PATCH] [F] CPU: Fallback to cpuinfo method when platform-specific method fails https://github.com/dylanaraps/neofetch/pull/2139 --- neofetch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index 5ee081a4..cc43da52 100755 --- a/neofetch +++ b/neofetch @@ -2511,16 +2511,16 @@ get_cpu() { ;; "riscv"*) + # This will fail to detect cpu on qemu cpu="$(awk -F': ' '/uarch/ {print $2; exit}' "$cpu_file")" ;; - - *) - [[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \ - '/model name|Hardware|Processor|^cpu model|chip type|^cpu type/ { - cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")" - ;; esac + # If cpu is not detected on a platform-specific bases, fallback to cpuinfo method + [[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \ + '/model name|Hardware|Processor|^cpu model|chip type|^cpu type/ { + cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")" + speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" # Select the right temperature file.