Skip to content

Commit d8f247a

Browse files
authored
Merge pull request #236 from djhedges/main
Add detection support for the Banana Pi M5.
2 parents 9ea2588 + b22430f commit d8f247a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

adafruit_platformdetect/board.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def id(self) -> Optional[str]:
9292
elif chip_id == chips.S905:
9393
board_id = boards.ODROID_C2
9494
elif chip_id == chips.S905X3:
95-
board_id = boards.ODROID_C4
95+
board_id = self._s905x3_id()
9696
elif chip_id == chips.S922X:
9797
board_id = boards.ODROID_N2
9898
elif chip_id == chips.A311D:
@@ -314,6 +314,8 @@ def _armbian_id(self) -> Optional[str]:
314314
board = boards.ORANGE_PI_3_LTS
315315
elif board_value == "bananapim2zero":
316316
board = boards.BANANA_PI_M2_ZERO
317+
elif board_value == "bananapim5":
318+
board = boards.BANANA_PI_M5
317319
elif board_value == "orangepizeroplus2-h5":
318320
board = boards.ORANGE_PI_ZERO_PLUS_2H5
319321
elif board_value == "orangepizeroplus":
@@ -340,6 +342,13 @@ def _sama5_id(self) -> Optional[str]:
340342
return boards.GIANT_BOARD
341343
return None
342344

345+
def _s905x3_id(self) -> Optional[str]:
346+
"""Check what type S905X3 board."""
347+
board_value = self.detector.get_device_model()
348+
if "Bananapi BPI-M5" in board_value:
349+
return boards.BANANA_PI_M5
350+
return boards.ODROID_C4
351+
343352
def _stm32mp1_id(self) -> Optional[str]:
344353
"""Check what type stm32mp1 board."""
345354
board_value = self.detector.get_device_model()

adafruit_platformdetect/chip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def _linux_id(self) -> Optional[str]:
169169

170170
if self.detector.check_dt_compatible_value("amlogic,g12a"):
171171
return chips.S905Y2
172+
if self.detector.check_dt_compatible_value("amlogic, g12a"):
173+
return chips.S905X3
172174

173175
if self.detector.check_dt_compatible_value("sun8i-h3"):
174176
return chips.H3

adafruit_platformdetect/constants/boards.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
# Banana Pi boards
6161
BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO"
62+
BANANA_PI_M5 = "BANANA_PI_M5"
6263

6364
# NVIDIA Jetson boards
6465
JETSON_TX1 = "JETSON_TX1"
@@ -204,7 +205,7 @@
204205
_NANOPI_IDS = (NANOPI_NEO_AIR, NANOPI_DUO2, NANOPI_NEO)
205206

206207
# BananaPI
207-
_BANANA_PI_IDS = (BANANA_PI_M2_ZERO,)
208+
_BANANA_PI_IDS = (BANANA_PI_M2_ZERO, BANANA_PI_M5)
208209

209210
# LubanCat
210211
_LUBANCAT_IDS = (LUBANCAT_IMX6ULL, LUBANCAT_STM32MP157)

0 commit comments

Comments
 (0)