diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index eced6c3..f0272a5 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -105,6 +105,8 @@ class Board: board_id = boards.ODROID_XU4 elif chip_id == chips.FT232H: board_id = boards.FTDI_FT232H + elif chip_id == chips.FT2232H: + board_id = boards.FTDI_FT2232H elif chip_id == chips.APQ8016: board_id = boards.DRAGONBOARD_410C elif chip_id in (chips.T210, chips.T186, chips.T194): @@ -547,6 +549,11 @@ class Board: """Check whether the current board is an FTDI FT232H.""" return self.id == boards.FTDI_FT232H + @property + def ftdi_ft2232h(self): + """Check whether the current board is an FTDI FT2232H.""" + return self.id == boards.FTDI_FT2232H + @property def microchip_mcp2221(self): """Check whether the current board is a Microchip MCP2221.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index e91a179..78ed9ff 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -83,6 +83,18 @@ class Chip: ) self._chip_id = chips.FT232H return self._chip_id + if os.environ.get("BLINKA_FT2232H"): + from pyftdi.usbtools import UsbTools + + # look for it based on PID/VID + count = len(UsbTools.find_all([(0x0403, 0x6010)])) + if count == 0: + raise RuntimeError( + "BLINKA_FT2232H environment variable " + + "set, but no FT2232H device found" + ) + self._chip_id = chips.FT2232H + 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 331c493..faec663 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -104,6 +104,7 @@ ODROID_N2 = "ODROID_N2" ODROID_XU4 = "ODROID_XU4" FTDI_FT232H = "FTDI_FT232H" +FTDI_FT2232H = "FTDI_FT2232H" DRAGONBOARD_410C = "DRAGONBOARD_410C" SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED" diff --git a/adafruit_platformdetect/constants/chips.py b/adafruit_platformdetect/constants/chips.py index 0789fb8..4591493 100644 --- a/adafruit_platformdetect/constants/chips.py +++ b/adafruit_platformdetect/constants/chips.py @@ -21,6 +21,7 @@ T194 = "T194" APQ8016 = "APQ8016" GENERIC_X86 = "GENERIC_X86" FT232H = "FT232H" +FT2232H = "FT2232H" HFU540 = "HFU540" MCP2221 = "MCP2221" BINHO = "BINHO" diff --git a/bin/detect.py b/bin/detect.py index 49fd246..44159f8 100644 --- a/bin/detect.py +++ b/bin/detect.py @@ -30,6 +30,7 @@ print("Is this an STM32MP1 Board?", detector.board.any_stm32mp1) print( "Is this an OS environment variable special case?", detector.board.FTDI_FT232H + | detector.board.FTDI_FT2232H | detector.board.MICROCHIP_MCP2221 | detector.board.BINHO_NOVA | detector.board.GREATFET_ONE,