diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 10d0e095..81bf4406 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -161,6 +161,8 @@ def id(self) -> Optional[str]: board_id = boards.GENERIC_LINUX_PC elif chip_id == chips.TDA4VM: board_id = self._tisk_id() + elif chip_id == chips.D1_RISCV: + board_id = self._armbian_id() self._board_id = board_id return board_id @@ -328,6 +330,8 @@ def _armbian_id(self) -> Optional[str]: board = boards.NANOPI_DUO2 elif board_value == "nanopineo": board = boards.NANOPI_NEO + elif board_value == "nezha": + board = boards.LICHEE_RV return board @@ -658,6 +662,11 @@ def any_tisk_board(self) -> bool: """Check whether the current board is any defined TI SK Board.""" return self.id in [v[0] for v in boards._TI_SK_BOARD_IDS] + @property + def any_lichee_riscv_board(self) -> bool: + """Check whether the current board is any defined Lichee RISC-V.""" + return self.id in boards._LICHEE_RISCV_IDS + @property def any_embedded_linux(self) -> bool: """Check whether the current board is any embedded Linux device.""" @@ -687,6 +696,7 @@ def any_embedded_linux(self) -> bool: self.any_bananapi, self.any_maaxboard, self.any_tisk_board, + self.any_lichee_riscv_board, ] ) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index c46b4299..efcb30a7 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -240,6 +240,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("ti,j721e"): return chips.TDA4VM + if self.detector.check_dt_compatible_value("sun20i-d1"): + return chips.D1_RISCV + 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 f864f594..e548617e 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -127,6 +127,7 @@ SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED" ALLWINER_D1 = "ALLWINER_D1" +LICHEE_RV = "LICHEE_RV" MICROCHIP_MCP2221 = "MICROCHIP_MCP2221" @@ -516,3 +517,6 @@ # MaaXBoard boards _MAAXBOARD_IDS = ("MAAXBOARD", "MAAXBOARD_MINI") + +# Lichee RISC-V boards +_LICHEE_RISCV_IDS = (LICHEE_RV,) diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 296eb861..c55b0f63 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -57,6 +57,7 @@ MT8167 = "MT8167" ATOM_X5_Z8350 = "X5-Z8350" RP2040_U2IF = "RP2040_U2IF" +D1_RISCV = "D1_RISCV" BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}