[F] CPU: Fallback to cpuinfo method when platform-specific method fails
https://github.com/dylanaraps/neofetch/pull/2139
This commit is contained in:
parent
92ae4b4316
commit
712cf097f4
1 changed files with 6 additions and 6 deletions
6
neofetch
6
neofetch
|
@ -2511,15 +2511,15 @@ get_cpu() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"riscv"*)
|
"riscv"*)
|
||||||
|
# This will fail to detect cpu on qemu
|
||||||
cpu="$(awk -F': ' '/uarch/ {print $2; exit}' "$cpu_file")"
|
cpu="$(awk -F': ' '/uarch/ {print $2; exit}' "$cpu_file")"
|
||||||
;;
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
*)
|
# If cpu is not detected on a platform-specific bases, fallback to cpuinfo method
|
||||||
[[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \
|
[[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \
|
||||||
'/model name|Hardware|Processor|^cpu model|chip type|^cpu type/ {
|
'/model name|Hardware|Processor|^cpu model|chip type|^cpu type/ {
|
||||||
cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")"
|
cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")"
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
|
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue