PiHardwareInfo
Get Raspberry Pi hardware info from /proc/cpuinfo and /sys/class/net/*
Try
run
curl -s https://raw.githubusercontent.com/rexzhang/pi-hardware-info/master/pi_hardware_info.py | python3
result
PiHardwareInfo(
{'revision_code': '0x0',
'model_type': <ModelType.RPI_3B_PLUS: 13>,
'model_name': 'Raspberry Pi 3 Model B Plus Rev 1.3',
'processor': <Processor.BCM2837: 2>,
'memory': 1024,
'manufacturer': <Manufacturer.SONY_UK: 0>,
'revision': '1.3',
'serial_number': '00000000d855943b',
'mac_address': {'eth0': 'B8:27:EB:55:94:3B', 'wlan0': 'B8:27:EB:00:C1:6E'},
'overvoltage': False,
'otp_program': False,
'otp_read': False}
)
Install
pip install PiHardwareInfo
Usage as library
from pi_hardware_info import ModelType, PiHardwareInfo
info = PiHardwareInfo()
if info.model_type == ModelType.MODEL_3B_PLUS:
print('5G Wifi ready')
elif info.model_type == ModelType.MODEL_3B:
print('only 2.4G Wifi')
Usage as tool
python -m pi_hardware_info
Note
- For a memory size of "0/Other", the actual memory capacity can be determined from the rpi-sdram-size-gbit firmware parameter
History
0.7.0 - 20260805
- Support RPI_500, RPI_CM0
- Support memory size code:7(Other), output 0
- Fix RPI_CM5_LITE
- Fix .otp_program/.otp_program
- Add more unittest
- Add file
pi-hardware-info.desktopfor run in RPi GUI
0.6.1 - 20250225
- Add, network interface MAC address info
- Refactor
0.5.0 - 20250224
- Add, Support to raspberry pi 5
- Codebase modernization Updates
- Drop py3.5 py3.6 py3.7 py3.8
- Add type hints
- Add unit test
- Add pyproject.toml
- Add pre-commit
0.4.0 - 20220810
- Add, support Zero2W/400/CM4
- Add, Overvoltage/OTP Program/OTP Read support
0.3.3 - 20190709
- Support raspberry pi 4B
- Rewrite some code
0.2.0 - 20190302
- Add old style revision code support, support 1A/1B
0.1.0 - 20190301
- First release
Alternative
- https://github.com/tompreston/raspi-version
- https://pypi.org/project/pirev
- https://pypi.org/project/RPi.version
Ref
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pihardwareinfo-0.7.0.tar.gz.
File metadata
- Download URL: pihardwareinfo-0.7.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d5ba43c8f2b1be45ea2b56e6b5a7003eb46d0b3fbfc6ad08c4877f854f9ee8f
|
|
| MD5 |
e50c0fda0fa5495acf89493557acf408
|
|
| BLAKE2b-256 |
23dbdcd6a9f8cb273b2ebaa71192a548e329edb2327bebf8d694cf5dc5d1701e
|
Provenance
The following attestation bundles were made for pihardwareinfo-0.7.0.tar.gz:
Publisher:
release-pypi.yaml on rexzhang/pi-hardware-info
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pihardwareinfo-0.7.0.tar.gz -
Subject digest:
2d5ba43c8f2b1be45ea2b56e6b5a7003eb46d0b3fbfc6ad08c4877f854f9ee8f - Sigstore transparency entry: 2342014221
- Sigstore integration time:
-
Permalink:
rexzhang/pi-hardware-info@ac22e103aa28f403ada6a78c34f229cc9a33ee99 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/rexzhang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yaml@ac22e103aa28f403ada6a78c34f229cc9a33ee99 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pihardwareinfo-0.7.0-py3-none-any.whl.
File metadata
- Download URL: pihardwareinfo-0.7.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1026bb43f84e74012bf540fdbac431fd47f33643b2eac0ec178262098bdf772
|
|
| MD5 |
b8104a2aec6bd5a82f1f0dde0df5b017
|
|
| BLAKE2b-256 |
be2a805cb158cc32c5e4f11d25100778220231c4099d9858f952f0795c280321
|
Provenance
The following attestation bundles were made for pihardwareinfo-0.7.0-py3-none-any.whl:
Publisher:
release-pypi.yaml on rexzhang/pi-hardware-info
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pihardwareinfo-0.7.0-py3-none-any.whl -
Subject digest:
c1026bb43f84e74012bf540fdbac431fd47f33643b2eac0ec178262098bdf772 - Sigstore transparency entry: 2342014232
- Sigstore integration time:
-
Permalink:
rexzhang/pi-hardware-info@ac22e103aa28f403ada6a78c34f229cc9a33ee99 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/rexzhang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yaml@ac22e103aa28f403ada6a78c34f229cc9a33ee99 -
Trigger Event:
push
-
Statement type: