Skip to content

Commit 34d046a

Browse files
committed
Add support for detecting FT2232H
1 parent 6b0847d commit 34d046a

File tree

5 files changed

+21
-0
lines changed

5 files changed

+21
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def id(self):
9595
board_id = boards.ODROID_XU4
9696
elif chip_id == chips.FT232H:
9797
board_id = boards.FTDI_FT232H
98+
elif chip_id == chips.FT2232H:
99+
board_id = boards.FTDI_FT2232H
98100
elif chip_id == chips.APQ8016:
99101
board_id = boards.DRAGONBOARD_410C
100102
elif chip_id in (chips.T210, chips.T186, chips.T194):
@@ -437,6 +439,11 @@ def ftdi_ft232h(self):
437439
"""Check whether the current board is an FTDI FT232H."""
438440
return self.id == boards.FTDI_FT232H
439441

442+
@property
443+
def ftdi_ft2232h(self):
444+
"""Check whether the current board is an FTDI FT2232H."""
445+
return self.id == boards.FTDI_FT2232H
446+
440447
@property
441448
def microchip_mcp2221(self):
442449
"""Check whether the current board is a Microchip MCP2221."""

adafruit_platformdetect/chip.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ def id(
7676
+ "set, but no FT232H device found"
7777
)
7878
return chips.FT232H
79+
if os.environ.get("BLINKA_FT2232H"):
80+
from pyftdi.usbtools import UsbTools
81+
82+
# look for it based on PID/VID
83+
count = len(UsbTools.find_all([(0x0403, 0x6010)]))
84+
if count == 0:
85+
raise RuntimeError(
86+
"BLINKA_FT2232H environment variable "
87+
+ "set, but no FT2232H device found"
88+
)
89+
return chips.FT2232H
7990
if os.environ.get("BLINKA_MCP2221"):
8091
import hid
8192

adafruit_platformdetect/constants/boards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
ODROID_XU4 = "ODROID_XU4"
7878

7979
FTDI_FT232H = "FTDI_FT232H"
80+
FTDI_FT2232H = "FTDI_FT2232H"
8081
DRAGONBOARD_410C = "DRAGONBOARD_410C"
8182

8283
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
APQ8016 = "APQ8016"
2121
GENERIC_X86 = "GENERIC_X86"
2222
FT232H = "FT232H"
23+
FT2232H = "FT2232H"
2324
HFU540 = "HFU540"
2425
MCP2221 = "MCP2221"
2526
BINHO = "BINHO"

bin/detect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
print(
2828
"Is this an OS environment variable special case?",
2929
detector.board.FTDI_FT232H
30+
| detector.board.FTDI_FT2232H
3031
| detector.board.MICROCHIP_MCP2221
3132
| detector.board.BINHO_NOVA
3233
| detector.board.GREATFET_ONE,

0 commit comments

Comments
 (0)