Skip to content

Commit 59edca9

Browse files
authored
Merge pull request #149 from tigard-tools/master
FT2232H support
2 parents 23121c6 + 8a40e3d commit 59edca9

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ def id(self):
105105
board_id = boards.ODROID_XU4
106106
elif chip_id == chips.FT232H:
107107
board_id = boards.FTDI_FT232H
108+
elif chip_id == chips.FT2232H:
109+
board_id = boards.FTDI_FT2232H
108110
elif chip_id == chips.APQ8016:
109111
board_id = boards.DRAGONBOARD_410C
110112
elif chip_id in (chips.T210, chips.T186, chips.T194):
@@ -547,6 +549,11 @@ def ftdi_ft232h(self):
547549
"""Check whether the current board is an FTDI FT232H."""
548550
return self.id == boards.FTDI_FT232H
549551

552+
@property
553+
def ftdi_ft2232h(self):
554+
"""Check whether the current board is an FTDI FT2232H."""
555+
return self.id == boards.FTDI_FT2232H
556+
550557
@property
551558
def microchip_mcp2221(self):
552559
"""Check whether the current board is a Microchip MCP2221."""

adafruit_platformdetect/chip.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ def id(
8383
)
8484
self._chip_id = chips.FT232H
8585
return self._chip_id
86+
if os.environ.get("BLINKA_FT2232H"):
87+
from pyftdi.usbtools import UsbTools
88+
89+
# look for it based on PID/VID
90+
count = len(UsbTools.find_all([(0x0403, 0x6010)]))
91+
if count == 0:
92+
raise RuntimeError(
93+
"BLINKA_FT2232H environment variable "
94+
+ "set, but no FT2232H device found"
95+
)
96+
self._chip_id = chips.FT2232H
97+
return self._chip_id
8698
if os.environ.get("BLINKA_MCP2221"):
8799
import hid
88100

adafruit_platformdetect/constants/boards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
ODROID_XU4 = "ODROID_XU4"
105105

106106
FTDI_FT232H = "FTDI_FT232H"
107+
FTDI_FT2232H = "FTDI_FT2232H"
107108
DRAGONBOARD_410C = "DRAGONBOARD_410C"
108109

109110
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"

adafruit_platformdetect/constants/chips.py

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

bin/detect.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
print(
3131
"Is this an OS environment variable special case?",
3232
detector.board.FTDI_FT232H
33+
| detector.board.FTDI_FT2232H
3334
| detector.board.MICROCHIP_MCP2221
3435
| detector.board.BINHO_NOVA
3536
| detector.board.GREATFET_ONE,

0 commit comments

Comments
 (0)