Skip to content

Commit 385c5a2

Browse files
committed
Refactor how I added the NXP i.MX8M Plus so it won't conflict definitions when I add it into Blinka
Changes to be committed: modified: adafruit_platformdetect/board.py modified: adafruit_platformdetect/chip.py modified: adafruit_platformdetect/constants/chips.py
1 parent 9fded76 commit 385c5a2

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

adafruit_platformdetect/board.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def id(self) -> Optional[str]:
8181
board_id = self._sama5_id()
8282
elif chip_id == chips.IMX8MX:
8383
board_id = self._imx8mx_id()
84+
elif chip_id == chips.IMX8MP:
85+
board_id = self._imx8mp_id()
8486
elif chip_id == chips.IMX6ULL:
8587
board_id = self._imx6ull_id()
8688
elif chip_id == chips.S905Y2:
@@ -418,7 +420,12 @@ def _imx8mx_id(self) -> Optional[str]:
418420
return boards.MAAXBOARD
419421
if "Phanbell" in board_value:
420422
return boards.CORAL_EDGE_TPU_DEV
421-
if "NXP i.MX8MPlus SOM " in board_value:
423+
return None
424+
425+
def _imx8mp_id(self) -> Optional[str]:
426+
"""Check what type iMX8M board."""
427+
board_value = self.detector.get_device_model()
428+
if "NXP i.MX8MPlus SOM" in board_value:
422429
return boards.NXP_IMX8MPLUS_SOM
423430
return None
424431

adafruit_platformdetect/chip.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ def _linux_id(self) -> Optional[str]:
311311
elif "nvidia,tegra234" in compats:
312312
linux_id = chips.T234
313313
if compatible and "imx8m" in compatible:
314-
linux_id = chips.IMX8MX
314+
compats = compatible.split("\x00")
315+
if "imx8mp" in compats:
316+
linux_id = chips.IMX8MP
317+
else:
318+
linux_id = chips.IMX8MX
315319
if compatible and "odroid-c2" in compatible:
316320
linux_id = chips.S905
317321
if compatible and "amlogic" in compatible:

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
TDA4VM = "TDA4VM"
1111
IMX6ULL = "IMX6ULL"
1212
IMX8MX = "IMX8MX"
13+
IMX8MP = "IMX8MP"
1314
BCM2XXX = "BCM2XXX"
1415
ESP8266 = "ESP8266"
1516
EXYNOS5422 = "EXYNOS5422"

0 commit comments

Comments
 (0)