mirror of
https://github.com/brain-hackers/brain-config.git
synced 2024-11-05 17:58:04 +09:00
Tidy hardware type detection functions
This commit is contained in:
parent
224369d93b
commit
2ef9a3a194
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
raspi-config (20220425) bullseye; urgency=medium
|
||||
|
||||
* Tidy hardware detection functions
|
||||
|
||||
-- Simon Long <simon@raspberrypi.com> Mon, 25 Apr 2022 17:38:35 +0100
|
||||
|
||||
raspi-config (20220419) bullseye; urgency=medium
|
||||
|
||||
* Reinstate -R parameter for xcompmgr
|
||||
|
17
raspi-config
17
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user