Skip to content

Commit 1b43d2a

Browse files
authored
Merge pull request #84 from BlitzCityDIY/master
Adding Tinker Board detection
2 parents 6b0847d + 2412435 commit 1b43d2a

File tree

8 files changed

+34
-0
lines changed

8 files changed

+34
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ def id(self):
119119
board_id = self._clockwork_pi_id()
120120
elif chip_id == chips.RK3308:
121121
board_id = self._rock_pi_id()
122+
elif chip_id == chips.RK3288:
123+
board_id = self._asus_tinker_board_id()
122124
elif chip_id == chips.RYZEN_V1605B:
123125
board_id = self._udoo_id()
124126

@@ -324,6 +326,14 @@ def _udoo_id(self):
324326
return board_id
325327
return None
326328

329+
def _asus_tinker_board_id(self):
330+
"""Check what type of Tinker Board."""
331+
board_value = self.detector.get_device_model()
332+
board = None
333+
if board_value and "ASUS Tinker Board" in board_value:
334+
board = boards._ASUS_TINKER_BOARD_IDS
335+
return board
336+
327337
@property
328338
def any_96boards(self):
329339
"""Check whether the current board is any 96boards board."""
@@ -409,6 +419,10 @@ def any_udoo_board(self):
409419
"""Check to see if the current board is an UDOO board"""
410420
return self.id in boards._UDOO_BOARD_IDS
411421

422+
def any_asus_tinker_board(self):
423+
"""Check to see if the current board is an ASUS Tinker Board"""
424+
return self.id in boards._ASUS_TINKER_BOARD_IDS
425+
412426
@property
413427
def any_embedded_linux(self):
414428
"""Check whether the current board is any embedded Linux device."""
@@ -429,6 +443,7 @@ def any_embedded_linux(self):
429443
self.any_rock_pi_board,
430444
self.any_clockwork_pi_board,
431445
self.any_udoo_board,
446+
self.any_asus_tinker_board,
432447
]
433448
)
434449

adafruit_platformdetect/chip.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ def _linux_id(self):
130130
if self.detector.check_dt_compatible_value("rockchip,rk3308"):
131131
return chips.RK3308
132132

133+
if self.detector.check_dt_compatible_value("rockchip,rk3288"):
134+
return chips.RK3288
135+
133136
linux_id = None
134137
hardware = self.detector.get_cpuinfo_field("Hardware")
135138

@@ -212,6 +215,8 @@ def _linux_id(self):
212215
linux_id = chips.A64
213216
elif "sun50iw1p1" in hardware:
214217
linux_id = chips.A64
218+
elif "ASUS_TINKER_BOARD" in hardware:
219+
linux_id = chips.RK3288
215220
elif "Xilinx Zynq" in hardware:
216221
compatible = self.detector.get_device_compatible()
217222
if compatible and "xlnx,zynq-7000" in compatible:

adafruit_platformdetect/constants/boards.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
PYBOARD = "PYBOARD"
2424
NODEMCU = "NODEMCU"
2525
GIANT_BOARD = "GIANT_BOARD"
26+
_ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD"
27+
28+
# ASUS Tinker Boards
29+
ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD"
2630

2731
# Clockwork Pi boards
2832
CLOCKWORK_CPI3 = "CLOCKWORK_CPI3"
@@ -100,6 +104,8 @@
100104

101105
# pylint: enable=bad-whitespace
102106

107+
_ASUS_TINKER_BOARD_IDS = ASUS_TINKER_BOARD
108+
103109
# OrangePI
104110
_ORANGE_PI_IDS = (
105111
ORANGE_PI_PC,
@@ -350,5 +356,8 @@
350356
# Pine64 boards and devices
351357
_PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE)
352358

359+
# ASUS Tinker Board
360+
_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD
361+
353362
# UDOO
354363
_UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)}

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
A33 = "A33"
3131
RK3308 = "RK3308"
3232
LPC4330 = "LPC4330"
33+
RK3288 = "RK3288"
3334

3435
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}

bin/detect.py

100755100644
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
2525
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
2626
print("Is this a UDOO Bolt?", detector.board.UDOO_BOLT)
27+
print("Is this an ASUS Tinker Board?", detector.board.ASUS_TINKER_BOARD)
2728
print(
2829
"Is this an OS environment variable special case?",
2930
detector.board.FTDI_FT232H
@@ -58,3 +59,6 @@
5859

5960
if detector.board.any_clockwork_pi:
6061
print("Clockwork Pi device detected.")
62+
63+
if detector.board.any_asus_tinker_board:
64+
print("ASUS Tinker Board device detected.")

docs/conf.py

100755100644
File mode changed.

requirements.txt

100755100644
File mode changed.

setup.py

100755100644
File mode changed.

0 commit comments

Comments
 (0)