From ee623a3eaf4833f4da0282a8c6a1dd1ae90257e3 Mon Sep 17 00:00:00 2001 From: cpi Date: Mon, 13 Apr 2020 10:15:53 -0700 Subject: [PATCH] Add Clockwork Pi board --- adafruit_platformdetect/board.py | 17 ++++++++++++++++- adafruit_platformdetect/chip.py | 3 +++ adafruit_platformdetect/constants/boards.py | 3 +++ adafruit_platformdetect/constants/chips.py | 1 + bin/detect.py | 4 ++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 83f5332e..69e3bdb4 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -73,6 +73,8 @@ def id(self): board_id = self._pynq_id() elif chip_id == chips.A64: board_id = self._pine64_id() + elif chip_id == chips.A33: + board_id = self._clockwork_pi_id() return board_id # pylint: enable=invalid-name @@ -252,6 +254,14 @@ def _pynq_id(self): except FileNotFoundError: return None + def _clockwork_pi_id(self): + """Check what type of Clockwork Pi board.""" + board_value = self.detector.get_device_model() + board = None + if board_value and "Clockwork CPI3" in board_value: + board = boards.CLOCKWORK_CPI3 + return board + @property def any_96boards(self): """Check whether the current board is any 96boards board.""" @@ -322,6 +332,11 @@ def any_pine64_board(self): """Check whether the current board is any Pine64 device.""" return self.id in boards._PINE64_DEV_IDS + @property + def any_clockwork_pi_board(self): + """Check whether the current board is any Clockwork Pi device.""" + return self.CLOCKWORK_CPI3 + @property def any_embedded_linux(self): """Check whether the current board is any embedded Linux device.""" @@ -331,7 +346,7 @@ def any_embedded_linux(self): self.any_giant_board, self.any_jetson_board, self.any_coral_board, self.any_odroid_40_pin, self.any_96boards, self.any_sifive_board, self.any_onion_omega_board, self.any_pine64_board, - self.any_pynq_board, + self.any_pynq_board, self.any_clockwork_pi_board ] ) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 5a9ea266..4e2d2307 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -64,6 +64,9 @@ def _linux_id(self): # pylint: disable=too-many-branches,too-many-statements if self.detector.check_dt_compatible_value('fu500'): return chips.HFU540 + if self.detector.check_dt_compatible_value('sun8i-a33'): + return chips.A33 + linux_id = None hardware = self.detector.get_cpuinfo_field('Hardware') diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 78c12d31..247f1054 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -24,6 +24,9 @@ NODEMCU = "NODEMCU" GIANT_BOARD = "GIANT_BOARD" +# Clockwork Pi boards +CLOCKWORK_CPI3 = "CLOCKWORK_CPI3" + # Orange Pi boards ORANGE_PI_PC = "ORANGE_PI_PC" ORANGE_PI_R1 = "ORANGE_PI_R1" diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 07dc69a1..591bb2dd 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -24,5 +24,6 @@ MIPS24KEC = "MIPS24KEC" ZYNQ7000 = "ZYNQ7000" A64 = "A64" +A33 = "A33" BCM_RANGE = {'BCM2708', 'BCM2709', 'BCM2711', 'BCM2835', 'BCM2837'} diff --git a/bin/detect.py b/bin/detect.py index 42f74ef9..186e204a 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -19,6 +19,7 @@ print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV) print("Is this a SiFive Unleashed? ", detector.board.SIFIVE_UNLEASHED) print("Is this a PYNQ Board?", detector.board.PYNQ_Z1 | detector.board.PYNQ_Z2) +print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board) 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 an OS environment variable special case?", detector.board.FTDI_FT232H | @@ -44,3 +45,6 @@ if detector.board.any_pine64_board: print("Pine64 device detected.") + +if detector.board.any_clockwork_pi: + print("Clockwork Pi device detected.")