From 48c2e558e72652d904bf7ae4c9570ee00480cca7 Mon Sep 17 00:00:00 2001 From: lilin Date: Thu, 17 Nov 2022 03:02:51 +0000 Subject: [PATCH 1/4] Add supprot for LubanCat Zero,LubanCat1 and LubanCat2 --- adafruit_platformdetect/board.py | 18 ++++++++++++++++++ adafruit_platformdetect/chip.py | 6 ++++++ adafruit_platformdetect/constants/boards.py | 11 ++++++++++- adafruit_platformdetect/constants/chips.py | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index d206cbba..c10f9ec3 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -468,6 +468,24 @@ def _pynq_id(self) -> Optional[str]: except FileNotFoundError: return None + + def _rk3566_id(self) -> Optional[str]: + """Check what type of rk3566 board.""" + board_value = self.detector.get_device_model() + board = None + if board_value and "LubanCat Zero" in board_value: + board = boards.LUBANCAT_ZERO + if board_value and "LubanCat1" in board_value: + board = boards.LUBANCAT1 + return board + + def _rk3568_id(self) -> Optional[str]: + """Check what type of rk3568 board.""" + board_value = self.detector.get_device_model() + board = None + if board_value and "LubanCat2" in board_value: + board = boards.LUBANCAT2 + return board def _rock_pi_id(self) -> Optional[str]: """Check what type of Rock Pi board.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index d82545c5..866db83c 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -217,6 +217,12 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("rockchip,rk3328"): return chips.RK3328 + + if self.detector.check_dt_compatible_value("rockchip,rk3566"): + return chips.RK3566 + + if self.detector.check_dt_compatible_value("rockchip,rk3568"): + return chips.RK3568 if self.detector.check_dt_compatible_value("rockchip,rk3588"): return chips.RK3588 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 529899a8..c8ed4d4a 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -94,6 +94,9 @@ # Embedfire LubanCat board LUBANCAT_IMX6ULL = "LUBANCAT_IMX6ULL" LUBANCAT_STM32MP157 = "LUBANCAT_STM32MP157" +LUBANCAT_ZERO = "LUBANCAT_ZERO" +LUBANCAT1 = "LUBANCAT1" +LUBANCAT2 = "LUBANCAT2" # Various Raspberry Pi models RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1" @@ -220,7 +223,13 @@ _BANANA_PI_IDS = (BANANA_PI_M2_ZERO, BANANA_PI_M2_PLUS, BANANA_PI_M5) # LubanCat -_LUBANCAT_IDS = (LUBANCAT_IMX6ULL, LUBANCAT_STM32MP157) +_LUBANCAT_IDS = ( + LUBANCAT_IMX6ULL, + LUBANCAT_STM32MP157, + LUBANCAT_ZERO, + LUBANCAT1, + LUBANCAT2, +) # Coral boards _CORAL_IDS = (CORAL_EDGE_TPU_DEV, CORAL_EDGE_TPU_DEV_MINI) diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 782f8a72..c5c44853 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -55,6 +55,8 @@ RK3328 = "RK3328" LPC4330 = "LPC4330" RK3288 = "RK3288" +RK3566 = "RK3566" +RK3568 = "RK3568" RK3588 = "RK3588" PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core STM32F405 = "STM32F405" From 98669f2b796740dccc68ed11a3a490ff7ec374ef Mon Sep 17 00:00:00 2001 From: lilin Date: Fri, 18 Nov 2022 03:25:41 +0000 Subject: [PATCH 2/4] Modify board_value --- adafruit_platformdetect/board.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index c10f9ec3..67bf6e45 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -468,12 +468,12 @@ def _pynq_id(self) -> Optional[str]: except FileNotFoundError: return None - + def _rk3566_id(self) -> Optional[str]: """Check what type of rk3566 board.""" board_value = self.detector.get_device_model() board = None - if board_value and "LubanCat Zero" in board_value: + if board_value and "LubanCat-Zero" in board_value: board = boards.LUBANCAT_ZERO if board_value and "LubanCat1" in board_value: board = boards.LUBANCAT1 From deebf95ecced56b28b73261cf54f30b3697a156b Mon Sep 17 00:00:00 2001 From: lilin Date: Fri, 18 Nov 2022 05:55:54 +0000 Subject: [PATCH 3/4] board detect --- adafruit_platformdetect/board.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 67bf6e45..e1295911 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -155,6 +155,10 @@ def id(self) -> Optional[str]: board_id = self._asus_tinker_board_id() elif chip_id == chips.RK3328: board_id = self._rock_pi_id() + elif chip_id == chips.RK3566: + board_id = self._rk3566_id() + elif chip_id == chips.RK3568: + board_id = self._rk3568_id() elif chip_id == chips.RK3588: board_id = self._rock_pi_id() elif chip_id == chips.RYZEN_V1605B: From 82bc85b106554238f95e3f06a459d988c5e0c5a8 Mon Sep 17 00:00:00 2001 From: monark Date: Sat, 19 Nov 2022 10:55:37 +0800 Subject: [PATCH 4/4] Fix format --- adafruit_platformdetect/chip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 866db83c..222104a1 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -217,7 +217,7 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("rockchip,rk3328"): return chips.RK3328 - + if self.detector.check_dt_compatible_value("rockchip,rk3566"): return chips.RK3566