From b552676599d9bcaf76e7a794f9bb156ae06961f6 Mon Sep 17 00:00:00 2001 From: Hajime Fujimoto Date: Sun, 1 Dec 2024 22:10:35 +0900 Subject: [PATCH 1/2] Added support for D-Robotics RDK-X3 --- adafruit_platformdetect/board.py | 8 ++++++++ adafruit_platformdetect/chip.py | 3 +++ adafruit_platformdetect/constants/boards.py | 8 ++++++++ adafruit_platformdetect/constants/chips.py | 1 + 4 files changed, 20 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 745eca51..4acac9d4 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -228,6 +228,8 @@ def id(self) -> Optional[str]: board_id = self._rv1103_id() elif chip_id == chips.RV1106: board_id = self._rv1106_id() + elif chip_id == chips.SUNRISE_X3: + board_id = boards.RDK_X3 self._board_id = board_id return board_id @@ -1109,6 +1111,11 @@ def any_vivid_unit(self): """Check whether the current board is any Vivid Unit device.""" return self.id in boards._VIVID_UNIT_IDS + @property + def any_horizon_board(self): + """Check whether the current board is any Horizon device.""" + return self.id in boards._HORIZON_IDS + @property def os_environ_board(self) -> bool: """Check whether the current board is an OS environment variable special case.""" @@ -1180,6 +1187,7 @@ def lazily_generate_conditions(): yield self.any_luckfox_pico_board yield self.any_vivid_unit yield self.any_starfive_id + yield self.any_horizon_board return any(condition for condition in lazily_generate_conditions()) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 7401400d..faa47ed1 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -321,6 +321,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("light-lpi4a"): return chips.TH1520 + if self.detector.check_dt_compatible_value("hobot,x3"): + return chips.SUNRISE_X3 + linux_id = None hardware = self.detector.get_cpuinfo_field("Hardware") diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index e994e4d3..ec030ab8 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -251,6 +251,9 @@ # Ameridroid boards INDIEDROID_NOVA = "INDIEDROID_NOVA" +# Horizon +RDK_X3 = "RDK_X3" + # StarFive boards _STARFIVE_BOARD_IDS = (VISIONFIVE2,) # Asus Tinkerboard @@ -629,6 +632,11 @@ LUCKFOX_PICO_PLUS, ) +# Horizon +_HORIZON_IDS = ( + RDK_X3, +) + _AMERIDROID_IDS = (INDIEDROID_NOVA,) # Agnostic board diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 667079a0..7bbf19f9 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -81,6 +81,7 @@ ATOM_J4105 = "ATOM_J4105" TH1520 = "TH1520" K1 = "K1" +SUNRISE_X3 = "SUNRISE_X3" BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"} From 9ba3d32b987f161c1ce4d8c6d4d09af43c6c1d65 Mon Sep 17 00:00:00 2001 From: Hajime Fujimoto Date: Sun, 1 Dec 2024 22:51:08 +0900 Subject: [PATCH 2/2] Modify for black error --- adafruit_platformdetect/constants/boards.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index ec030ab8..12a46f40 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -633,9 +633,7 @@ ) # Horizon -_HORIZON_IDS = ( - RDK_X3, -) +_HORIZON_IDS = (RDK_X3,) _AMERIDROID_IDS = (INDIEDROID_NOVA,)