Skip to content

Commit 6cb1301

Browse files
authored
Update board.py
1 parent cbf7ae7 commit 6cb1301

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

adafruit_platformdetect/board.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def id(self):
8080
elif chip_id == chips.GENERIC_X86:
8181
board_id = boards.GENERIC_LINUX_PC
8282
elif chip_id == chips.SUN8I:
83-
board_id = self._armbian_id()
83+
board_id = self._armbian_id() or self._allwinner_variants_id()
8484
elif chip_id == chips.SAMA5:
8585
board_id = self._sama5_id()
8686
elif chip_id == chips.IMX8MX:
@@ -136,9 +136,9 @@ def id(self):
136136
elif chip_id == chips.H6:
137137
board_id = self._pine64_id()
138138
elif chip_id == chips.H5:
139-
board_id = self._armbian_id()
139+
board_id = self._armbian_id() or self._allwinner_variants_id()
140140
elif chip_id == chips.H616:
141-
board_id = self._armbian_id()
141+
board_id = self._armbian_id() or self._allwinner_variants_id()
142142
elif chip_id == chips.A33:
143143
board_id = self._clockwork_pi_id()
144144
elif chip_id == chips.RK3308:
@@ -438,6 +438,27 @@ def _asus_tinker_board_id(self):
438438
board = boards._ASUS_TINKER_BOARD_IDS
439439
return board
440440

441+
def _allwinner_variants_id(self):
442+
"""Try to detect the id of allwinner based board. (orangepi, nanopi)"""
443+
board_value = self.detector.get_device_model()
444+
board = None
445+
if not board_value:
446+
return board
447+
board_value = board_value.lower()
448+
chip_id = self.detector.chip.id
449+
if "nanopi" in board_value:
450+
if "neo" in board_value and "SUN8I" in chip_id:
451+
board = boards.NANOPI_NEO_AIR
452+
# TODO: Add other specifc board contexts here
453+
elif "orange pi" in board_value:
454+
if "zero" in board_value:
455+
if "H5" in chip_id:
456+
board = boards.ORANGE_PI_ZERO_PLUS_2H5
457+
elif "H616" in chip_id:
458+
board = boards.ORANGE_PI_ZERO_2
459+
# TODO: Add other specifc board contexts here
460+
return board
461+
441462
@property
442463
def any_nanopi(self):
443464
"""Check whether the current board is any defined Nano Pi."""

0 commit comments

Comments
 (0)