From d561057cd8731540bc0a7ca588e71efb9b1443a6 Mon Sep 17 00:00:00 2001 From: Satadru Pramanik Date: Thu, 18 Nov 2021 12:01:21 -0500 Subject: [PATCH 1/2] Add CPU temp file for Raspberry Pi/linux --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index 64fa042b..732b16c5 100755 --- a/neofetch +++ b/neofetch @@ -2219,6 +2219,10 @@ get_cpu() { break } done + # If on a Raspberry Pi... + if grep -q "Raspberry Pi" /proc/device-tree/model; then + temp_dir=/sys/class/thermal/thermal_zone0/temp + fi # Get CPU speed. if [[ -d "$speed_dir" ]]; then From b97f562780f2a8e19fa9485d200bbb6e489d6f58 Mon Sep 17 00:00:00 2001 From: Satadru Pramanik Date: Thu, 18 Nov 2021 22:37:05 -0500 Subject: [PATCH 2/2] Add proper cpu detection for Raspberry PI devices --- neofetch | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 732b16c5..f082aa88 100755 --- a/neofetch +++ b/neofetch @@ -2202,8 +2202,32 @@ get_cpu() { [[ -z "$cpu" ]] && cpu="$(awk -F':' '/family/ {printf $2; exit}' "$cpu_file")" ;; + "aarch64" | "armv7l") + if grep -q "Raspberry Pi" /proc/device-tree/model; then + cpu_revision="$(awk -F':' '/Revision/ {print substr($2,4,1); exit}' "$cpu_file")" + case $cpu_revision in + "0") + cpu="BCM2835" + ;; + + "1") + cpu="BCM2835" + ;; + + "2") + cpu="BCM2837" + ;; + + "3") + cpu="BCM2711" + ;; + esac + + fi + ;;& + *) - cpu="$(awk -F '\\s*: | @' \ + [[ -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")" ;;