AdafruitPlatformDetect Library Documentation Release 1.0.0

Brennen Bearnes

Jul 16, 2021

Contents

1 Dependencies 3

2 Installing from PyPI 5

3 Usage Example 7

4 Contributing 9

5 Documentation 11

6 Table of Contents 13 6.1 adafruit_platformdetect.board ...... 13 6.1.1 Implementation Notes...... 13 6.2 adafruit_platformdetect. ...... 15 6.2.1 Implementation Notes...... 15

7 Indices and tables 17

Python Module Index 19

Index 21

i ii AdafruitPlatformDetect Library Documentation, Release 1.0.0

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 systems: – /proc/cpuinfo (for processor info, hardware revisions, etc.) – /proc/device-tree/compatible (for 96Boards info) • Beaglebone EEPROM board IDs • Distribution-specific files such as /etc/armbian-release.

Contents 1 AdafruitPlatformDetect Library Documentation, Release 1.0.0

2 Contents CHAPTER 1

Dependencies

This driver depends on: • Python 3.5 or higher

3 AdafruitPlatformDetect Library Documentation, Release 1.0.0

4 Chapter 1. Dependencies CHAPTER 2

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

5 AdafruitPlatformDetect Library Documentation, Release 1.0.0

6 Chapter 2. Installing from PyPI CHAPTER 3

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)

7 AdafruitPlatformDetect Library Documentation, Release 1.0.0

8 Chapter 3. Usage Example CHAPTER 4

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

9 AdafruitPlatformDetect Library Documentation, Release 1.0.0

10 Chapter 4. Contributing CHAPTER 5

Documentation

For information on building library documentation, please check out this guide.

11 AdafruitPlatformDetect Library Documentation, Release 1.0.0

12 Chapter 5. Documentation CHAPTER 6

Table of Contents

6.1 adafruit_platformdetect.board

Detect boards • Author(s): Melissa LeBlanc-Williams

6.1.1 Implementation Notes

Software and Dependencies: • Linux and Python 3.5 or Higher class adafruit_platformdetect.board.Board(detector) Attempt to detect specific boards. any_96boards Check whether the current board is any 96boards board. any_asus_tinker_board Check to see if the current board is an any_beaglebone Check whether the current board is any Beaglebone-family system. any_clockwork_pi_board Check whether the current board is any Clockwork Pi device. any_coral_board Check whether the current board is any defined Coral. any_embedded_linux Check whether the current board is any embedded Linux device. any_giant_board Check whether the current board is any defined Giant Board.

13 AdafruitPlatformDetect Library Documentation, Release 1.0.0

any_jetson_board Check whether the current board is any defined Jetson Board. any_lubancat Check whether the current board is any defined lubancat. any_nanopi Check whether the current board is any defined Nano Pi. any_odroid_40_pin Check whether the current board is any defined 40-pin Odroid. any_onion_omega_board Check whether the current board is any defined OpenWRT board. any_orange_pi Check whether the current board is any defined Orange Pi. any_pine64_board Check whether the current board is any device. any_pynq_board Check whether the current board is any defined PYNQ Board. any_raspberry_pi Check whether the current board is any Raspberry Pi. any_raspberry_pi_40_pin Check whether the current board is any 40-pin Raspberry Pi. any_raspberry_pi_cm Check whether the current board is any Compute Module Raspberry Pi. any_rock_pi_board Check whether the current board is any Rock Pi device. any_sifive_board Check whether the current board is any defined Jetson Board. any_stm32mp1 Check whether the current board is any stm32mp1 board. any_udoo_board Check to see if the current board is an UDOO board binho_nova Check whether the current board is an BINHO NOVA. feather_u2if Check whether the current board is a Feather RP2040 w/ u2if. ftdi_ft2232h Check whether the current board is an FTDI FT2232H. ftdi_ft232h Check whether the current board is an FTDI FT232H. greatfet_one Check whether the current board is a GreatFET One. id Return a unique id for the detected board, if any.

14 Chapter 6. Table of Contents AdafruitPlatformDetect Library Documentation, Release 1.0.0

