platform

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package platform performs Raspberry Pi SoC-family detection from the device-tree "compatible" bytes exposed by the kernel, without touching the filesystem itself. DetectFamily is pure so it can be exercised with the live fixtures captured on the target board.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Family

type Family struct {
	// IsBCM2712 is true when the BCM2712 SoC (Raspberry Pi 5 generation) is
	// present in the compatible list.
	IsBCM2712 bool
	// SoC is the matched SoC compatible token (e.g. "brcm,bcm2712"), or "" if
	// no known SoC was matched.
	SoC string
	// Model is the first (most specific) compatible token, e.g.
	// "raspberrypi,5-model-b".
	Model string
}

Family describes the SoC family derived from the device-tree "compatible" list.

func DetectFamily

func DetectFamily(compatible []byte) Family

DetectFamily decodes /proc/device-tree/compatible, which is a NUL-separated list of NUL-terminated strings. The bytes are split on 0x00 and empty tokens are dropped. The first remaining token is taken as Model. If the "brcm,bcm2712" token is present, IsBCM2712 is set and SoC records it.

As a convenience for the live test fixtures (which render NUL as a space), ASCII spaces are also treated as separators; real device-tree data contains no spaces in these tokens, so this is unambiguous.

Empty (or all-empty) input yields the zero Family.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL