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.platformVarious 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.boardBoardBoard.any_96boardsBoard.any_ameridroidBoard.any_asus_tinker_boardBoard.any_bananapiBoard.any_beagleboneBoard.any_clockwork_pi_boardBoard.any_coral_boardBoard.any_embedded_linuxBoard.any_giant_boardBoard.any_horizon_boardBoard.any_jetson_boardBoard.any_lemakerBoard.any_libre_computer_boardBoard.any_lichee_riscv_boardBoard.any_lubancatBoard.any_luckfox_pico_boardBoard.any_maaxboardBoard.any_milkv_boardBoard.any_nanopiBoard.any_nxp_navq_boardBoard.any_odroid_40_pinBoard.any_odroid_mini_pcBoard.any_olimex_boardBoard.any_onion_omega_boardBoard.any_orange_piBoard.any_pcduino_boardBoard.any_pine64_boardBoard.any_pynq_boardBoard.any_raspberry_piBoard.any_raspberry_pi_40_pinBoard.any_raspberry_pi_4_boardBoard.any_raspberry_pi_5_boardBoard.any_raspberry_pi_cmBoard.any_repka_boardBoard.any_rock_pi_boardBoard.any_seeed_boardBoard.any_siemens_simatic_iot2000Board.any_sifive_boardBoard.any_starfive_idBoard.any_stm32mp1Board.any_tisk_boardBoard.any_udoo_boardBoard.any_vivid_unitBoard.any_walnutpiBoard.binho_novaBoard.feather_can_u2ifBoard.feather_epd_u2ifBoard.feather_rfm_u2ifBoard.feather_u2ifBoard.ftdi_ft2232hBoard.ftdi_ft232hBoard.generic_linuxBoard.greatfet_oneBoard.idBoard.itsybitsy_u2ifBoard.kb2040_u2ifBoard.khadas_vim3_40_pinBoard.macropad_u2ifBoard.microchip_mcp2221Board.os_agnostic_boardBoard.os_environ_boardBoard.pico_u2ifBoard.qt2040_trinkey_u2ifBoard.qtpy_u2ifBoard.rp2040_one_u2if
adafruit_platformdetect.chipChip