diff --git a/adafruit_platformdetect/__init__.py b/adafruit_platformdetect/__init__.py index ddfdf803..29a81d1f 100644 --- a/adafruit_platformdetect/__init__.py +++ b/adafruit_platformdetect/__init__.py @@ -21,6 +21,7 @@ if sys.platform == "darwin": os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib/" + # Various methods here may retain state in future, so tell pylint not to worry # that they don't use self right now: # pylint: disable=no-self-use diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index a16a3005..892cbb1c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -81,6 +81,8 @@ def id(self) -> Optional[str]: board_id = self._sama5_id() elif chip_id == chips.IMX8MX: board_id = self._imx8mx_id() + elif chip_id == chips.IMX8MP: + board_id = self._imx8mp_id() elif chip_id == chips.IMX6ULL: board_id = self._imx6ull_id() elif chip_id == chips.S905Y2: @@ -420,6 +422,13 @@ def _imx8mx_id(self) -> Optional[str]: return boards.CORAL_EDGE_TPU_DEV return None + def _imx8mp_id(self) -> Optional[str]: + """Check what type iMX8M board.""" + board_value = self.detector.get_device_model() + if "NXP i.MX8MPlus SOM" in board_value: + return boards.NXP_IMX8MPLUS_SOM + return None + def _imx6ull_id(self) -> Optional[str]: """Check what type iMX6ULL board.""" board_value = self.detector.get_device_model() @@ -797,6 +806,11 @@ def any_libre_computer_board(self) -> bool: """Check whether the current board is any defined Libre Computer board.""" return self.id in boards._LIBRE_COMPUTER_IDS + @property + def any_nxp_navq_board(self) -> bool: + """Check whether the current board is any NXP NavQ board""" + return self.id in boards._NXP_SOM_IDS + @property def os_environ_board(self) -> bool: """Check whether the current board is an OS environment variable special case.""" @@ -851,6 +865,7 @@ def lazily_generate_conditions(): yield self.any_pcduino_board yield self.any_libre_computer_board yield self.generic_linux + yield self.any_nxp_navq_board return any(condition for condition in lazily_generate_conditions()) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index eeea25e2..e3a5427c 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -269,6 +269,9 @@ def _linux_id(self) -> Optional[str]: if self.detector.check_dt_compatible_value("sun20i-d1"): return chips.D1_RISCV + if self.detector.check_dt_compatible_value("imx8mp"): + return chips.IMX8MP + if self.detector.check_dt_compatible_value("libretech,aml-s905x-cc"): return chips.S905X diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index ea1211d6..69494662 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -585,3 +585,8 @@ AML_S905X_CC, ROC_RK3328_CC, ) + +# NXP System on Module Computer boards +NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM" + +_NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,) diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 4dc2b9a8..2aa2b70d 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -10,6 +10,7 @@ TDA4VM = "TDA4VM" IMX6ULL = "IMX6ULL" IMX8MX = "IMX8MX" +IMX8MP = "IMX8MP" BCM2XXX = "BCM2XXX" ESP8266 = "ESP8266" EXYNOS5422 = "EXYNOS5422" diff --git a/bin/detect.py b/bin/detect.py index 1723b892..86494bd2 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -111,3 +111,6 @@ if detector.board.any_siemens_simatic_iot2000: print("Siemens Simatic IOT2000 Gateway detected.") + +if detector.board.any_nxp_navq_board: + print("NXP NavQ board detected.")