Introduction¶
This library provides best-guess platform detection for a range of single-board computers and (potentially) other platforms. It was written primarily for use in Adafruit_Blinka, but may be useful in other contexts.
Platform detection is divided into “chip” and “board” detection, with the latter generally dependent on the former. Platform info is gathered from:
Python’s
sys.platform
Various files on Linux systems:
/proc/cpuinfo (for processor info, Raspberry Pi hardware revisions, etc.)
/proc/device-tree/compatible (for 96Boards info)
Beaglebone EEPROM board IDs
Distribution-specific files such as /etc/armbian-release.
Dependencies¶
This driver depends on:
Python 3.7 or higher
Installing from PyPI¶
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install Adafruit-PlatformDetect
To install system-wide (this may be required in some cases):
sudo pip3 install Adafruit-PlatformDetect
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install Adafruit-PlatformDetect
Usage Example¶
from adafruit_platformdetect import Detector
detector = Detector()
print("Chip id: ", detector.chip.id)
print("Board id: ", detector.board.id)
# Check for specific board models:
print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS)
print("BBB? ", detector.board.BEAGLEBONE_BLACK)
print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation¶
For information on building library documentation, please check out this guide.
Table of Contents¶
API Reference
adafruit_platformdetect.board
Board
Board.any_96boards
Board.any_ameridroid
Board.any_asus_tinker_board
Board.any_bananapi
Board.any_beaglebone
Board.any_clockwork_pi_board
Board.any_coral_board
Board.any_embedded_linux
Board.any_giant_board
Board.any_horizon_board
Board.any_jetson_board
Board.any_lemaker
Board.any_libre_computer_board
Board.any_lichee_riscv_board
Board.any_lubancat
Board.any_luckfox_pico_board
Board.any_maaxboard
Board.any_milkv_board
Board.any_nanopi
Board.any_nxp_navq_board
Board.any_odroid_40_pin
Board.any_odroid_mini_pc
Board.any_olimex_board
Board.any_onion_omega_board
Board.any_orange_pi
Board.any_pcduino_board
Board.any_pine64_board
Board.any_pynq_board
Board.any_raspberry_pi
Board.any_raspberry_pi_40_pin
Board.any_raspberry_pi_4_board
Board.any_raspberry_pi_5_board
Board.any_raspberry_pi_cm
Board.any_repka_board
Board.any_rock_pi_board
Board.any_seeed_board
Board.any_siemens_simatic_iot2000
Board.any_sifive_board
Board.any_starfive_id
Board.any_stm32mp1
Board.any_tisk_board
Board.any_udoo_board
Board.any_vivid_unit
Board.any_walnutpi
Board.binho_nova
Board.feather_can_u2if
Board.feather_epd_u2if
Board.feather_rfm_u2if
Board.feather_u2if
Board.ftdi_ft2232h
Board.ftdi_ft232h
Board.generic_linux
Board.greatfet_one
Board.id
Board.itsybitsy_u2if
Board.kb2040_u2if
Board.khadas_vim3_40_pin
Board.macropad_u2if
Board.microchip_mcp2221
Board.os_agnostic_board
Board.os_environ_board
Board.pico_u2if
Board.qt2040_trinkey_u2if
Board.qtpy_u2if
Board.rp2040_one_u2if
adafruit_platformdetect.chip
Chip