From 111daa078b5647453a55d83edd0ef9c317e05f21 Mon Sep 17 00:00:00 2001 From: Daniel Manla <60765275+dmanla@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:14:21 -0400 Subject: [PATCH 1/6] Add PineH64 to board detection --- adafruit_platformdetect/board.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index a6ed830a..8c1a0c4e 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -115,6 +115,8 @@ def id(self): board_id = self._pynq_id() elif chip_id == chips.A64: board_id = self._pine64_id() + elif chip_id == chips.H6: + board_id = self._pine64_id() elif chip_id == chips.A33: board_id = self._clockwork_pi_id() elif chip_id == chips.RK3308: @@ -233,6 +235,8 @@ def _armbian_id(self): board = boards.ORANGE_PI_PC_PLUS if board_value == "pinebook-a64": board = boards.PINEBOOK + if board_value == "pineH64": + board = boards.PINEH64 if board_value == "orangepi2": board = boards.ORANGE_PI_2 @@ -280,6 +284,8 @@ def _pine64_id(self): board = None if "pine64" in board_value.lower(): board = boards.PINE64 + elif "pine h64" in board_value.lower(): + board = boards.PINEH64 elif "pinebook" in board_value.lower(): board = boards.PINEBOOK elif "pinephone" in board_value.lower(): From ee64a3d3b06c10297bef685002b940724822901e Mon Sep 17 00:00:00 2001 From: Daniel Manla <60765275+dmanla@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:20:03 -0400 Subject: [PATCH 2/6] Added Allwinner H6; Modified Allwinner A64 In chip.py hardware identifiers take precedence over all other forms of chip detection. This causes issues with differentiating between the Allwinner H6 and Allwinner A64. Both the Allwinner H6 and Allwinner A64 return "sun50iw1p1 when checking the cpu info Hardware field. I have added logic to prevent the use of sun50iw1p1 as an identifier. I have added additional logic which successfully detects the Allwinner H6. --- adafruit_platformdetect/chip.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index f5147a40..f2abe89d 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -135,6 +135,8 @@ def _linux_id(self): linux_id = None hardware = self.detector.get_cpuinfo_field("Hardware") + if hardware == "sun50iw1p1": #sun50iw1p1 is a common hardware identifier among different allwinner SOC's. Because it is common it should not be considered a valid + hardware = None #chip identifier. if hardware is None: vendor_id = self.detector.get_cpuinfo_field("vendor_id") @@ -175,6 +177,8 @@ def _linux_id(self): return chips.S905X3 if compatible and "sun50i-a64" in compatible: linux_id = chips.A64 + if compatible and "sun50i-h6" in compatible: + linux_id = chips.H6 if compatible and "odroid-xu4" in compatible: linux_id = chips.EXYNOS5422 @@ -213,8 +217,9 @@ def _linux_id(self): linux_id = chips.SAMA5 elif "Pinebook" in hardware: linux_id = chips.A64 - elif "sun50iw1p1" in hardware: - linux_id = chips.A64 + #elif "sun50iw1p1" in hardware: #sun50iw1p1 is a common identfier in Allwinner SOC's. I do not believe it should be + #linux_id = chips.A64 #used as an identifier. I feel it makes more sense to rely on the Linux ID. Otherwise it will be + #Impossible to differentiate between Allwinner A64's and Allwinner H6's. elif "ASUS_TINKER_BOARD" in hardware: linux_id = chips.RK3288 elif "Xilinx Zynq" in hardware: From e586f7e1c55c6153b50640e9d1b28fe1602148fb Mon Sep 17 00:00:00 2001 From: Daniel Manla <60765275+dmanla@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:21:25 -0400 Subject: [PATCH 3/6] Add PineH64 and Allwinner H6 constants --- adafruit_platformdetect/constants/boards.py | 3 ++- adafruit_platformdetect/constants/chips.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 375606f5..2c7aa522 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -93,6 +93,7 @@ ONION_OMEGA2 = "ONION_OMEGA2" PINE64 = "PINE64" +PINEH64 = "PINEH64" PINEBOOK = "PINEBOOK" PINEPHONE = "PINEPHONE" @@ -354,7 +355,7 @@ ) # Pine64 boards and devices -_PINE64_DEV_IDS = (PINE64, PINEBOOK, PINEPHONE) +_PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE) # ASUS Tinker Board _ASUS_TINKER_BOARD_DEV_IDS = ASUS_TINKER_BOARD diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 27b46f4b..ed3eb83c 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -27,6 +27,7 @@ MIPS24KEC = "MIPS24KEC" ZYNQ7000 = "ZYNQ7000" A64 = "A64" +H6 = "H6" A33 = "A33" RK3308 = "RK3308" LPC4330 = "LPC4330" From 578742c684183093786591f04e49db8903a9125e Mon Sep 17 00:00:00 2001 From: Daniel Manla <60765275+dmanla@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:26:07 -0400 Subject: [PATCH 4/6] Modified a comment for clarification --- adafruit_platformdetect/chip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index f2abe89d..e10f5a79 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -218,7 +218,7 @@ def _linux_id(self): elif "Pinebook" in hardware: linux_id = chips.A64 #elif "sun50iw1p1" in hardware: #sun50iw1p1 is a common identfier in Allwinner SOC's. I do not believe it should be - #linux_id = chips.A64 #used as an identifier. I feel it makes more sense to rely on the Linux ID. Otherwise it will be + #linux_id = chips.A64 #used as an identifier. I feel it makes more sense to rely on the device compatible field. Otherwise it will be #Impossible to differentiate between Allwinner A64's and Allwinner H6's. elif "ASUS_TINKER_BOARD" in hardware: linux_id = chips.RK3288 From 3f334213a1070d935d63467b10e2a0f97b4499f4 Mon Sep 17 00:00:00 2001 From: Daniel Manla <60765275+dmanla@users.noreply.github.com> Date: Tue, 28 Jul 2020 14:38:48 -0400 Subject: [PATCH 5/6] Fixed formatting via "black" --- adafruit_platformdetect/chip.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index e10f5a79..79f55652 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -135,8 +135,10 @@ def _linux_id(self): linux_id = None hardware = self.detector.get_cpuinfo_field("Hardware") - if hardware == "sun50iw1p1": #sun50iw1p1 is a common hardware identifier among different allwinner SOC's. Because it is common it should not be considered a valid - hardware = None #chip identifier. + if ( + hardware == "sun50iw1p1" + ): # sun50iw1p1 is a common hardware identifier among different allwinner SOC's. Because it is common it should not be considered a valid + hardware = None # chip identifier. if hardware is None: vendor_id = self.detector.get_cpuinfo_field("vendor_id") @@ -217,9 +219,9 @@ def _linux_id(self): linux_id = chips.SAMA5 elif "Pinebook" in hardware: linux_id = chips.A64 - #elif "sun50iw1p1" in hardware: #sun50iw1p1 is a common identfier in Allwinner SOC's. I do not believe it should be - #linux_id = chips.A64 #used as an identifier. I feel it makes more sense to rely on the device compatible field. Otherwise it will be - #Impossible to differentiate between Allwinner A64's and Allwinner H6's. + # elif "sun50iw1p1" in hardware: #sun50iw1p1 is a common identfier in Allwinner SOC's. I do not believe it should be + # linux_id = chips.A64 #used as an identifier. I feel it makes more sense to rely on the device compatible field. Otherwise it will be + # Impossible to differentiate between Allwinner A64's and Allwinner H6's. elif "ASUS_TINKER_BOARD" in hardware: linux_id = chips.RK3288 elif "Xilinx Zynq" in hardware: From 1f6b3f056f46b7a4dadda9ddb3e39cb08f984574 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Sun, 1 Nov 2020 09:34:23 -0800 Subject: [PATCH 6/6] Removed long line --- adafruit_platformdetect/chip.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 8b8e6ee6..b87ad22e 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -155,10 +155,6 @@ def _linux_id(self): linux_id = None hardware = self.detector.get_cpuinfo_field("Hardware") - if ( - hardware == "sun50iw1p1" - ): # sun50iw1p1 is a common hardware identifier among different allwinner SOC's. Because it is common it should not be considered a valid - hardware = None # chip identifier. if hardware is None: vendor_id = self.detector.get_cpuinfo_field("vendor_id")