diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 5c1ade88..bb0cbea4 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -118,6 +118,8 @@ def id(self) -> Optional[str]: board_id = boards.FTDI_FT232H elif chip_id == chips.FT2232H: board_id = boards.FTDI_FT2232H + elif chip_id == chips.FT4232H: + board_id = boards.FTDI_FT4232H elif chip_id == chips.APQ8016: board_id = boards.DRAGONBOARD_410C elif chip_id in (chips.T210, chips.T186, chips.T194, chips.T234): @@ -1133,6 +1135,7 @@ def os_environ_board(self) -> bool: def lazily_generate_conditions(): yield self.board.FTDI_FT232H yield self.board.FTDI_FT2232H + yield self.board.FTDI_FT4232H yield self.board.MICROCHIP_MCP2221 yield self.board.BINHO_NOVA yield self.board.GREATFET_ONE @@ -1216,6 +1219,11 @@ def ftdi_ft2232h(self) -> bool: """Check whether the current board is an FTDI FT2232H.""" return self.id == boards.FTDI_FT2232H + @property + def ftdi_ft4232h(self) -> bool: + """Check whether the current board is an FTDI FT4232H.""" + return self.id == boards.FTDI_FT4232H + @property def microchip_mcp2221(self) -> bool: """Check whether the current board is a Microchip MCP2221.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index faa47ed1..1f1d88d1 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -84,6 +84,18 @@ def id( ) self._chip_id = chips.FT2232H return self._chip_id + if os.environ.get("BLINKA_FT4232H"): + from pyftdi.usbtools import UsbTools + + # look for it based on PID/VID + count = len(UsbTools.find_all([(0x0403, 0x6011)])) + if count == 0: + raise RuntimeError( + "BLINKA_FT4232H environment variable " + + "set, but no FT4232H device found" + ) + self._chip_id = chips.FT4232H + return self._chip_id if os.environ.get("BLINKA_MCP2221"): import hid diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 392b4100..b44d6056 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -162,6 +162,7 @@ FTDI_FT232H = "FTDI_FT232H" FTDI_FT2232H = "FTDI_FT2232H" +FTDI_FT4232H = "FTDI_FT4232H" DRAGONBOARD_410C = "DRAGONBOARD_410C" SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED" diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 7bbf19f9..f6200d5c 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -38,6 +38,7 @@ GENERIC_X86 = "GENERIC_X86" FT232H = "FT232H" FT2232H = "FT2232H" +FT4232H = "FT4232H" HFU540 = "HFU540" C906 = "C906" JH71X0 = "JH71X0"