Skip to content

Commit

Permalink
[F] CPU: Fallback to cpuinfo method when platform-specific method fails
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed Sep 6, 2022
1 parent 92ae4b4 commit 712cf09
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 712cf09

Please sign in to comment.