From 9cf551506fa6a37e6710f48084bcbcb28dbff8a7 Mon Sep 17 00:00:00 2001 From: casainho Date: Sun, 7 Jan 2024 19:07:54 +0000 Subject: [PATCH 1/2] Added board MilkV Duo --- adafruit_platformdetect/board.py | 10 ++++++++++ adafruit_platformdetect/chip.py | 2 ++ adafruit_platformdetect/constants/boards.py | 5 +++++ adafruit_platformdetect/constants/chips.py | 3 +++ bin/detect.py | 1 + 5 files changed, 21 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 45ae820..55b9da6 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -203,6 +203,8 @@ def id(self) -> Optional[str]: board_id = self._armbian_id() elif chip_id == chips.S905X: board_id = boards.AML_S905X_CC + elif chip_id == chips.CV1800B: + board_id = boards.MILKV_DUO self._board_id = board_id return board_id @@ -418,6 +420,8 @@ def _armbian_id(self) -> Optional[str]: board = boards.PCDUINO3 elif board_value == "rock-3a": board = boards.ROCK_PI_3A + elif board_value == "milkv_duo": + board = boards.MILKV_DUO return board # pylint: enable=too-many-return-statements @@ -863,6 +867,11 @@ def any_onion_omega_board(self) -> bool: def any_pine64_board(self) -> bool: """Check whether the current board is any Pine64 device.""" return self.id in boards._PINE64_DEV_IDS + + @property + def any_milkv_board(self) -> bool: + """Check whether the current board is any MilkV device.""" + return self.id in boards._MILKV_IDS_ @property def any_rock_pi_board(self) -> bool: @@ -1002,6 +1011,7 @@ def lazily_generate_conditions(): yield self.any_nxp_navq_board yield self.any_walnutpi yield self.any_olimex_lime2_board + yield self.any_milkv_board return any(condition for condition in lazily_generate_conditions()) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 0dd33b1..deae5cd 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -355,6 +355,8 @@ def _linux_id(self) -> Optional[str]: linux_id = chips.H5 if compatible and "odroid-xu4" in compatible: linux_id = chips.EXYNOS5422 + if compatible and "cvitek,cv180x" in compatible: + linux_id = chips.CV1800B cpu_model = self.detector.get_cpuinfo_field("cpu model") if cpu_model is not None: diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 01b1b93..c3e5e3a 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -214,6 +214,9 @@ MAAXBOARD = "MAAXBOARD" MAAXBOARD_MINI = "MAAXBOARD_MINI" +# Shenzhen MilkV Technology boards ids +MILKV_DUO = "MILKV_DUO" + # Khadas VIM3 KHADAS_VIM3 = "KHADAS_VIM3" @@ -559,3 +562,5 @@ NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM" _NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,) + +_MILKV_IDS_ = (MILKV_DUO,) diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index a6f5c6f..07855d9 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -75,3 +75,6 @@ ATOM_J4105 = "ATOM_J4105" BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"} + +CV1800B = "CV1800B" + diff --git a/bin/detect.py b/bin/detect.py index bb8732a..4fa4faa 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -68,6 +68,7 @@ print("Is this a UDOO board?", detector.board.any_udoo_board) print("Is this an ASUS Tinker board?", detector.board.any_asus_tinker_board) print("Is this an STM32MP1 board?", detector.board.any_stm32mp1) +print("Is this a MilkV board?", detector.board.any_milkv_board) print("Is this a generic Linux PC?", detector.board.generic_linux) print( "Is this an OS environment variable special case?", detector.board.os_environ_board From 4d38ce8e41c3bdfb4b9ddba5bab2dbe9a5da6f90 Mon Sep 17 00:00:00 2001 From: casainho Date: Sun, 7 Jan 2024 21:07:38 +0000 Subject: [PATCH 2/2] Clean after using pre-commit --- adafruit_platformdetect/board.py | 2 +- adafruit_platformdetect/constants/chips.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 55b9da6..9056901 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -867,7 +867,7 @@ def any_onion_omega_board(self) -> bool: def any_pine64_board(self) -> bool: """Check whether the current board is any Pine64 device.""" return self.id in boards._PINE64_DEV_IDS - + @property def any_milkv_board(self) -> bool: """Check whether the current board is any MilkV device.""" diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 07855d9..990bf6a 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -77,4 +77,3 @@ BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"} CV1800B = "CV1800B" -