Skip to content

Commit e16fed5

Browse files
author
geekguy-wy
authored
Merge pull request #1 from makermelissa/udoo_bolt
Updated Code for Udoo bolt ID - merging changes
2 parents 4c3b219 + 61c0859 commit e16fed5

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed

adafruit_platformdetect/board.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class Board:
5050

5151
def __init__(self, detector):
5252
self.detector = detector
53-
self.board_asset_tag = self.detector.check_board_asset_tag_value().strip()
5453

5554
# pylint: disable=invalid-name, protected-access
5655
@property
@@ -92,6 +91,8 @@ def id(self):
9291
board_id = boards.ODROID_C4
9392
elif chip_id == chips.S922X:
9493
board_id = boards.ODROID_N2
94+
elif chip_id == chips.EXYNOS5422:
95+
board_id = boards.ODROID_XU4
9596
elif chip_id == chips.FT232H:
9697
board_id = boards.FTDI_FT232H
9798
elif chip_id == chips.APQ8016:
@@ -118,8 +119,8 @@ def id(self):
118119
board_id = self._clockwork_pi_id()
119120
elif chip_id == chips.RK3308:
120121
board_id = self._rock_pi_id()
121-
elif self.board_asset_tag == boards._UDOO_BOLT_BOARD_ASSET_TAG:
122-
board_id = boards.UDOO_BOLT
122+
elif chip_id == chips.RYZEN_V1605B:
123+
board_id = self._udoo_id()
123124

124125
return board_id
125126

@@ -315,6 +316,14 @@ def _clockwork_pi_id(self):
315316
board = boards.CLOCKWORK_CPI3
316317
return board
317318

319+
def _udoo_id(self):
320+
"""Try to detect the id of udoo board."""
321+
board_asset_tag = self.detector.check_board_asset_tag_value()
322+
for board_id, board_tags in boards._UDOO_BOARD_IDS.items():
323+
if any(v == board_asset_tag for v in board_tags):
324+
return board_id
325+
return None
326+
318327
@property
319328
def any_96boards(self):
320329
"""Check whether the current board is any 96boards board."""

adafruit_platformdetect/chip.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def _linux_id(self):
170170
return chips.S905X3
171171
if compatible and "sun50i-a64" in compatible:
172172
linux_id = chips.A64
173+
if compatible and "odroid-xu4" in compatible:
174+
linux_id = chips.EXYNOS5422
173175

174176
cpu_model = self.detector.get_cpuinfo_field("cpu model")
175177

@@ -200,6 +202,8 @@ def _linux_id(self):
200202
linux_id = chips.S922X
201203
elif "ODROID-C4" in hardware:
202204
linux_id = chips.S905X3
205+
elif "ODROID-XU4" in hardware:
206+
linux_id = chips.EXYNOS5422
203207
elif "SAMA5" in hardware:
204208
linux_id = chips.SAMA5
205209
elif "Pinebook" in hardware:

adafruit_platformdetect/constants/boards.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
ODROID_C2 = "ODROID_C2"
7575
ODROID_C4 = "ODROID_C4"
7676
ODROID_N2 = "ODROID_N2"
77+
ODROID_XU4 = "ODROID_XU4"
7778

7879
FTDI_FT232H = "FTDI_FT232H"
7980
DRAGONBOARD_410C = "DRAGONBOARD_410C"
@@ -94,6 +95,7 @@
9495
ROCK_PI_S = "ROCK_PI_S"
9596

9697
GREATFET_ONE = "GREATFET_ONE"
98+
UDOO_BOLT = "UDOO_BOLT"
9799

98100
# pylint: enable=bad-whitespace
99101

@@ -151,7 +153,14 @@
151153

152154
_RASPBERRY_PI_CM_IDS = (RASPBERRY_PI_CM1, RASPBERRY_PI_CM3, RASPBERRY_PI_CM3_PLUS)
153155

154-
_ODROID_40_PIN_IDS = (ODROID_C1, ODROID_C1_PLUS, ODROID_C2, ODROID_C4, ODROID_N2)
156+
_ODROID_40_PIN_IDS = (
157+
ODROID_C1,
158+
ODROID_C1_PLUS,
159+
ODROID_C2,
160+
ODROID_C4,
161+
ODROID_N2,
162+
ODROID_XU4,
163+
)
155164

156165
_BEAGLEBONE_IDS = (
157166
BEAGLEBONE,
@@ -335,11 +344,5 @@
335344
# Pine64 boards and devices
336345
_PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE)
337346

338-
UDOO_BOLT = "UDOO_BOLT"
339-
_UDOO_BOLT_BOARD_ASSET_TAG = "SC40-2000-0000-C0|C"
340-
341347
# UDOO
342-
_UDOO_BOARD_IDS = (
343-
UDOO_BOLT,
344-
_UDOO_BOLT_BOARD_ASSET_TAG,
345-
)
348+
_UDOO_BOARD_IDS = {UDOO_BOLT: ("SC40-2000-0000-C0|C",)}

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
IMX8MX = "IMX8MX"
44
BCM2XXX = "BCM2XXX"
55
ESP8266 = "ESP8266"
6+
EXYNOS5422 = "EXYNOS5422"
67
RYZEN_V1605B = "RYZEN_V1605B"
78
SAMD21 = "SAMD21"
89
STM32 = "STM32"

0 commit comments

Comments
 (0)