diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 5df172ff..f36b8f50 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -156,10 +156,14 @@ def id(self) -> Optional[str]: or self._allwinner_variants_id() or self._repka_variants_id() ) + elif chip_id == chips.H618: + board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.H616: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.A33: board_id = self._clockwork_pi_id() + elif chip_id == chips.K1: + board_id = self._armbian_id() or self._spacemit_variants_id() elif chip_id == chips.RK3308: board_id = self._rock_pi_id() elif chip_id == chips.RK3399: @@ -431,8 +435,14 @@ def _armbian_id(self) -> Optional[str]: board = boards.BANANA_PI_M2_PLUS elif board_value == "bananapim2berry": board = boards.BANANA_PI_M2_BERRY + elif board_value == "bananapim4berry": + board = boards.BANANA_PI_M4_BERRY + elif board_value == "bananapim4zero": + board = boards.BANANA_PI_M4_ZERO elif board_value == "bananapim5": board = boards.BANANA_PI_M5 + elif board_value == "bananapif3": + board = boards.BANANA_PI_F3 elif board_value == "orangepizeroplus2-h5": board = boards.ORANGE_PI_ZERO_PLUS_2H5 elif board_value == "orangepizeroplus": @@ -755,8 +765,13 @@ def _allwinner_variants_id(self) -> Optional[str]: if "banana pro" in board_value: board = boards.LEMAKER_BANANA_PRO - if "banana pi m2 berry" in board_value: - board = boards.BANANA_PI_M2_BERRY + if any(x in board_value for x in ("banana pi", "bananapi")): + if "m2 berry" in board_value: + board = boards.BANANA_PI_M2_BERRY + elif "m4berry" in board_value or "m4 berry" in board_value: + board = boards.BANANA_PI_M4_BERRY + elif "m4zero" in board_value or "m4 zero" in board_value: + board = boards.BANANA_PI_M4_ZERO if "nanopi" in board_value: if "neo" in board_value and "SUN8I" in chip_id: @@ -779,6 +794,24 @@ def _allwinner_variants_id(self) -> Optional[str]: board = boards.OLIMEX_LIME2 return board + def _spacemit_variants_id(self) -> Optional[str]: + """Try to detect the id of spacemit based board. (bananapi)""" + board_value = self.detector.get_device_model() + board = None + if not board_value: + return board + board_value = board_value.lower() + + if any(x in board_value for x in ("banana pi", "bananapi")): + if "bpi-f3" in board_value: + board = boards.BANANA_PI_F3 + + if "spacemit" in board_value: + if "deb1" in board_value: + board = boards.BANANA_PI_F3 + + return board + def _repka_variants_id(self) -> Optional[str]: board_value = self.detector.get_device_model() board = None diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 8728dd84..7401400d 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -285,6 +285,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("sun50i-h5"): return chips.H5 + if self.detector.check_dt_compatible_value("sun50i-h618"): + return chips.H618 + if self.detector.check_dt_compatible_value("sun50i-h616"): return chips.H616 @@ -294,6 +297,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("sun50i-h6"): return chips.H6 + if self.detector.check_dt_compatible_value("spacemit,k1-x"): + return chips.K1 + if self.detector.check_dt_compatible_value("mediatek,mt8167"): return chips.MT8167 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 47c0efbd..adcd31f3 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -78,7 +78,10 @@ BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO" BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS" BANANA_PI_M2_BERRY = "BANANA_PI_M2_BERRY" +BANANA_PI_M4_BERRY = "BANANA_PI_M4_BERRY" +BANANA_PI_M4_ZERO = "BANANA_PI_M4_ZERO" BANANA_PI_M5 = "BANANA_PI_M5" +BANANA_PI_F3 = "BANANA_PI_F3" # LeMaker boards LEMAKER_BANANA_PRO = "LEMAKER_BANANA_PRO" @@ -305,7 +308,10 @@ BANANA_PI_M2_ZERO, BANANA_PI_M2_PLUS, BANANA_PI_M2_BERRY, + BANANA_PI_M4_BERRY, + BANANA_PI_M4_ZERO, BANANA_PI_M5, + BANANA_PI_F3, ) # LeMaker diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 32107247..667079a0 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -55,6 +55,7 @@ H5 = "H5" H3 = "H3" H616 = "H616" +H618 = "H618" RK3308 = "RK3308" RK3399 = "RK3399" RK3399_T = "RK3399_T" @@ -79,6 +80,7 @@ D1_RISCV = "D1_RISCV" ATOM_J4105 = "ATOM_J4105" TH1520 = "TH1520" +K1 = "K1" BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"} diff --git a/bin/detect.py b/bin/detect.py index d33a1f16..e234659c 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -75,6 +75,9 @@ "Is this an OS environment variable special case?", detector.board.os_environ_board ) +if detector.board.any_bananapi: + print("Bananapi board detected.") + if detector.board.any_jetson_board: print("Jetson platform detected.")