diff --git a/debian/changelog b/debian/changelog index f35210a..d858416 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +raspi-config (20220425) bullseye; urgency=medium + + * Tidy hardware detection functions + + -- Simon Long Mon, 25 Apr 2022 17:38:35 +0100 + raspi-config (20220419) bullseye; urgency=medium * Reinstate -R parameter for xcompmgr diff --git a/raspi-config b/raspi-config index b2109f3..e9f4104 100755 --- a/raspi-config +++ b/raspi-config @@ -25,6 +25,8 @@ else CMDLINE=/proc/cmdline fi +# tests for Pi 1, 2 and 0 all test for specific boards... + is_pione() { if grep -q "^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo; then return 0 @@ -45,6 +47,13 @@ is_pizero() { return $? } +# ...while tests for Pi 3 and 4 just test processor type, so will also find CM3, CM4, Zero 2 etc. + +is_pithree() { + grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]2[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo + return $? +} + is_pifour() { grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]3[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo return $? @@ -55,8 +64,14 @@ get_pi_type() { echo 1 elif is_pitwo; then echo 2 - else + elif is_pithree; then + echo 3 + elif is_pifour; then + echo 4 + elif is_pizero; then echo 0 + else + echo -1 fi }