Skip to content

Commit

Permalink
treehouses detect add rpi5 and more (fixes #2289) (#2290)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogi authored Feb 6, 2024
1 parent 70e909f commit 1ac9f44
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 57 deletions.
138 changes: 83 additions & 55 deletions modules/detect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,89 @@ function detectrpi {
local rpimodel found
checkargn $# 1
declare -A rpimodels
rpimodels["Beta"]="BETA"
rpimodels["0002"]="RPIB"
rpimodels["0003"]="RPIB"
rpimodels["0004"]="RPIB"
rpimodels["0005"]="RPIB"
rpimodels["0006"]="RPIB"
rpimodels["0007"]="RPIA"
rpimodels["0008"]="RPIA"
rpimodels["0009"]="RPIA"
rpimodels["000d"]="RPIB"
rpimodels["000e"]="RPIB"
rpimodels["000f"]="RPIB"
rpimodels["0010"]="RPIB+"
rpimodels["0011"]="CM"
rpimodels["0012"]="RPIA+"
rpimodels["0013"]="RPIB+"
rpimodels["0014"]="CM"
rpimodels["0015"]="RPIA+"
rpimodels["a01040"]="RPI2B"
rpimodels["a01041"]="RPI2B"
rpimodels["a02042"]="RPI2B"
rpimodels["a21041"]="RPI2B"
rpimodels["a22042"]="RPI2B"
rpimodels["900021"]="RPIA+"
rpimodels["900032"]="RPIB+"
rpimodels["900061"]="CM"
rpimodels["900092"]="RPIZ"
rpimodels["900093"]="RPIZ"
rpimodels["920092"]="RPIZ"
rpimodels["920093"]="RPIZ"
rpimodels["9000c1"]="RPIZW"
rpimodels["a020a0"]="CM3"
rpimodels["a220a0"]="CM3"
rpimodels["a02100"]="CM3+"
rpimodels["a02082"]="RPI3B"
rpimodels["a22082"]="RPI3B"
rpimodels["a22083"]="RPI3B"
rpimodels["a32082"]="RPI3B"
rpimodels["a52082"]="RPI3B"
rpimodels["a020d3"]="RPI3B+"
rpimodels["9020e0"]="RPI3A+"
rpimodels["a03111"]="RPI4B" # 1gb
rpimodels["b03111"]="RPI4B" # 2gb
rpimodels["b03112"]="RPI4B" # 2gb
rpimodels["b03114"]="RPI4B" # 2gb
rpimodels["c03111"]="RPI4B" # 4gb
rpimodels["c03112"]="RPI4B" # 4gb
rpimodels["c03114"]="RPI4B" # 4gb
rpimodels["d03114"]="RPI4B" # 8gb
rpimodels["c03130"]="RPI400" # 4gb
rpimodels["a03140"]="CM4" # 1gb
rpimodels["b03140"]="CM4" # 2gb
rpimodels["c03140"]="CM4" # 4gb
rpimodels["d03140"]="CM4" # 8gb
rpimodels["902120"]="RPIZ2W" # .5gb

# Beta models
rpimodels["Beta"]="BETA" # Beta version

# Raspberry Pi A models
rpimodels["0007"]="RPIA" # 256MB
rpimodels["0008"]="RPIA" # 256MB
rpimodels["0009"]="RPIA" # 256MB
rpimodels["0012"]="RPIA+" # 256MB
rpimodels["0015"]="RPIA+" # 256MB/512MB
rpimodels["900021"]="RPIA+" # 512MB
rpimodels["9020e0"]="RPI3A+" # 512MB
rpimodels["9020e1"]="RPI3A+" # 512MB

# Raspberry Pi B models
rpimodels["0002"]="RPIB" # 256MB
rpimodels["0003"]="RPIB" # 256MB
rpimodels["0004"]="RPIB" # 256MB
rpimodels["0005"]="RPIB" # 256MB
rpimodels["0006"]="RPIB" # 256MB
rpimodels["000d"]="RPIB" # 512MB
rpimodels["000e"]="RPIB" # 512MB
rpimodels["000f"]="RPIB" # 512MB
rpimodels["0010"]="RPIB+" # 512MB
rpimodels["0013"]="RPIB+" # 512MB
rpimodels["900032"]="RPIB+" # 512MB

# Compute Module models
rpimodels["0011"]="CM" # 512MB
rpimodels["0014"]="CM" # 512MB
rpimodels["900061"]="CM" # 512MB
rpimodels["a020a0"]="CM3" # 1GB
rpimodels["a220a0"]="CM3" # 1GB
rpimodels["a02100"]="CM3+" # 1GB
rpimodels["a03140"]="CM4" # 1GB
rpimodels["b03140"]="CM4" # 2GB
rpimodels["c03140"]="CM4" # 4GB
rpimodels["d03140"]="CM4" # 8GB

# Raspberry Pi 2B models
rpimodels["a01040"]="RPI2B" # 1GB
rpimodels["a01041"]="RPI2B" # 1GB
rpimodels["a02042"]="RPI2B" # 1GB
rpimodels["a21041"]="RPI2B" # 1GB
rpimodels["a22042"]="RPI2B" # 1GB

# Raspberry Pi 3 models
rpimodels["a02082"]="RPI3B" # 1GB
rpimodels["a22082"]="RPI3B" # 1GB
rpimodels["a22083"]="RPI3B" # 1GB
rpimodels["a32082"]="RPI3B" # 1GB
rpimodels["a52082"]="RPI3B" # 1GB
rpimodels["a020d3"]="RPI3B+" # 1GB
rpimodels["a020d4"]="RPI3B+" # 1GB

# Raspberry Pi 4B models
rpimodels["a03111"]="RPI4B" # 1GB
rpimodels["b03111"]="RPI4B" # 2GB
rpimodels["b03112"]="RPI4B" # 2GB
rpimodels["b03114"]="RPI4B" # 2GB
rpimodels["b03115"]="RPI4B" # 2GB
rpimodels["c03111"]="RPI4B" # 4GB
rpimodels["c03112"]="RPI4B" # 4GB
rpimodels["c03114"]="RPI4B" # 4GB
rpimodels["c03115"]="RPI4B" # 4GB
rpimodels["d03114"]="RPI4B" # 8GB
rpimodels["d03115"]="RPI4B" # 8GB

# Raspberry Pi 5 models
rpimodels["c04170"]="RPI5" # 4GB
rpimodels["d04170"]="RPI5" # 8GB

# Raspberry Pi 400
rpimodels["c03130"]="RPI400" # 4GB

# Raspberry Pi Zero models
rpimodels["900092"]="RPIZ" # 512MB
rpimodels["900093"]="RPIZ" # 512MB
rpimodels["920092"]="RPIZ" # 512MB
rpimodels["920093"]="RPIZ" # 512MB
rpimodels["9000c1"]="RPIZW" # 512MB
rpimodels["902120"]="RPIZ2W" # 512MB

# more at: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes-in-use

rpimodel=$(grep Revision /proc/cpuinfo | sed 's/.* //g' | tr -d '\n')
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@treehouses/cli",
"version": "1.26.13",
"remote": "4000",
"version": "1.26.14",
"remote": "6000",
"description": "Thin command-line interface for Raspberry Pi low level configuration.",
"main": "cli.sh",
"bin": {
Expand Down

0 comments on commit 1ac9f44

Please sign in to comment.