From b682743a30235a197ea9d642be0086d8d4789445 Mon Sep 17 00:00:00 2001 From: Xenokrates Date: Thu, 20 Jul 2023 09:43:29 +0200 Subject: [PATCH 1/3] Added support for board 'Lemaker Banana Pro' --- adafruit_platformdetect/board.py | 9 ++++++++- adafruit_platformdetect/constants/boards.py | 14 +++++++++++++- bin/detect.py | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index e4c0393..f0ac19c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -342,7 +342,7 @@ class Board: # pylint: disable=too-many-return-statements def _armbian_id(self) -> Optional[str]: - """Check whether the current board is an OrangePi board.""" + """Get the current board via the ARMBIAN release field.""" board_value = self.detector.get_armbian_release_field("BOARD") board = None @@ -384,6 +384,8 @@ class Board: board = boards.BANANA_PI_M2_BERRY elif board_value == "bananapim5": board = boards.BANANA_PI_M5 + elif board_value == "bananapipro": + board = boards.LEMAKER_BANANA_PRO elif board_value == "orangepizeroplus2-h5": board = boards.ORANGE_PI_ZERO_PLUS_2H5 elif board_value == "orangepizeroplus": @@ -854,6 +856,11 @@ class Board: """Check whether the current board is any BananaPi-family system.""" return self.id in boards._BANANA_PI_IDS + @property + def any_lemaker(self) -> bool: + """Check whether the current board is any LeMaker board.""" + return self.id in boards._LEMAKER_IDS + @property def any_maaxboard(self) -> bool: """Check whether the current board is any BananaPi-family system.""" diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 411303f..b07ce35 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -70,6 +70,9 @@ BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS" BANANA_PI_M2_BERRY = "BANANA_PI_M2_BERRY" BANANA_PI_M5 = "BANANA_PI_M5" +# LeMaker boards +LEMAKER_BANANA_PRO = "LEMAKER_BANANA_PRO" + # NVIDIA Jetson boards JETSON_TX1 = "JETSON_TX1" JETSON_TX2 = "JETSON_TX2" @@ -243,7 +246,11 @@ _ORANGE_PI_IDS = ( ) # NanoPi -_NANOPI_IDS = (NANOPI_NEO_AIR, NANOPI_DUO2, NANOPI_NEO) +_NANOPI_IDS = ( + NANOPI_NEO_AIR, + NANOPI_DUO2, + NANOPI_NEO, +) # BananaPI _BANANA_PI_IDS = ( @@ -253,6 +260,11 @@ _BANANA_PI_IDS = ( BANANA_PI_M5, ) +# LeMaker +_LEMAKER_IDS = ( + LEMAKER_BANANA_PRO, +) + # LubanCat _LUBANCAT_IDS = ( LUBANCAT_IMX6ULL, diff --git a/bin/detect.py b/bin/detect.py index 86494bd..dc51067 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -85,6 +85,9 @@ if detector.board.any_pynq_board: if detector.board.any_orange_pi: print("Orange Pi detected.") +if detector.board.any_lemaker: + print("LeMaker board detected.") + if detector.board.any_odroid_40_pin: print("Odroid detected.") From 574da1c42da6f17e7d1ca05311b9248237a8cbdf Mon Sep 17 00:00:00 2001 From: Xenokrates Date: Thu, 20 Jul 2023 10:21:10 +0200 Subject: [PATCH 2/3] Reformatted code to comply with tests. --- adafruit_platformdetect/constants/boards.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index b07ce35..2611695 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -247,8 +247,8 @@ _ORANGE_PI_IDS = ( # NanoPi _NANOPI_IDS = ( - NANOPI_NEO_AIR, - NANOPI_DUO2, + NANOPI_NEO_AIR, + NANOPI_DUO2, NANOPI_NEO, ) @@ -261,9 +261,7 @@ _BANANA_PI_IDS = ( ) # LeMaker -_LEMAKER_IDS = ( - LEMAKER_BANANA_PRO, -) +_LEMAKER_IDS = (LEMAKER_BANANA_PRO,) # LubanCat _LUBANCAT_IDS = ( From c7f8528345dd03669f913ba35f9efbf5361a290f Mon Sep 17 00:00:00 2001 From: Xenokrates Date: Thu, 20 Jul 2023 10:32:19 +0200 Subject: [PATCH 3/3] Fixed the Linux detection. --- adafruit_platformdetect/board.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index f0ac19c..dde01db 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -938,6 +938,7 @@ class Board: yield self.any_stm32mp1 yield self.any_lubancat yield self.any_bananapi + yield self.any_lemaker yield self.any_maaxboard yield self.any_tisk_board yield self.any_siemens_simatic_iot2000