Przeglądaj źródła

[PR] dylanaraps/neofetch#1961 from satmandu - Add CPU temp file for Raspberry Pi/linux and fix CPU detection for Raspberry Pi devices

Upstream PR: https://github.com/dylanaraps/neofetch/pull/1961
Thanks to @satmandu

Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Azalea (on HyDEV-Daisy) 2 lat temu
rodzic
commit
aac56be0c1
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      neofetch

+ 6 - 1
neofetch

@@ -2392,7 +2392,7 @@ get_cpu() {
                 ;;
 		
                 *)
-                    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")"
                 ;;
@@ -2408,6 +2408,11 @@ 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