Skip to content

Commit 1d30230

Browse files
committed
support allwinner h618 chip, bananapi m4berry and m4zero board
1 parent 20f52a2 commit 1d30230

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ def id(self) -> Optional[str]:
156156
or self._allwinner_variants_id()
157157
or self._repka_variants_id()
158158
)
159+
elif chip_id == chips.H618:
160+
board_id = self._armbian_id() or self._allwinner_variants_id()
159161
elif chip_id == chips.H616:
160162
board_id = self._armbian_id() or self._allwinner_variants_id()
161163
elif chip_id == chips.A33:
@@ -431,6 +433,10 @@ def _armbian_id(self) -> Optional[str]:
431433
board = boards.BANANA_PI_M2_PLUS
432434
elif board_value == "bananapim2berry":
433435
board = boards.BANANA_PI_M2_BERRY
436+
elif board_value == "bananapim4berry":
437+
board = boards.BANANA_PI_M4_BERRY
438+
elif board_value == "bananapim4zero":
439+
board = boards.BANANA_PI_M4_ZERO
434440
elif board_value == "bananapim5":
435441
board = boards.BANANA_PI_M5
436442
elif board_value == "orangepizeroplus2-h5":
@@ -758,6 +764,14 @@ def _allwinner_variants_id(self) -> Optional[str]:
758764
if "banana pi m2 berry" in board_value:
759765
board = boards.BANANA_PI_M2_BERRY
760766

767+
if any(x in board_value for x in ("banana pi", "bananapi"));
768+
if "m2 berry" in board_value:
769+
board = boards.BANANA_PI_M2_BERRY
770+
elif "m4berry" in board_value or "m4 berry" in board_value:
771+
board = boards.BANANA_PI_M4_BERRY
772+
elif "m4zero" in board_value or "m4 zero" in board_value:
773+
board = boards.BANANA_PI_M4_ZERO
774+
761775
if "nanopi" in board_value:
762776
if "neo" in board_value and "SUN8I" in chip_id:
763777
board = boards.NANOPI_NEO_AIR

adafruit_platformdetect/chip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ def _linux_id(self) -> Optional[str]:
285285
if self.detector.check_dt_compatible_value("sun50i-h5"):
286286
return chips.H5
287287

288+
if self.detector.check_dt_compatible_value("sun50i-h618"):
289+
return chips.H618
290+
288291
if self.detector.check_dt_compatible_value("sun50i-h616"):
289292
return chips.H616
290293

adafruit_platformdetect/constants/boards.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO"
7979
BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS"
8080
BANANA_PI_M2_BERRY = "BANANA_PI_M2_BERRY"
81+
BANANA_PI_M4_BERRY = "BANANA_PI_M4_BERRY"
82+
BANANA_PI_M4_ZERO = "BANANA_PI_M4_ZERO"
8183
BANANA_PI_M5 = "BANANA_PI_M5"
8284

8385
# LeMaker boards
@@ -305,6 +307,8 @@
305307
BANANA_PI_M2_ZERO,
306308
BANANA_PI_M2_PLUS,
307309
BANANA_PI_M2_BERRY,
310+
BANANA_PI_M4_BERRY,
311+
BANANA_PI_M4_ZERO,
308312
BANANA_PI_M5,
309313
)
310314

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
H5 = "H5"
5656
H3 = "H3"
5757
H616 = "H616"
58+
H618 = "H618"
5859
RK3308 = "RK3308"
5960
RK3399 = "RK3399"
6061
RK3399_T = "RK3399_T"

bin/detect.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
"Is this an OS environment variable special case?", detector.board.os_environ_board
7676
)
7777

78+
if detector.board.any_bananapi:
79+
print("Bananapi board detected.")
80+
7881
if detector.board.any_jetson_board:
7982
print("Jetson platform detected.")
8083

0 commit comments

Comments
 (0)