From 98cdaa4bbae0182ba3dd06bca7c1b8c10c58472f Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 29 May 2020 13:00:37 -0400 Subject: [PATCH 1/9] Adding Tinker Board detection Adding detection for the ASUS Tinker Board SBC. SoC: Rockchip 3288 (RK3288) --- adafruit_platformdetect/board.py | 2 ++ adafruit_platformdetect/chip.py | 5 +++++ adafruit_platformdetect/constants/boards.py | 7 +++++++ adafruit_platformdetect/constants/chips.py | 1 + bin/detect.py | 1 + docs/conf.py | 0 requirements.txt | 0 setup.py | 0 8 files changed, 16 insertions(+) mode change 100755 => 100644 bin/detect.py mode change 100755 => 100644 docs/conf.py mode change 100755 => 100644 requirements.txt mode change 100755 => 100644 setup.py diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index b528e3ef..6cde2cac 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -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 = boards.ASUS_TINKER_BOARD elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index dc416c38..0aaa9688 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -129,6 +129,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") @@ -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: diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 98eb8329..b13b8524 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -98,6 +98,8 @@ UDOO_BOLT_V3 = "UDOO_BOLT_V3" UDOO_BOLT_V8 = "UDOO_BOLT_V8" +ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" + # pylint: enable=bad-whitespace # OrangePI @@ -345,5 +347,10 @@ # 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",)} diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 0fe1cedb..27b46f4b 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -30,5 +30,6 @@ A33 = "A33" RK3308 = "RK3308" LPC4330 = "LPC4330" +RK3288 = "RK3288" BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"} diff --git a/bin/detect.py b/bin/detect.py old mode 100755 new mode 100644 index ff609f9b..1b0ea918 --- a/bin/detect.py +++ b/bin/detect.py @@ -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 diff --git a/docs/conf.py b/docs/conf.py old mode 100755 new mode 100644 diff --git a/requirements.txt b/requirements.txt old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py old mode 100755 new mode 100644 From f6cf2cd76748d08486a06d0ddbd871d5e6d6353c Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 29 May 2020 13:57:16 -0400 Subject: [PATCH 2/9] Updating board.py adding any_asus_tinker_board for embedded linux system identification --- adafruit_platformdetect/board.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 6cde2cac..cd8d4029 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -326,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 + return board + @property def any_96boards(self): """Check whether the current board is any 96boards board.""" @@ -411,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 + @property def any_embedded_linux(self): """Check whether the current board is any embedded Linux device.""" @@ -431,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, ] ) From 07e8625558dd59f76aa1d1df865f7a73f87b81e3 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 29 May 2020 14:38:13 -0400 Subject: [PATCH 3/9] Black formatting updating chip.py and boards.py to be Black formatted --- adafruit_platformdetect/chip.py | 2 +- adafruit_platformdetect/constants/boards.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 0aaa9688..f5147a40 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -129,7 +129,7 @@ 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 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index b13b8524..aebd11d0 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -348,9 +348,7 @@ _PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) # ASUS Tinker Board -_ASUS_TINKER_BOARD_DEV_IDS = ( -ASUS_TINKER_BOARD -) +_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)} From d0e22d04d6e942b095e27cfd0a66050b9efdd6ed Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 29 May 2020 15:25:32 -0400 Subject: [PATCH 4/9] Updating pylint fixing pylint errors --- adafruit_platformdetect/board.py | 2 +- adafruit_platformdetect/constants/boards.py | 5 ++--- bin/detect.py | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index cd8d4029..6f3d04b9 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -421,7 +421,7 @@ def any_udoo_board(self): 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 + return self.ASUS_Tinker_Board @property def any_embedded_linux(self): diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index aebd11d0..97ed70f5 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -23,6 +23,7 @@ PYBOARD = "PYBOARD" NODEMCU = "NODEMCU" GIANT_BOARD = "GIANT_BOARD" +ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" # Clockwork Pi boards CLOCKWORK_CPI3 = "CLOCKWORK_CPI3" @@ -98,8 +99,6 @@ UDOO_BOLT_V3 = "UDOO_BOLT_V3" UDOO_BOLT_V8 = "UDOO_BOLT_V8" -ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" - # pylint: enable=bad-whitespace # OrangePI @@ -348,7 +347,7 @@ _PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) # ASUS Tinker Board -_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD +_ASUS_TINKER_BOARD_DEV_IDS = (ASUS_TINKER_BOARD) # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)} diff --git a/bin/detect.py b/bin/detect.py index 1b0ea918..2ba677c5 100644 --- a/bin/detect.py +++ b/bin/detect.py @@ -59,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.") From 3eaf2add355db8bf8800950c1ad1536e1df41075 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 29 May 2020 15:31:38 -0400 Subject: [PATCH 5/9] Reformatted with Black Reformatted with Black- sorry for all the back and forth, it's my first time doing something like this. --- adafruit_platformdetect/constants/boards.py | 2 +- bin/detect.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 97ed70f5..b79f76e1 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -347,7 +347,7 @@ _PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) # ASUS Tinker Board -_ASUS_TINKER_BOARD_DEV_IDS = (ASUS_TINKER_BOARD) +_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)} diff --git a/bin/detect.py b/bin/detect.py index 2ba677c5..c96b7a11 100644 --- a/bin/detect.py +++ b/bin/detect.py @@ -59,6 +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.") From 6333865b87f0f27daff27815dfee7e2df7d2db19 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Tue, 2 Jun 2020 10:24:40 -0400 Subject: [PATCH 6/9] Changing ASUS_TINKER_BOARD to _ASUS_TINKER_BOARD Changing ASUS_TINKER_BOARD to _ASUS_TINKER_BOARD. Should be last commit, thank you for all your help and guidance! --- adafruit_platformdetect/board.py | 4 ++-- adafruit_platformdetect/constants/boards.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 6f3d04b9..14c7f20c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -120,7 +120,7 @@ def id(self): elif chip_id == chips.RK3308: board_id = self._rock_pi_id() elif chip_id == chips.RK3288: - board_id = boards.ASUS_TINKER_BOARD + board_id = boards._ASUS_TINKER_BOARD elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() @@ -331,7 +331,7 @@ def _asus_tinker_board_id(self): board_value = self.detector.get_device_model() board = None if board_value and "ASUS Tinker Board" in board_value: - board = boards.ASUS_TINKER_BOARD + board = boards._ASUS_TINKER_BOARD return board @property diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index b79f76e1..12d9e8b4 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -23,7 +23,7 @@ PYBOARD = "PYBOARD" NODEMCU = "NODEMCU" GIANT_BOARD = "GIANT_BOARD" -ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" +_ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" # Clockwork Pi boards CLOCKWORK_CPI3 = "CLOCKWORK_CPI3" @@ -347,7 +347,7 @@ _PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) # ASUS Tinker Board -_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD +_ASUS_TINKER_BOARD_DEV_IDS = _ASUS_TINKER_BOARD # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)} From 8f4bf4a94fef4cb5cf9a6a61052cbca307468b4e Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Tue, 2 Jun 2020 18:51:33 -0400 Subject: [PATCH 7/9] Adding _ASUS_TINKER_BOARD_IDS Changed some things up to have everything match formatting for multiple boards so that more Tinker Board types can be added easily (I'm hoping to add the S after the original Tinker Board is all set) --- adafruit_platformdetect/board.py | 2 +- adafruit_platformdetect/constants/boards.py | 7 +++++-- bin/detect.py | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index cd8d4029..0f648f3b 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -421,7 +421,7 @@ def any_udoo_board(self): 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 + return self.id in boards._ASUS_TINKER_BOARD_IDS @property def any_embedded_linux(self): diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index aebd11d0..3092e48a 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -24,6 +24,9 @@ NODEMCU = "NODEMCU" GIANT_BOARD = "GIANT_BOARD" +# ASUS Tinker Boards +ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" + # Clockwork Pi boards CLOCKWORK_CPI3 = "CLOCKWORK_CPI3" @@ -98,10 +101,10 @@ UDOO_BOLT_V3 = "UDOO_BOLT_V3" UDOO_BOLT_V8 = "UDOO_BOLT_V8" -ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" - # pylint: enable=bad-whitespace +_ASUS_TINKER_BOARD_IDS = ASUS_TINKER_BOARD + # OrangePI _ORANGE_PI_IDS = ( ORANGE_PI_PC, diff --git a/bin/detect.py b/bin/detect.py index 1b0ea918..c96b7a11 100644 --- a/bin/detect.py +++ b/bin/detect.py @@ -59,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.") From 834f1b32d2b5b4906797a69fa39f8f3379768db7 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Tue, 16 Jun 2020 18:51:56 -0400 Subject: [PATCH 8/9] Changing to _ASUS_TINKER_BOARD_IDS Updating to boards._ASUS_TINKER_BOARD_IDS --- adafruit_platformdetect/board.py | 4 ++-- adafruit_platformdetect/constants/boards.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 0f648f3b..9ea23a0c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -120,7 +120,7 @@ def id(self): elif chip_id == chips.RK3308: board_id = self._rock_pi_id() elif chip_id == chips.RK3288: - board_id = boards.ASUS_TINKER_BOARD + board_id = boards._ASUS_TINKER_BOARD_IDS elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() @@ -331,7 +331,7 @@ def _asus_tinker_board_id(self): board_value = self.detector.get_device_model() board = None if board_value and "ASUS Tinker Board" in board_value: - board = boards.ASUS_TINKER_BOARD + board = boards._ASUS_TINKER_BOARD_IDS return board @property diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index a221ae45..375606f5 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -357,7 +357,7 @@ _PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) # ASUS Tinker Board -_ASUS_TINKER_BOARD_DEV_IDS = _ASUS_TINKER_BOARD +_ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",)} From 24124352c300e0a09554153285b4de8b6c12eb01 Mon Sep 17 00:00:00 2001 From: BlitzCityDIY Date: Fri, 26 Jun 2020 13:52:16 -0400 Subject: [PATCH 9/9] Changing to use function Changing to use function _asus_tinker_board_id() in board.py --- adafruit_platformdetect/board.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 9ea23a0c..a6ed830a 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -120,7 +120,7 @@ def id(self): elif chip_id == chips.RK3308: board_id = self._rock_pi_id() elif chip_id == chips.RK3288: - board_id = boards._ASUS_TINKER_BOARD_IDS + board_id = self._asus_tinker_board_id() elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id()