Skip to content

Adding Tinker Board detection #84

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 11 commits into from
Jun 26, 2020
15 changes: 15 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def id(self):
board_id = self._clockwork_pi_id()
elif chip_id == chips.RK3308:
board_id = self._rock_pi_id()
elif chip_id == chips.RK3288:
board_id = self._asus_tinker_board_id()
elif chip_id == chips.RYZEN_V1605B:
board_id = self._udoo_id()

Expand Down Expand Up @@ -324,6 +326,14 @@ def _udoo_id(self):
return board_id
return None

def _asus_tinker_board_id(self):
"""Check what type of Tinker Board."""
board_value = self.detector.get_device_model()
board = None
if board_value and "ASUS Tinker Board" in board_value:
board = boards._ASUS_TINKER_BOARD_IDS
return board

@property
def any_96boards(self):
"""Check whether the current board is any 96boards board."""
Expand Down Expand Up @@ -409,6 +419,10 @@ def any_udoo_board(self):
"""Check to see if the current board is an UDOO board"""
return self.id in boards._UDOO_BOARD_IDS

def any_asus_tinker_board(self):
"""Check to see if the current board is an ASUS Tinker Board"""
return self.id in boards._ASUS_TINKER_BOARD_IDS

@property
def any_embedded_linux(self):
"""Check whether the current board is any embedded Linux device."""
Expand All @@ -429,6 +443,7 @@ def any_embedded_linux(self):
self.any_rock_pi_board,
self.any_clockwork_pi_board,
self.any_udoo_board,
self.any_asus_tinker_board,
]
)

Expand Down
5 changes: 5 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ def _linux_id(self):
if self.detector.check_dt_compatible_value("rockchip,rk3308"):
return chips.RK3308

if self.detector.check_dt_compatible_value("rockchip,rk3288"):
return chips.RK3288

linux_id = None
hardware = self.detector.get_cpuinfo_field("Hardware")

Expand Down Expand Up @@ -212,6 +215,8 @@ def _linux_id(self):
linux_id = chips.A64
elif "sun50iw1p1" in hardware:
linux_id = chips.A64
elif "ASUS_TINKER_BOARD" in hardware:
linux_id = chips.RK3288
elif "Xilinx Zynq" in hardware:
compatible = self.detector.get_device_compatible()
if compatible and "xlnx,zynq-7000" in compatible:
Expand Down
9 changes: 9 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
PYBOARD = "PYBOARD"
NODEMCU = "NODEMCU"
GIANT_BOARD = "GIANT_BOARD"
_ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD"

# ASUS Tinker Boards
ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD"

# Clockwork Pi boards
CLOCKWORK_CPI3 = "CLOCKWORK_CPI3"
Expand Down Expand Up @@ -100,6 +104,8 @@

# pylint: enable=bad-whitespace

_ASUS_TINKER_BOARD_IDS = ASUS_TINKER_BOARD

# OrangePI
_ORANGE_PI_IDS = (
ORANGE_PI_PC,
Expand Down Expand Up @@ -350,5 +356,8 @@
# Pine64 boards and devices
_PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE)

# ASUS Tinker Board
_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD

# UDOO
_UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)}
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
A33 = "A33"
RK3308 = "RK3308"
LPC4330 = "LPC4330"
RK3288 = "RK3288"

BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}
4 changes: 4 additions & 0 deletions bin/detect.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
print("Is this a UDOO Bolt?", detector.board.UDOO_BOLT)
print("Is this an ASUS Tinker Board?", detector.board.ASUS_TINKER_BOARD)
print(
"Is this an OS environment variable special case?",
detector.board.FTDI_FT232H
Expand Down Expand Up @@ -58,3 +59,6 @@

if detector.board.any_clockwork_pi:
print("Clockwork Pi device detected.")

if detector.board.any_asus_tinker_board:
print("ASUS Tinker Board device detected.")
Empty file modified docs/conf.py
100755 → 100644
Empty file.
Empty file modified requirements.txt
100755 → 100644
Empty file.
Empty file modified setup.py
100755 → 100644
Empty file.