From 624a40d5808447122fb6f15cb0c10a281f09e9ec Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:20:48 +0300 Subject: [PATCH 01/21] added JH7110 RISC-V chip and STARFIVE VISIONFIVE2 board --- adafruit_platformdetect/board.py | 9 ++++++++- adafruit_platformdetect/chip.py | 3 ++- adafruit_platformdetect/constants/boards.py | 5 +++++ adafruit_platformdetect/constants/chips.py | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 0358b5f..87a29c4 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -63,6 +63,8 @@ def id(self) -> Optional[str]: if chip_id == chips.H3: board_id = self._armbian_id() or self._allwinner_variants_id() + elif chip_id == chips.JH7110: + board_id = self._starfive_id() elif chip_id == chips.BCM2XXX: board_id = self._pi_id() elif chip_id == chips.OS_AGNOSTIC: @@ -226,7 +228,12 @@ def id(self) -> Optional[str]: return board_id # pylint: enable=invalid-name - + def _starfive_id(self) -> Optional[str]: + model = None + board_value = self.detector.get_device_compatible() + if "visionfive-v2starfive" in board_value: + model = boards.VISIONFIVE2 + return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" # Check for Pi boards: diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 9958823..c5670c5 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -223,7 +223,8 @@ def _linux_id(self) -> Optional[str]: # Newer Builds if self.detector.check_dt_compatible_value("jh7100"): return chips.JH71X0 - + if self.detector.check_dt_compatible_value("jh7110"): + return chips.JH7110 if self.detector.check_dt_compatible_value("sun8i-a33"): return chips.A33 diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 23daaa2..d684c6f 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -4,6 +4,7 @@ """Definition of boards and/or ids""" # Allow for aligned constant definitions: +VISIONFIVE2 = "VISIONFIVE2" BEAGLE_PLAY = "BEAGLE_PLAY" BEAGLEBONE_AI64 = "BEAGLEBONE_AI64" BEAGLEBONE = "BEAGLEBONE" @@ -243,6 +244,10 @@ LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI" LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS" +# StarFive boards +_STARFIVE_BOARD_IDS = ( + VISIONFIVE2, +) # Asus Tinkerboard _ASUS_TINKER_BOARD_IDS = ( ASUS_TINKER_BOARD, diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index fee4260..3210724 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -41,6 +41,7 @@ HFU540 = "HFU540" C906 = "C906" JH71X0 = "JH71X0" +JH7110 = "JH7110" MCP2221 = "MCP2221" BINHO = "BINHO" MIPS24KC = "MIPS24KC" From d5b4493460bd13ce48e598f14a24150a03bbf552 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:27:33 +0300 Subject: [PATCH 02/21] debug output added --- adafruit_platformdetect/board.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 87a29c4..e48b6c3 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -64,6 +64,7 @@ def id(self) -> Optional[str]: if chip_id == chips.H3: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.JH7110: + print('aaaaaa') board_id = self._starfive_id() elif chip_id == chips.BCM2XXX: board_id = self._pi_id() From e8076ca1681aebf41d40c919987c2aa28a36fe51 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:27:46 +0300 Subject: [PATCH 03/21] debug output added --- adafruit_platformdetect/board.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index e48b6c3..fcda5de 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -234,6 +234,8 @@ def _starfive_id(self) -> Optional[str]: board_value = self.detector.get_device_compatible() if "visionfive-v2starfive" in board_value: model = boards.VISIONFIVE2 + print(model) + print(board_value) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From 998e553144f4e446f046aa3f8a9346794221c5fc Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:29:40 +0300 Subject: [PATCH 04/21] changed starfive board detection function --- 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 fcda5de..09cf665 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -232,7 +232,7 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if "visionfive-v2starfive" in board_value: + if board_value == "starfive,visionfive-v2starfive,jh7110": model = boards.VISIONFIVE2 print(model) print(board_value) From f59895faf3733428abc6a98165d1356cda56764f Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:33:59 +0300 Subject: [PATCH 05/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 09cf665..b4b47f5 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -64,7 +64,6 @@ def id(self) -> Optional[str]: if chip_id == chips.H3: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.JH7110: - print('aaaaaa') board_id = self._starfive_id() elif chip_id == chips.BCM2XXX: board_id = self._pi_id() @@ -232,10 +231,13 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if board_value == "starfive,visionfive-v2starfive,jh7110": + if board_value == 'starfive,visionfive-v2starfive,jh7110': + print('it is') model = boards.VISIONFIVE2 - print(model) - print(board_value) + else: + print(board_value) + print('is not') + print('starfive,visionfive-v2starfive,jh7110') return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From 5a4de6434404d01d4ad4a0a022d53b8025cdaf30 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:37:38 +0300 Subject: [PATCH 06/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index b4b47f5..b9b81ff 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -231,13 +231,10 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if board_value == 'starfive,visionfive-v2starfive,jh7110': - print('it is') + if "visionfive-v2starfive" in board_value: model = boards.VISIONFIVE2 - else: - print(board_value) - print('is not') - print('starfive,visionfive-v2starfive,jh7110') + print(board_value == "starfive,visionfive-v2starfive,jh7110") + print(type(board_value)) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From b6162a3c20572ab08211dae726caa3da210484b6 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:39:09 +0300 Subject: [PATCH 07/21] changed starfive board detection function --- 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 b9b81ff..0b1dd6b 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -233,8 +233,8 @@ def _starfive_id(self) -> Optional[str]: board_value = self.detector.get_device_compatible() if "visionfive-v2starfive" in board_value: model = boards.VISIONFIVE2 - print(board_value == "starfive,visionfive-v2starfive,jh7110") print(type(board_value)) + print(type("visionfive-v2starfive")) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From e66339800f7847f484f62a35902b2831f85915ae Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:42:43 +0300 Subject: [PATCH 08/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 0b1dd6b..ba88647 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -231,10 +231,9 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if "visionfive-v2starfive" in board_value: + if "starfive,visionfive-v2starfive,jh7110".casefold() == board_value.casefold(): model = boards.VISIONFIVE2 print(type(board_value)) - print(type("visionfive-v2starfive")) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From 407208c93a374e22bafd3f74d4babab688ac60f1 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:45:42 +0300 Subject: [PATCH 09/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index ba88647..d92f6b9 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -231,9 +231,8 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if "starfive,visionfive-v2starfive,jh7110".casefold() == board_value.casefold(): + if "starfive,visionfive-v2starfive,jh7110".casefold().strip() == board_value.casefold().strip(): model = boards.VISIONFIVE2 - print(type(board_value)) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From 2bb3b99b296ebe7d7f32724274e68c8fd09ab16a Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:47:29 +0300 Subject: [PATCH 10/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index d92f6b9..77c2db7 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -233,6 +233,8 @@ def _starfive_id(self) -> Optional[str]: board_value = self.detector.get_device_compatible() if "starfive,visionfive-v2starfive,jh7110".casefold().strip() == board_value.casefold().strip(): model = boards.VISIONFIVE2 + print("starfive,visionfive-v2starfive,jh7110".casefold().strip()) + print(board_value.casefold().strip()) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From 05220e54155538dd7e383f6f50ae379b819612e8 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:49:35 +0300 Subject: [PATCH 11/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 77c2db7..d7de759 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -231,10 +231,8 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if "starfive,visionfive-v2starfive,jh7110".casefold().strip() == board_value.casefold().strip(): + if board_value == "starfive,visionfive-v2starfive,jh7110": model = boards.VISIONFIVE2 - print("starfive,visionfive-v2starfive,jh7110".casefold().strip()) - print(board_value.casefold().strip()) return model def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" From aa493d0319ec8393132cab2d57f025ef9240f3b5 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:52:06 +0300 Subject: [PATCH 12/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index d7de759..21b5759 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -30,7 +30,6 @@ from adafruit_platformdetect.constants import boards, chips - __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git" @@ -149,13 +148,13 @@ def id(self) -> Optional[str]: board_id = self._pine64_id() elif chip_id == chips.H6: board_id = ( - self._pine64_id() or self._armbian_id() or self._repka_variants_id() + self._pine64_id() or self._armbian_id() or self._repka_variants_id() ) elif chip_id == chips.H5: board_id = ( - self._armbian_id() - or self._allwinner_variants_id() - or self._repka_variants_id() + self._armbian_id() + or self._allwinner_variants_id() + or self._repka_variants_id() ) elif chip_id == chips.H616: board_id = self._armbian_id() or self._allwinner_variants_id() @@ -165,11 +164,11 @@ def id(self) -> Optional[str]: board_id = self._rock_pi_id() elif chip_id == chips.RK3399: board_id = ( - self._rock_pi_id() - or self._armbian_id() - or self._diet_pi_id() - or self._asus_tinker_board_id() - or self._vivid_unit_id() + self._rock_pi_id() + or self._armbian_id() + or self._diet_pi_id() + or self._asus_tinker_board_id() + or self._vivid_unit_id() ) elif chip_id == chips.RK3399PRO: board_id = self._asus_tinker_board_id() @@ -189,10 +188,10 @@ def id(self) -> Optional[str]: board_id = self._rk3568_id() elif chip_id == chips.RK3588: board_id = ( - self._rock_pi_id() - or self._orange_pi_id() - or self._armbian_id() - or self._rk3588_id() + self._rock_pi_id() + or self._orange_pi_id() + or self._armbian_id() + or self._rk3588_id() ) elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() @@ -231,9 +230,10 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None board_value = self.detector.get_device_compatible() - if board_value == "starfive,visionfive-v2starfive,jh7110": + if 'visionfive-v2starfive' in str(board_value): model = boards.VISIONFIVE2 return model + def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" # Check for Pi boards: @@ -578,7 +578,7 @@ def _pynq_id(self) -> Optional[str]: """Try to detect the id for Xilinx PYNQ boards.""" try: with open( - "/proc/device-tree/chosen/pynq_board", "r", encoding="utf-8" + "/proc/device-tree/chosen/pynq_board", "r", encoding="utf-8" ) as board_file: board_model = board_file.read() match = board_model.upper().replace("-", "_").rstrip("\x00") @@ -698,7 +698,7 @@ def _j4105_id(self) -> Optional[str]: """Try to detect the id of J4105 board.""" try: with open( - "/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8" + "/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8" ) as board_name: board_value = board_name.read().rstrip() if board_value in ("ODYSSEY-X86J41X5", "ODYSSEY-X86J41O5"): From d4d2c00f678afa6a47221ec99b46d45a97c51c1e Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:56:04 +0300 Subject: [PATCH 13/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 21b5759..2511a4e 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -229,8 +229,8 @@ def id(self) -> Optional[str]: # pylint: enable=invalid-name def _starfive_id(self) -> Optional[str]: model = None - board_value = self.detector.get_device_compatible() - if 'visionfive-v2starfive' in str(board_value): + model_value = self.detector.get_device_model() + if model_value == "StarFive VisionFive V2": model = boards.VISIONFIVE2 return model From 9b6ad2b98b77ec645b27683a291a792d2dfb78a3 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:57:11 +0300 Subject: [PATCH 14/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 2511a4e..3f2cbc8 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -230,6 +230,7 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None model_value = self.detector.get_device_model() + print(model_value) if model_value == "StarFive VisionFive V2": model = boards.VISIONFIVE2 return model From 90295ca01be244a1565ab3034f1a2c8192d1134d Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Wed, 26 Jun 2024 23:58:26 +0300 Subject: [PATCH 15/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 3f2cbc8..e8fac4c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -231,8 +231,8 @@ def _starfive_id(self) -> Optional[str]: model = None model_value = self.detector.get_device_model() print(model_value) - if model_value == "StarFive VisionFive V2": - model = boards.VISIONFIVE2 + #if model_value == "StarFive VisionFive V2": + model = boards.VISIONFIVE2 return model def _pi_id(self) -> Optional[str]: From 96b0c0572c0c368a9daf3215bad4209cec367180 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Thu, 27 Jun 2024 00:00:46 +0300 Subject: [PATCH 16/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index e8fac4c..0b99cfd 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -231,8 +231,8 @@ def _starfive_id(self) -> Optional[str]: model = None model_value = self.detector.get_device_model() print(model_value) - #if model_value == "StarFive VisionFive V2": - model = boards.VISIONFIVE2 + if "VisionFive" in model_value and "V2" in model_value: + model = boards.VISIONFIVE2 return model def _pi_id(self) -> Optional[str]: From d8478ab127afa8de5225a224da2449412bef5124 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Thu, 27 Jun 2024 00:02:45 +0300 Subject: [PATCH 17/21] changed starfive board detection function --- adafruit_platformdetect/board.py | 1 - 1 file changed, 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 0b99cfd..26dac8b 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -230,7 +230,6 @@ def id(self) -> Optional[str]: def _starfive_id(self) -> Optional[str]: model = None model_value = self.detector.get_device_model() - print(model_value) if "VisionFive" in model_value and "V2" in model_value: model = boards.VISIONFIVE2 return model From 086984c8433e66ba822a506a8580da8a52f74df5 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Thu, 27 Jun 2024 00:09:18 +0300 Subject: [PATCH 18/21] reformatted the changed files --- adafruit_platformdetect/chip.py | 52 ++++++++++----------- adafruit_platformdetect/constants/boards.py | 1 - 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index c5670c5..0e26184 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -19,7 +19,6 @@ """ - import os import sys @@ -30,7 +29,6 @@ from adafruit_platformdetect.constants import chips - __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git" @@ -45,7 +43,7 @@ def __init__(self, detector) -> None: # pylint: disable=invalid-name,too-many-branches,too-many-return-statements @property def id( - self, + self, ) -> Optional[str]: """Return a unique id for the detected chip, if any.""" # There are some times we want to trick the platform detection @@ -112,31 +110,31 @@ def id( # NOTE: If any products are added here, they need added # to _rp2040_u2if_id() in board.py as well. if ( - # Raspberry Pi Pico - vendor == 0xCAFE - and product == 0x4005 + # Raspberry Pi Pico + vendor == 0xCAFE + and product == 0x4005 ) or ( - # Feather RP2040 - # Itsy Bitsy RP2040 - # QT Py RP2040 - # QT2040 Trinkey - # MacroPad RP2040 - # Feather RP2040 ThinkInk - # Feather RP2040 RFM - # Feather RP2040 CAN Bus - vendor == 0x239A - and product - in ( - 0x00F1, - 0x00FD, - 0x00F7, - 0x0109, - 0x0107, - 0x812C, - 0x812E, - 0x8130, - 0x0105, - ) + # Feather RP2040 + # Itsy Bitsy RP2040 + # QT Py RP2040 + # QT2040 Trinkey + # MacroPad RP2040 + # Feather RP2040 ThinkInk + # Feather RP2040 RFM + # Feather RP2040 CAN Bus + vendor == 0x239A + and product + in ( + 0x00F1, + 0x00FD, + 0x00F7, + 0x0109, + 0x0107, + 0x812C, + 0x812E, + 0x8130, + 0x0105, + ) ): self._chip_id = chips.RP2040_U2IF return self._chip_id diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index d684c6f..49e646b 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -74,7 +74,6 @@ NANOPI_NEO = "NANOPI_NEO" NANOPI_NEO_2 = "NANOPI_NEO_2" - # Banana Pi boards BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO" BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS" From 6de892138c843765cf3b34bbf651164473ff7d35 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Thu, 27 Jun 2024 00:22:53 +0300 Subject: [PATCH 19/21] reformatted the changed files --- adafruit_platformdetect/chip.py | 52 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 0e26184..7bcc8b0 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -43,7 +43,7 @@ def __init__(self, detector) -> None: # pylint: disable=invalid-name,too-many-branches,too-many-return-statements @property def id( - self, + self, ) -> Optional[str]: """Return a unique id for the detected chip, if any.""" # There are some times we want to trick the platform detection @@ -110,31 +110,31 @@ def id( # NOTE: If any products are added here, they need added # to _rp2040_u2if_id() in board.py as well. if ( - # Raspberry Pi Pico - vendor == 0xCAFE - and product == 0x4005 + # Raspberry Pi Pico + vendor == 0xCAFE + and product == 0x4005 ) or ( - # Feather RP2040 - # Itsy Bitsy RP2040 - # QT Py RP2040 - # QT2040 Trinkey - # MacroPad RP2040 - # Feather RP2040 ThinkInk - # Feather RP2040 RFM - # Feather RP2040 CAN Bus - vendor == 0x239A - and product - in ( - 0x00F1, - 0x00FD, - 0x00F7, - 0x0109, - 0x0107, - 0x812C, - 0x812E, - 0x8130, - 0x0105, - ) + # Feather RP2040 + # Itsy Bitsy RP2040 + # QT Py RP2040 + # QT2040 Trinkey + # MacroPad RP2040 + # Feather RP2040 ThinkInk + # Feather RP2040 RFM + # Feather RP2040 CAN Bus + vendor == 0x239A + and product + in ( + 0x00F1, + 0x00FD, + 0x00F7, + 0x0109, + 0x0107, + 0x812C, + 0x812E, + 0x8130, + 0x0105, + ) ): self._chip_id = chips.RP2040_U2IF return self._chip_id @@ -221,8 +221,10 @@ def _linux_id(self) -> Optional[str]: # Newer Builds if self.detector.check_dt_compatible_value("jh7100"): return chips.JH71X0 + if self.detector.check_dt_compatible_value("jh7110"): return chips.JH7110 + if self.detector.check_dt_compatible_value("sun8i-a33"): return chips.A33 From ca3c7b1dfb8b998511af46b13287edd36cf2a3da Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Thu, 27 Jun 2024 00:36:29 +0300 Subject: [PATCH 20/21] formatted --- adafruit_platformdetect/constants/boards.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 49e646b..0be9a3b 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -244,9 +244,7 @@ LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS" # StarFive boards -_STARFIVE_BOARD_IDS = ( - VISIONFIVE2, -) +_STARFIVE_BOARD_IDS = (VISIONFIVE2,) # Asus Tinkerboard _ASUS_TINKER_BOARD_IDS = ( ASUS_TINKER_BOARD, From 0a85b3bf17c4101c5471d1957a68da7f00cd6877 Mon Sep 17 00:00:00 2001 From: DarkMechanikum Date: Thu, 27 Jun 2024 00:38:45 +0300 Subject: [PATCH 21/21] formatted --- adafruit_platformdetect/board.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 26dac8b..fc00772 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -148,13 +148,13 @@ def id(self) -> Optional[str]: board_id = self._pine64_id() elif chip_id == chips.H6: board_id = ( - self._pine64_id() or self._armbian_id() or self._repka_variants_id() + self._pine64_id() or self._armbian_id() or self._repka_variants_id() ) elif chip_id == chips.H5: board_id = ( - self._armbian_id() - or self._allwinner_variants_id() - or self._repka_variants_id() + self._armbian_id() + or self._allwinner_variants_id() + or self._repka_variants_id() ) elif chip_id == chips.H616: board_id = self._armbian_id() or self._allwinner_variants_id() @@ -164,11 +164,11 @@ def id(self) -> Optional[str]: board_id = self._rock_pi_id() elif chip_id == chips.RK3399: board_id = ( - self._rock_pi_id() - or self._armbian_id() - or self._diet_pi_id() - or self._asus_tinker_board_id() - or self._vivid_unit_id() + self._rock_pi_id() + or self._armbian_id() + or self._diet_pi_id() + or self._asus_tinker_board_id() + or self._vivid_unit_id() ) elif chip_id == chips.RK3399PRO: board_id = self._asus_tinker_board_id() @@ -188,10 +188,10 @@ def id(self) -> Optional[str]: board_id = self._rk3568_id() elif chip_id == chips.RK3588: board_id = ( - self._rock_pi_id() - or self._orange_pi_id() - or self._armbian_id() - or self._rk3588_id() + self._rock_pi_id() + or self._orange_pi_id() + or self._armbian_id() + or self._rk3588_id() ) elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() @@ -578,7 +578,7 @@ def _pynq_id(self) -> Optional[str]: """Try to detect the id for Xilinx PYNQ boards.""" try: with open( - "/proc/device-tree/chosen/pynq_board", "r", encoding="utf-8" + "/proc/device-tree/chosen/pynq_board", "r", encoding="utf-8" ) as board_file: board_model = board_file.read() match = board_model.upper().replace("-", "_").rstrip("\x00") @@ -698,7 +698,7 @@ def _j4105_id(self) -> Optional[str]: """Try to detect the id of J4105 board.""" try: with open( - "/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8" + "/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8" ) as board_name: board_value = board_name.read().rstrip() if board_value in ("ODYSSEY-X86J41X5", "ODYSSEY-X86J41O5"):