From cbf7ae7363aee6841c48b7105bed705ab54df354 Mon Sep 17 00:00:00 2001 From: twa127 <46624596+twa127@users.noreply.github.com> Date: Mon, 10 May 2021 20:21:36 +0100 Subject: [PATCH 1/2] Add files via upload --- adafruit_platformdetect/board.py | 31 +++--------- adafruit_platformdetect/chip.py | 3 ++ adafruit_platformdetect/constants/boards.py | 56 ++++----------------- adafruit_platformdetect/constants/chips.py | 1 + 4 files changed, 21 insertions(+), 70 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index f19e4450..b8cec88b 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -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() or self._allwinner_variants_id() + board_id = self._armbian_id() elif chip_id == chips.SAMA5: board_id = self._sama5_id() elif chip_id == chips.IMX8MX: @@ -136,9 +136,9 @@ def id(self): elif chip_id == chips.H6: board_id = self._pine64_id() elif chip_id == chips.H5: - board_id = self._armbian_id() or self._allwinner_variants_id() + board_id = self._armbian_id() elif chip_id == chips.H616: - board_id = self._armbian_id() or self._allwinner_variants_id() + board_id = self._armbian_id() elif chip_id == chips.A33: board_id = self._clockwork_pi_id() elif chip_id == chips.RK3308: @@ -149,6 +149,8 @@ def id(self): board_id = self._rock_pi_id() elif chip_id == chips.RK3288: board_id = self._asus_tinker_board_id() + elif chip_id == chips.RK3328: + board_id = self._rock_pi_id() elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() elif chip_id == chips.PENTIUM_N3710: @@ -402,6 +404,8 @@ def _rock_pi_id(self): board = boards.ROCK_PI_S if board_value and "ROCK PI 4" in board_value.upper(): board = boards.ROCK_PI_4 + if board_value and "ROCK PI E" in board_value.upper(): + board = boards.ROCK_PI_E if self.detector.check_board_name_value() == "ROCK Pi X": board = boards.ROCK_PI_X return board @@ -434,27 +438,6 @@ 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: - if "H5" in chip_id: - board = boards.ORANGE_PI_ZERO_PLUS_2H5 - elif "H616" in chip_id: - board = boards.ORANGE_PI_ZERO_2 - # TODO: Add other specifc board contexts here - return board - @property def any_nanopi(self): """Check whether the current board is any defined Nano Pi.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 57151e8b..9fe3c7d9 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -184,6 +184,9 @@ def _linux_id(self): if self.detector.check_dt_compatible_value("rockchip,rk3288"): return chips.RK3288 + if self.detector.check_dt_compatible_value("rockchip,rk3328"): + return chips.RK3328 + if self.detector.check_dt_compatible_value("st,stm32mp157"): return chips.STM32MP157 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index bc8b9e3d..8a423445 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -133,6 +133,7 @@ ROCK_PI_S = "ROCK_PI_S" ROCK_PI_4 = "ROCK_PI_4" ROCK_PI_X = "ROCK_PI_X" +ROCK_PI_E = "ROCK_PI_E" GREATFET_ONE = "GREATFET_ONE" @@ -145,11 +146,7 @@ _ASUS_TINKER_BOARD_IDS = (ASUS_TINKER_BOARD,) # STM32MP1 -_STM32MP1_IDS = ( - STM32MP157C_DK2, - LUBANCAT_STM32MP157, - OSD32MP1_BRK, -) +_STM32MP1_IDS = (STM32MP157C_DK2, LUBANCAT_STM32MP157, OSD32MP1_BRK) # OrangePI _ORANGE_PI_IDS = ( @@ -167,36 +164,21 @@ ) # NanoPi -_NANOPI_IDS = ( - NANOPI_NEO_AIR, - NANOPI_DUO2, -) +_NANOPI_IDS = (NANOPI_NEO_AIR, NANOPI_DUO2) # BananaPI _BANANA_PI_IDS = (BANANA_PI_M2_ZERO,) # LubanCat -_LUBANCAT_IDS = ( - LUBANCAT_IMX6ULL, - LUBANCAT_STM32MP157, -) +_LUBANCAT_IDS = (LUBANCAT_IMX6ULL, LUBANCAT_STM32MP157) # Coral boards -_CORAL_IDS = ( - CORAL_EDGE_TPU_DEV, - CORAL_EDGE_TPU_DEV_MINI, -) +_CORAL_IDS = (CORAL_EDGE_TPU_DEV, CORAL_EDGE_TPU_DEV_MINI) _PYNQ_IDS = (PYNQ_Z1, PYNQ_Z2) _JETSON_IDS = ( - ( - JETSON_TX1, - ( - "nvidia,p2371-2180", - "nvidia,jetson-cv", - ), - ), + (JETSON_TX1, ("nvidia,p2371-2180", "nvidia,jetson-cv")), ( JETSON_TX2, ( @@ -210,22 +192,8 @@ ), (JETSON_TX2_NX, ("nvidia,p3509-0000+p3636-0001",)), (CLARA_AGX_XAVIER, ("nvidia,e3900-0000+p2888-0004",)), - ( - JETSON_XAVIER, - ( - "nvidia,p2972-0000", - "nvidia,p2972-0006", - "nvidia,jetson-xavier", - ), - ), - ( - JETSON_NANO, - ( - "nvidia,p3450-0000", - "nvidia,p3450-0002", - "nvidia,jetson-nano", - ), - ), + (JETSON_XAVIER, ("nvidia,p2972-0000", "nvidia,p2972-0006", "nvidia,jetson-xavier")), + (JETSON_NANO, ("nvidia,p3450-0000", "nvidia,p3450-0002", "nvidia,jetson-nano")), ( JETSON_NX, ( @@ -454,11 +422,7 @@ "2c03112", ), RASPBERRY_PI_400: ("c03130",), - RASPBERRY_PI_CM4: ( - "a03140", - "b03140", - "c03140", - ), + RASPBERRY_PI_CM4: ("a03140", "b03140", "c03140"), } # Onion omega boards @@ -468,7 +432,7 @@ _PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE, SOPINE) # RockPi boards and devices -_ROCK_PI_IDS = (ROCK_PI_S, ROCK_PI_4, ROCK_PI_X) +_ROCK_PI_IDS = (ROCK_PI_S, ROCK_PI_4, ROCK_PI_X, ROCK_PI_E) # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",), UDOO_X86: ("dummy",)} diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index da9e65d9..be55d4fa 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -37,6 +37,7 @@ H616 = "H616" RK3308 = "RK3308" RK3399 = "RK3399" +RK3328 = "RK3328" LPC4330 = "LPC4330" RK3288 = "RK3288" PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core From 6cb13015ad53fd411fa05f9429bc0277aad70946 Mon Sep 17 00:00:00 2001 From: twa127 <46624596+twa127@users.noreply.github.com> Date: Mon, 10 May 2021 20:55:36 +0100 Subject: [PATCH 2/2] Update board.py --- adafruit_platformdetect/board.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index b8cec88b..5acfbf5e 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -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: @@ -136,9 +136,9 @@ 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() + board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.A33: board_id = self._clockwork_pi_id() elif chip_id == chips.RK3308: @@ -438,6 +438,27 @@ 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: + if "H5" in chip_id: + board = boards.ORANGE_PI_ZERO_PLUS_2H5 + elif "H616" in chip_id: + board = boards.ORANGE_PI_ZERO_2 + # TODO: Add other specifc board contexts here + return board + @property def any_nanopi(self): """Check whether the current board is any defined Nano Pi."""