From 017cceb73ef4e74bc94227e843c14eb1294e9ab7 Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Sat, 14 Jun 2025 12:27:20 +0200 Subject: [PATCH 1/2] add support for Radxa-X4 via U2IF --- adafruit_platformdetect/board.py | 8 ++++++++ adafruit_platformdetect/chip.py | 2 +- adafruit_platformdetect/constants/boards.py | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 6690fbc..872435d 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -896,6 +896,8 @@ def _rp2040_u2if_id(self) -> Optional[str]: product = dev["product_id"] if vendor == 0xCAFE and product == 0x4005: return boards.PICO_U2IF + if vendor == 0xCAFF and product == 0x4005: + return boards.RADXA_X4_U2IF if vendor == 0x239A: # Feather RP2040 if product == 0x00F1: @@ -1203,6 +1205,7 @@ def lazily_generate_conditions(): yield self.board.QT2040_TRINKEY_U2IF yield self.board.KB2040_U2IF yield self.board.RP2040_ONE_U2IF + yield self.board.RADXA_X4_U2IF yield self.board.OS_AGNOSTIC_BOARD return any(condition for condition in lazily_generate_conditions()) @@ -1342,6 +1345,11 @@ def rp2040_one_u2if(self) -> bool: """Check whether the current board is an RP2040 One w/ u2if.""" return self.id == boards.RP2040_ONE_U2IF + @property + def radxa_x4_u2if(self) -> bool: + """Check whether the current board is an RP2040 One w/ u2if.""" + return self.id == boards.RADXA_X4_U2IF + @property def binho_nova(self) -> bool: """Check whether the current board is an BINHO NOVA.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index e3d950e..314f677 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -125,7 +125,7 @@ def id( if ( ( # Raspberry Pi Pico - vendor == 0xCAFE + vendor in (0xCAFE, 0xCAFF) and product == 0x4005 ) or ( diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index f5024f2..de34414 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -195,6 +195,7 @@ KB2040_U2IF = "KB2040_U2IF" RP2040_ONE_U2IF = "RP2040_ONE_U2IF" +RADXA_X4_U2IF = "RADXA_X4_U2IF" BINHO_NOVA = "BINHO_NOVA" From 691e0fe2c36b5d84c9993629443650df43c4cf9e Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 18 Jun 2025 13:54:55 -0700 Subject: [PATCH 2/2] Update chip.py Add Board name to list --- adafruit_platformdetect/chip.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 314f677..0eba6bc 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -125,6 +125,7 @@ def id( if ( ( # Raspberry Pi Pico + # Radxa X4 vendor in (0xCAFE, 0xCAFF) and product == 0x4005 )