Skip to content

Commit 56e81be

Browse files
authored
Merge branch 'adafruit:main' into main
2 parents e1bc181 + 715e573 commit 56e81be

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

adafruit_platformdetect/board.py

+18
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ def id(self) -> Optional[str]:
6565
board_id = self._armbian_id() or self._allwinner_variants_id()
6666
elif chip_id == chips.BCM2XXX:
6767
board_id = self._pi_id()
68+
elif chip_id == chips.OS_AGNOSTIC:
69+
board_id = boards.OS_AGNOSTIC_BOARD
6870
elif chip_id == chips.AM625X:
6971
board_id = self._beaglebone_id()
7072
elif chip_id == chips.AM33XX:
7173
board_id = self._beaglebone_id()
7274
elif chip_id == chips.AM65XX:
7375
board_id = self._siemens_simatic_iot2000_id()
76+
elif chip_id == chips.AM67A:
77+
board_id = self._beagleyai_id()
7478
elif chip_id == chips.DRA74X:
7579
board_id = self._bbai_id()
7680
elif chip_id == chips.SUN4I:
@@ -340,6 +344,12 @@ def _beaglebone_id(self) -> Optional[str]:
340344
return None
341345

342346
# pylint: enable=no-self-use
347+
def _beagleyai_id(self) -> Optional[str]:
348+
"""Try to detect id of a BeagleY-AI board."""
349+
board_value = self.detector.get_device_model()
350+
if "BeagleY-AI" in board_value:
351+
return boards.BEAGLEY_AI
352+
return None
343353

344354
def _bbai_id(self) -> Optional[str]:
345355
"""Try to detect id of a Beaglebone AI related board."""
@@ -734,6 +744,8 @@ def _allwinner_variants_id(self) -> Optional[str]:
734744
board = boards.ORANGE_PI_ZERO_PLUS_2H5
735745
elif "H616" in chip_id:
736746
board = boards.ORANGE_PI_ZERO_2
747+
elif "walnutpi-1b-emmc" in board_value:
748+
board = boards.WALNUT_PI_1B_EMMC
737749
elif "walnutpi-1b" in board_value:
738750
board = boards.WALNUT_PI_1B
739751
# TODO: Add other specifc board contexts here
@@ -1036,6 +1048,7 @@ def lazily_generate_conditions():
10361048
yield self.board.QTPY_U2IF
10371049
yield self.board.QT2040_TRINKEY_U2IF
10381050
yield self.board.KB2040_U2IF
1051+
yield self.board.OS_AGNOSTIC_BOARD
10391052

10401053
return any(condition for condition in lazily_generate_conditions())
10411054

@@ -1105,6 +1118,11 @@ def microchip_mcp2221(self) -> bool:
11051118
"""Check whether the current board is a Microchip MCP2221."""
11061119
return self.id == boards.MICROCHIP_MCP2221
11071120

1121+
@property
1122+
def os_agnostic_board(self) -> bool:
1123+
"""Check whether the current board is an OS agnostic special case."""
1124+
return self.id == boards.OS_AGNOSTIC_BOARD
1125+
11081126
@property
11091127
def pico_u2if(self) -> bool:
11101128
"""Check whether the current board is a RPi Pico w/ u2if."""

adafruit_platformdetect/chip.py

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ def id(
9898
"BLINKA_MCP2221 environment variable "
9999
+ "set, but no MCP2221 device found"
100100
)
101+
if os.environ.get("BLINKA_OS_AGNOSTIC"):
102+
# we don't need to look for this chip, it's just a flag
103+
self._chip_id = chips.OS_AGNOSTIC
104+
return self._chip_id
101105
if os.environ.get("BLINKA_U2IF"):
102106
import hid
103107

@@ -179,6 +183,8 @@ def _linux_id(self) -> Optional[str]:
179183
# pylint: disable=too-many-branches,too-many-statements
180184
# pylint: disable=too-many-return-statements
181185
"""Attempt to detect the CPU on a computer running the Linux kernel."""
186+
if self.detector.check_dt_compatible_value("beagle,am67a-beagley-ai"):
187+
return chips.AM67A
182188
if self.detector.check_dt_compatible_value("ti,am625"):
183189
return chips.AM625X
184190
if self.detector.check_dt_compatible_value("ti,am654"):

adafruit_platformdetect/constants/boards.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
BEAGLEBONE_AI = "BEAGLEBONE_AI"
2222
BEAGLEBONE_POCKETBONE = "BEAGLEBONE_POCKETBONE"
2323
BEAGLEV_STARLIGHT = "BEAGLEV_STARLIGHT"
24+
BEAGLEY_AI = "BEAGLEY_AI"
2425
BEAGLELOGIC_STANDALONE = "BEAGLELOGIC_STANDALONE"
2526
OSD3358_DEV_BOARD = "OSD3358_DEV_BOARD"
2627
OSD3358_SM_RED = "OSD3358_SM_RED"
@@ -40,6 +41,7 @@
4041

4142
# Walnut Pi boards
4243
WALNUT_PI_1B = "WALNUT_PI_1B"
44+
WALNUT_PI_1B_EMMC = "WALNUT_PI_1B_EMMC"
4345

4446
# Clockwork Pi boards
4547
CLOCKWORK_CPI3 = "CLOCKWORK_CPI3"
@@ -240,7 +242,10 @@
240242
)
241243

242244
# WalnutPi
243-
_WALNUT_PI_IDS = (WALNUT_PI_1B,)
245+
_WALNUT_PI_IDS = (
246+
WALNUT_PI_1B,
247+
WALNUT_PI_1B_EMMC,
248+
)
244249

245250
# STM32MP1
246251
_STM32MP1_IDS = (
@@ -418,6 +423,7 @@
418423
_ODROID_MINI_PC_IDS = (ODROID_H3,)
419424

420425
_BEAGLEBONE_IDS = (
426+
BEAGLEY_AI,
421427
BEAGLE_PLAY,
422428
BEAGLEBONE_AI64,
423429
BEAGLEBONE,
@@ -594,3 +600,6 @@
594600
LUCKFOX_PICO_MAX,
595601
LUCKFOX_PICO_MINI,
596602
)
603+
604+
# Agnostic board
605+
OS_AGNOSTIC_BOARD = "OS_AGNOSTIC_BOARD"

adafruit_platformdetect/constants/chips.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
"""Definition of chips."""
66
A311D = "A311D"
7+
OS_AGNOSTIC = "OS_AGNOSTIC"
78
AM33XX = "AM33XX"
89
AM625X = "AM625X"
910
AM65XX = "AM65XX"
11+
AM67A = "AM67A"
1012
DRA74X = "DRA74X"
1113
TDA4VM = "TDA4VM"
1214
IMX6ULL = "IMX6ULL"

0 commit comments

Comments
 (0)