From 42d6aa490afa171cc92224b0f0b963e56e2afd94 Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Sun, 31 Jul 2022 00:20:04 -0400 Subject: [PATCH] [F] Fix CPU detection for Android https://github.com/dylanaraps/neofetch/pull/2139 --- neofetch | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 0a27460b..ab895649 100644 --- a/neofetch +++ b/neofetch @@ -2237,9 +2237,17 @@ get_cpu() { ;; "arm"* | "aarch64") - cpu="$(lscpu | awk -F': ' '/Vendor ID/ {print $2; exit}' ) $(lscpu | awk -F': ' '/Model name/ {print $2; exit}')" + if [[ $(trim "$ascii_distro") == Android* ]]; then + # Android roms have modified cpuinfo that shows CPU model as a string + 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")" + else + # ARM linux displays binary model code in cpuinfo, which needs to be decoded with lscpu + cpu="$(lscpu | awk -F': ' '/Vendor ID/ {print $2; exit}') $(lscpu | awk -F': ' '/Model name/ {print $2; exit}')" + fi ;; - + "riscv"*) cpu="$(awk -F': ' '/uarch/ {print $2; exit}' "$cpu_file")" ;;