Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Identify RPI model
- #
- # Based on data from:
- # https://www.element14.com/community/community/raspberry-pi/blog/2016/11/21/how-to-identify-which-model-of-the-raspberry-pi-you-have
- #
- # Copyright 2017 Timothe Litt litt at acm ddot org
- #
- # Use at your own risk; otherwise unrestricted provided
- # this notice is included in all copies.
- #
- declare -A revs
- revs=( [Beta]="Q1 2012|B(Beta)|?|256MB|Beta Board"
- [0002]="Q1 2012|B|1.0|256MB|"
- [0003]="Q3 2012|B (ECN0001)|1.0|256MB|Fuses mod and D4 removed"
- [0004]="Q3 2012|B|2.0|256MB|Mfg by Sony"
- [0005]="Q4 2012|B|2.0|256MB|Mfg by Qisda"
- [0006]="Q4 2012|B|2.0|256MB|Mfg by Egoman"
- [0007]="Q1 2013|A|2.0|256MB|Mfg by Egoman"
- [0008]="Q1 2013|A|2.0|256MB|Mfg by Sony"
- [0009]="Q1 2013|A|2.0|256MB|Mfg by Qisda"
- [000d]="Q4 2012|B|2.0|512MB|Mfg by Egoman"
- [000e]="Q4 2012|B|2.0|512MB|Mfg by Sony"
- [000f]="Q4 2012|B|2.0|512MB|Mfg by Qisda"
- [0010]="Q3 2014|B+|1.0|512MB|Mfg by Sony"
- [0011]="Q2 2014|Compute Module|1.0|512MB|Mfy by Sony"
- [0012]="Q4 2014|A+|1.1|256MB|Mfg by Sony"
- [0013]="Q1 2015|B+|1.2|512MB|Mfg by Embest"
- [0014]="Q2 2014|Compute Module|1.0|512MB|Mfg by Embest"
- [0015]="?|A+|1.1|256MB/512MB|Mfg by Embest"
- [a01040]="Unknown|2 Model B|1.0|1GB|Unknown"
- [a01041]="Q1 2015|2 Model B|1.1|1GB|Mfg by Sony"
- [a21041]="Q1 2015|2 Model B|1.1|1GB|Mfg by Embest"
- [a22042]="Q3 2016|2 Model B(with BCM2837)|1.2|1GB|Mfg by Embest"
- [a02082]="Q1 2016|3 Model B|1.2|1GB|Mfg by Sony"
- [a22082]="Q1 2016|3 Model B|1.2|1GB|Mfg by Embest"
- )
- function prev() {
- local rev="$1"
- if [ -z "${revs[$rev]}" ]; then
- printf "Revision %-6s Unknown\n" "$rev"
- return
- fi
- IFS='|' read -ra RI <<< "${revs[$rev]}"
- printf "Revision %-6s %-7s %-32s %-4s %-11s %s\n" \
- "$rev" "${RI[0]}" "${RI[1]}" "${RI[2]}" "${RI[3]}" "${RI[4]}"
- }
- printf " %-6s %-7s %-32s %-4s %-11s %s\n" \
- "" "R.Date" "Model" "PCB" "Mem" "Notes"
- if [ -n "$1" ]; then
- ( for rev in "${!revs[@]}"; do
- prev "$rev"
- done
- ) | sort
- else
- pi_rev=(`cat /proc/cpuinfo | grep Revision`)
- prev "${pi_rev[2]}"
- fi
RAW Paste Data