Skip to content

Add platform detection for the UDOO Bolt #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions adafruit_platformdetect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def get_armbian_release_field(self, field):
value, if found, otherwise None.
"""
field_value = None

pattern = r"^" + field + r"=(.*)"
try:
with open("/etc/armbian-release", "r") as release_file:
Expand All @@ -93,20 +94,41 @@ def get_device_model(self):
Search /proc/device-tree/model for the device model and return its value, if found,
otherwise None.
"""
model = None

try:
with open("/proc/device-tree/model", "r") as model_file:
model = model_file.read()
return model
except FileNotFoundError:
pass

return model

def get_device_compatible(self):
"""
Search /proc/device-tree/compatible for the compatible chip name.
"""
model = None

try:
with open("/proc/device-tree/compatible", "r") as model_file:
model = model_file.read()
return model
except FileNotFoundError:
pass

return model

def check_board_asset_tag_value(self):
"""
Search /proc/device-tree/model for the device model and return its value, if found,
otherwise None.
"""
tag = None

try:
with open("/sys/devices/virtual/dmi/id/board_asset_tag", "r") as tag_file:
tag = tag_file.read()
except FileNotFoundError:
pass

return tag
3 changes: 3 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def id(self):
board_id = self._clockwork_pi_id()
elif chip_id == chips.RK3308:
board_id = self._rock_pi_id()
elif chip_id == chips.RYZEN_V1605B:
board_id = boards.UDOO_BOLT

return board_id

# pylint: enable=invalid-name
Expand Down
8 changes: 7 additions & 1 deletion adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ def _linux_id(self):

if hardware is None:
vendor_id = self.detector.get_cpuinfo_field("vendor_id")
if vendor_id in ("GenuineIntel", "AuthenticAMD"):
if vendor_id == "AuthenticAMD":
model_name = self.detector.get_cpuinfo_field("model name").upper()
if "RYZEN EMBEDDED V1605B" in model_name:
linux_id = chips.RYZEN_V1605B
else:
linux_id = chips.GENERIC_X86
elif vendor_id == "GenuineIntel":
linux_id = chips.GENERIC_X86

compatible = self.detector.get_device_compatible()
Expand Down
2 changes: 2 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@

GREATFET_ONE = "GREATFET_ONE"

UDOO_BOLT = "UDOO_BOLT"

# pylint: enable=bad-whitespace

# OrangePI
Expand Down
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
IMX8MX = "IMX8MX"
BCM2XXX = "BCM2XXX"
ESP8266 = "ESP8266"
RYZEN_V1605B = "RYZEN_V1605B"
SAMD21 = "SAMD21"
STM32 = "STM32"
SUN8I = "SUN8I"
Expand Down