Skip to content

Support Allwinner detection on non armbian distros #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def id(self):
elif chip_id == chips.GENERIC_X86:
board_id = boards.GENERIC_LINUX_PC
elif chip_id == chips.SUN8I:
board_id = self._armbian_id()
board_id = self._armbian_id() or self._allwinner_variants_id()
elif chip_id == chips.SAMA5:
board_id = self._sama5_id()
elif chip_id == chips.IMX8MX:
Expand Down Expand Up @@ -128,7 +128,7 @@ def id(self):
elif chip_id == chips.H6:
board_id = self._pine64_id()
elif chip_id == chips.H5:
board_id = self._armbian_id()
board_id = self._armbian_id() or self._allwinner_variants_id()
elif chip_id == chips.H616:
board_id = self._armbian_id()
elif chip_id == chips.A33:
Expand Down Expand Up @@ -410,6 +410,24 @@ def _asus_tinker_board_id(self):
board = boards._ASUS_TINKER_BOARD_IDS
return board

def _allwinner_variants_id(self):
"""Try to detect the id of allwinner based board. (orangepi, nanopi)"""
board_value = self.detector.get_device_model()
board = None
if not board_value:
return board
board_value = board_value.lower()
chip_id = self.detector.chip.id
if "nanopi" in board_value:
if "neo" in board_value and 'SUN8I' in chip_id:
board = boards.NANOPI_NEO_AIR
# TODO: Add other specifc board contexts here
elif "orange pi" in board_value:
if "zero" in board_value and 'H5' in chip_id:
board = boards.ORANGE_PI_ZERO_PLUS_2H5
# TODO: Add other specifc board contexts here
return board

@property
def any_nanopi(self):
"""Check whether the current board is any defined Nano Pi."""
Expand Down