diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 792fd128..b528e3ef 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -50,7 +50,6 @@ class Board: def __init__(self, detector): self.detector = detector - self.board_asset_tag = self.detector.check_board_asset_tag_value().strip() # pylint: disable=invalid-name, protected-access @property @@ -92,6 +91,8 @@ def id(self): board_id = boards.ODROID_C4 elif chip_id == chips.S922X: board_id = boards.ODROID_N2 + elif chip_id == chips.EXYNOS5422: + board_id = boards.ODROID_XU4 elif chip_id == chips.FT232H: board_id = boards.FTDI_FT232H elif chip_id == chips.APQ8016: @@ -118,8 +119,8 @@ def id(self): board_id = self._clockwork_pi_id() elif chip_id == chips.RK3308: board_id = self._rock_pi_id() - elif self.board_asset_tag == boards._UDOO_BOLT_BOARD_ASSET_TAG: - board_id = boards.UDOO_BOLT + elif chip_id == chips.RYZEN_V1605B: + board_id = self._udoo_id() return board_id @@ -315,6 +316,14 @@ def _clockwork_pi_id(self): board = boards.CLOCKWORK_CPI3 return board + def _udoo_id(self): + """Try to detect the id of udoo board.""" + board_asset_tag = self.detector.check_board_asset_tag_value() + for board_id, board_tags in boards._UDOO_BOARD_IDS.items(): + if any(v == board_asset_tag for v in board_tags): + return board_id + return None + @property def any_96boards(self): """Check whether the current board is any 96boards board.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 485629ba..1bf9ea97 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -170,6 +170,8 @@ def _linux_id(self): return chips.S905X3 if compatible and "sun50i-a64" in compatible: linux_id = chips.A64 + if compatible and "odroid-xu4" in compatible: + linux_id = chips.EXYNOS5422 cpu_model = self.detector.get_cpuinfo_field("cpu model") @@ -200,6 +202,8 @@ def _linux_id(self): linux_id = chips.S922X elif "ODROID-C4" in hardware: linux_id = chips.S905X3 + elif "ODROID-XU4" in hardware: + linux_id = chips.EXYNOS5422 elif "SAMA5" in hardware: linux_id = chips.SAMA5 elif "Pinebook" in hardware: diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 8c6a0126..33e7bb7e 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -74,6 +74,7 @@ ODROID_C2 = "ODROID_C2" ODROID_C4 = "ODROID_C4" ODROID_N2 = "ODROID_N2" +ODROID_XU4 = "ODROID_XU4" FTDI_FT232H = "FTDI_FT232H" DRAGONBOARD_410C = "DRAGONBOARD_410C" @@ -94,6 +95,7 @@ ROCK_PI_S = "ROCK_PI_S" GREATFET_ONE = "GREATFET_ONE" +UDOO_BOLT = "UDOO_BOLT" # pylint: enable=bad-whitespace @@ -151,7 +153,14 @@ _RASPBERRY_PI_CM_IDS = (RASPBERRY_PI_CM1, RASPBERRY_PI_CM3, RASPBERRY_PI_CM3_PLUS) -_ODROID_40_PIN_IDS = (ODROID_C1, ODROID_C1_PLUS, ODROID_C2, ODROID_C4, ODROID_N2) +_ODROID_40_PIN_IDS = ( + ODROID_C1, + ODROID_C1_PLUS, + ODROID_C2, + ODROID_C4, + ODROID_N2, + ODROID_XU4, +) _BEAGLEBONE_IDS = ( BEAGLEBONE, @@ -335,11 +344,5 @@ # Pine64 boards and devices _PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) -UDOO_BOLT = "UDOO_BOLT" -_UDOO_BOLT_BOARD_ASSET_TAG = "SC40-2000-0000-C0|C" - # UDOO -_UDOO_BOARD_IDS = ( - UDOO_BOLT, - _UDOO_BOLT_BOARD_ASSET_TAG, -) +_UDOO_BOARD_IDS = {UDOO_BOLT: ("SC40-2000-0000-C0|C",)} diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 59fdc7be..fa96cd15 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -3,6 +3,7 @@ IMX8MX = "IMX8MX" BCM2XXX = "BCM2XXX" ESP8266 = "ESP8266" +EXYNOS5422 = "EXYNOS5422" RYZEN_V1605B = "RYZEN_V1605B" SAMD21 = "SAMD21" STM32 = "STM32"