diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 31f2dd9e..1b35cacc 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -30,7 +30,6 @@ from adafruit_platformdetect.constants import boards, chips - __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git" @@ -63,6 +62,8 @@ def id(self) -> Optional[str]: if chip_id == chips.H3: board_id = self._armbian_id() or self._allwinner_variants_id() + elif chip_id == chips.JH7110: + board_id = self._starfive_id() elif chip_id == chips.BCM2XXX: board_id = self._pi_id() elif chip_id == chips.OS_AGNOSTIC: @@ -226,6 +227,12 @@ def id(self) -> Optional[str]: return board_id # pylint: enable=invalid-name + def _starfive_id(self) -> Optional[str]: + model = None + model_value = self.detector.get_device_model() + if "VisionFive" in model_value and "V2" in model_value: + model = boards.VISIONFIVE2 + return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 99588235..7bcc8b0c 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -19,7 +19,6 @@ """ - import os import sys @@ -30,7 +29,6 @@ from adafruit_platformdetect.constants import chips - __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git" @@ -224,6 +222,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("jh7100"): return chips.JH71X0 + if self.detector.check_dt_compatible_value("jh7110"): + return chips.JH7110 + if self.detector.check_dt_compatible_value("sun8i-a33"): return chips.A33 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 23daaa2b..0be9a3b3 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -4,6 +4,7 @@ """Definition of boards and/or ids""" # Allow for aligned constant definitions: +VISIONFIVE2 = "VISIONFIVE2" BEAGLE_PLAY = "BEAGLE_PLAY" BEAGLEBONE_AI64 = "BEAGLEBONE_AI64" BEAGLEBONE = "BEAGLEBONE" @@ -73,7 +74,6 @@ NANOPI_NEO = "NANOPI_NEO" NANOPI_NEO_2 = "NANOPI_NEO_2" - # Banana Pi boards BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO" BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS" @@ -243,6 +243,8 @@ LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI" LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS" +# StarFive boards +_STARFIVE_BOARD_IDS = (VISIONFIVE2,) # Asus Tinkerboard _ASUS_TINKER_BOARD_IDS = ( ASUS_TINKER_BOARD, diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index fee42603..32107247 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -41,6 +41,7 @@ HFU540 = "HFU540" C906 = "C906" JH71X0 = "JH71X0" +JH7110 = "JH7110" MCP2221 = "MCP2221" BINHO = "BINHO" MIPS24KC = "MIPS24KC"