itsybitsy_u2if Check whether the current board is a Itsy Bitsy w/ u2if. microchip_mcp2221 Check whether the current board is a Microchip MCP2221. pico_u2if Check whether the current board is a RPi Pico w/ u2if. qt2040_trinkey_u2if Check whether the current board is a QT Py w/ u2if. qtpy_u2if Check whether the current board is a QT Py w/ u2if.

6.2 adafruit_platformdetect.chip

Attempt detection of current chip / CPU • Author(s): Melissa LeBlanc-Williams

6.2.1 Implementation Notes

Software and Dependencies: • Linux and Python 3.5 or Higher class adafruit_platformdetect.chip.Chip(detector) Attempt detection of current chip / CPU. id Return a unique id for the detected chip, if any.

6.2. adafruit_platformdetect.chip 15 AdafruitPlatformDetect Library Documentation, Release 1.0.0

16 Chapter 6. Table of Contents CHAPTER 7

Indices and tables

• genindex • modindex • search

17 AdafruitPlatformDetect Library Documentation, Release 1.0.0

18 Chapter 7. Indices and tables Python Module Index

a adafruit_platformdetect.board, 13 adafruit_platformdetect.chip, 15

19 AdafruitPlatformDetect Library Documentation, Release 1.0.0

20 Python Module Index Index

A attribute), 14 adafruit_platformdetect.board (module), 13 any_raspberry_pi_40_pin adafruit_platformdetect.chip (module), 15 (adafruit_platformdetect.board.Board at- any_96boards (adafruit_platformdetect.board.Board tribute), 14 attribute), 13 any_raspberry_pi_cm any_asus_tinker_board (adafruit_platformdetect.board.Board at- (adafruit_platformdetect.board.Board at- tribute), 14 tribute), 13 any_rock_pi_board any_beaglebone (adafruit_platformdetect.board.Board (adafruit_platformdetect.board.Board at- attribute), 13 tribute), 14 any_clockwork_pi_board any_sifive_board (adafruit_platformdetect.board.Board (adafruit_platformdetect.board.Board at- attribute), 14 tribute), 13 any_stm32mp1 (adafruit_platformdetect.board.Board any_coral_board (adafruit_platformdetect.board.Board attribute), 14 attribute), 13 any_udoo_board (adafruit_platformdetect.board.Board any_embedded_linux attribute), 14 (adafruit_platformdetect.board.Board at- tribute), 13 B any_giant_board (adafruit_platformdetect.board.Boardbinho_nova (adafruit_platformdetect.board.Board at- attribute), 13 tribute), 14 any_jetson_board (adafruit_platformdetect.board.BoardBoard (class in adafruit_platformdetect.board), 13 attribute), 13 any_lubancat (adafruit_platformdetect.board.Board C attribute), 14 Chip (class in adafruit_platformdetect.chip), 15 any_nanopi (adafruit_platformdetect.board.Board at- tribute), 14 F any_odroid_40_pin feather_u2if (adafruit_platformdetect.board.Board (adafruit_platformdetect.board.Board at- attribute), 14 tribute), 14 ftdi_ft2232h (adafruit_platformdetect.board.Board any_onion_omega_board attribute), 14 (adafruit_platformdetect.board.Board at- ftdi_ft232h (adafruit_platformdetect.board.Board tribute), 14 attribute), 14 any_orange_pi (adafruit_platformdetect.board.Board attribute), 14 G any_pine64_board (adafruit_platformdetect.board.Board greatfet_one (adafruit_platformdetect.board.Board attribute), 14 attribute), 14 any_pynq_board (adafruit_platformdetect.board.Board attribute), 14 I any_raspberry_pi (adafruit_platformdetect.board.Board id (adafruit_platformdetect.board.Board attribute), 14

21 AdafruitPlatformDetect Library Documentation, Release 1.0.0 id (adafruit_platformdetect.chip.Chip attribute), 15 itsybitsy_u2if (adafruit_platformdetect.board.Board attribute), 14 M microchip_mcp2221 (adafruit_platformdetect.board.Board at- tribute), 15 P pico_u2if (adafruit_platformdetect.board.Board at- tribute), 15 Q qt2040_trinkey_u2if (adafruit_platformdetect.board.Board at- tribute), 15 qtpy_u2if (adafruit_platformdetect.board.Board at- tribute), 15

22 Index