Skip to content

Commit a7da497

Browse files
authored
Merge pull request #80 from geekguy-wy/add_udoo_bolt_detect
Add platform detection for the UDOO Bolt
2 parents 0415b1c + 8285f64 commit a7da497

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

adafruit_platformdetect/__init__.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def get_armbian_release_field(self, field):
7575
value, if found, otherwise None.
7676
"""
7777
field_value = None
78+
7879
pattern = r"^" + field + r"=(.*)"
7980
try:
8081
with open("/etc/armbian-release", "r") as release_file:
@@ -93,20 +94,41 @@ def get_device_model(self):
9394
Search /proc/device-tree/model for the device model and return its value, if found,
9495
otherwise None.
9596
"""
97+
model = None
98+
9699
try:
97100
with open("/proc/device-tree/model", "r") as model_file:
98101
model = model_file.read()
99-
return model
100102
except FileNotFoundError:
101103
pass
102104

105+
return model
106+
103107
def get_device_compatible(self):
104108
"""
105109
Search /proc/device-tree/compatible for the compatible chip name.
106110
"""
111+
model = None
112+
107113
try:
108114
with open("/proc/device-tree/compatible", "r") as model_file:
109115
model = model_file.read()
110-
return model
111116
except FileNotFoundError:
112117
pass
118+
119+
return model
120+
121+
def check_board_asset_tag_value(self):
122+
"""
123+
Search /proc/device-tree/model for the device model and return its value, if found,
124+
otherwise None.
125+
"""
126+
tag = None
127+
128+
try:
129+
with open("/sys/devices/virtual/dmi/id/board_asset_tag", "r") as tag_file:
130+
tag = tag_file.read()
131+
except FileNotFoundError:
132+
pass
133+
134+
return tag

adafruit_platformdetect/board.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ def id(self):
117117
board_id = self._clockwork_pi_id()
118118
elif chip_id == chips.RK3308:
119119
board_id = self._rock_pi_id()
120+
elif chip_id == chips.RYZEN_V1605B:
121+
board_id = boards.UDOO_BOLT
122+
120123
return board_id
121124

122125
# pylint: enable=invalid-name

adafruit_platformdetect/chip.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,13 @@ def _linux_id(self):
135135

136136
if hardware is None:
137137
vendor_id = self.detector.get_cpuinfo_field("vendor_id")
138-
if vendor_id in ("GenuineIntel", "AuthenticAMD"):
138+
if vendor_id == "AuthenticAMD":
139+
model_name = self.detector.get_cpuinfo_field("model name").upper()
140+
if "RYZEN EMBEDDED V1605B" in model_name:
141+
linux_id = chips.RYZEN_V1605B
142+
else:
143+
linux_id = chips.GENERIC_X86
144+
elif vendor_id == "GenuineIntel":
139145
linux_id = chips.GENERIC_X86
140146

141147
compatible = self.detector.get_device_compatible()

adafruit_platformdetect/constants/boards.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595

9696
GREATFET_ONE = "GREATFET_ONE"
9797

98+
UDOO_BOLT = "UDOO_BOLT"
99+
98100
# pylint: enable=bad-whitespace
99101

100102
# OrangePI

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+
RYZEN_V1605B = "RYZEN_V1605B"
67
SAMD21 = "SAMD21"
78
STM32 = "STM32"
89
SUN8I = "SUN8I"

0 commit comments

Comments
 (0)