Skip to content

Merge #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
34d046a
Add support for detecting FT2232H
fharding1 Jun 17, 2020
e5839d2
Merge pull request #141 from twa127/master
makermelissa Feb 8, 2021
ba05171
Add Revision ID for Pi CM4
lukschwalb Feb 16, 2021
e0fe1b0
Merge pull request #142 from lukschwalb/master
makermelissa Feb 16, 2021
8447c05
Add support for NVIDIA TX2 NX
anhmiuhv Feb 16, 2021
091cd9b
Merge pull request #143 from anhmiuhv/tx2_nx
makermelissa Feb 25, 2021
3994881
Add Rock Pi 4c Support
thomoray Mar 4, 2021
0bf1431
Code reformat
thomoray Mar 6, 2021
8ebe99c
Merge pull request #145 from thomoray/add-rockpi4c-support
makermelissa Mar 8, 2021
a01ac30
Added detection for OSD32MP1 development board.
TeslaK20 Mar 11, 2021
0a73977
Fixed reformatting.
TeslaK20 Mar 11, 2021
013d2e2
Update board.py
makermelissa Mar 12, 2021
3e36c50
Merge pull request #146 from TeslaK20/master
makermelissa Mar 12, 2021
e97875e
Add support for Raspberry Pi Model B Rev 2 (0004)
NathanY3G Mar 21, 2021
23121c6
Merge pull request #148 from NathanY3G/support-older-rpi-model-b-rev2
makermelissa Mar 21, 2021
8a40e3d
Merge remote-tracking branch 'upstream/master'
fharding1 Mar 29, 2021
59edca9
Merge pull request #149 from tigard-tools/master
makermelissa Apr 5, 2021
1ea89bd
add pico u2if
caternuson Apr 20, 2021
54358c4
Merge pull request #152 from caternuson/pico_u2if
ladyada Apr 20, 2021
dde8a23
Adding support for Allwiner D1 with XuanTie C906
Apr 22, 2021
c9255ed
assignment error
Apr 22, 2021
98ee83b
Merge pull request #153 from fede2cr/master
makermelissa Apr 22, 2021
d720af9
Adding support for the BeagleV Starfive, chip VIC-U7
Apr 26, 2021
be12509
Fixing beagle id
Apr 26, 2021
dd3057d
Adding support for the BeagleV Starfive, chip VIC-U7
Apr 26, 2021
cf626be
Adding support for the BeagleV Starfive, chip VIC-U7
Apr 26, 2021
994e122
Fixing dup VIC-U7 elifs
Apr 26, 2021
e334f66
Swapped boards. Beagle is VIC, Allwinner y D1
Apr 26, 2021
31a4811
Merge pull request #154 from fede2cr/master
makermelissa Apr 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,18 @@ def id(self):
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):
board_id = self._tegra_id()
elif chip_id == chips.HFU540:
board_id = self._sifive_id()
elif chip_id == chips.C906:
board_id = self._allwinner_id()
elif chip_id == chips.VICU7:
board_id = self.__beaglebone_id()
elif chip_id == chips.MCP2221:
board_id = boards.MICROCHIP_MCP2221
elif chip_id == chips.BINHO:
Expand All @@ -135,6 +141,8 @@ def id(self):
board_id = self._clockwork_pi_id()
elif chip_id == chips.RK3308:
board_id = self._rock_pi_id()
elif chip_id == chips.RK3399:
board_id = self._rock_pi_id()
elif chip_id == chips.ATOM_X5_Z8350:
board_id = self._rock_pi_id()
elif chip_id == chips.RK3288:
Expand All @@ -147,6 +155,8 @@ def id(self):
board_id = self._stm32mp1_id()
elif chip_id == chips.MT8167:
board_id = boards.CORAL_EDGE_TPU_DEV_MINI
elif chip_id == chips.PICO_U2IF:
board_id = boards.PICO_U2IF

self._board_id = board_id
return board_id
Expand Down Expand Up @@ -232,6 +242,11 @@ def _beaglebone_id(self):
if id_string == bb_id[1]:
return model

board_value = self.detector.get_armbian_release_field("BOARD")

if board_value == "freedom-u74-arty":
return boards.BEAGLEV_STARFIV

return None

# pylint: enable=no-self-use
Expand Down Expand Up @@ -300,6 +315,8 @@ def _stm32mp1_id(self):
return boards.STM32MP157C_DK2
if "LubanCat" in board_value:
return boards.LUBANCAT_STM32MP157
if "OSD32MP1-BRK" in board_value:
return boards.OSD32MP1_BRK
return None

def _imx8mx_id(self):
Expand Down Expand Up @@ -334,6 +351,13 @@ def _sifive_id(self):
return boards.SIFIVE_UNLEASHED
return None

def _allwinner_id(self):
"""Try to detect the id for Allwiner D1 board."""
board_value = self.detector.get_device_model()
if "sun20iw1p1" in board_value:
return boards.ALLWINER_D1
return None

def _pine64_id(self):
"""Try to detect the id for Pine64 board or device."""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -372,6 +396,8 @@ def _rock_pi_id(self):
board = None
if board_value and "ROCK Pi S" in board_value:
board = boards.ROCK_PI_S
if board_value and "ROCK PI 4" in board_value.upper():
board = boards.ROCK_PI_4
if self.detector.check_board_name_value() == "ROCK Pi X":
board = boards.ROCK_PI_X
return board
Expand Down Expand Up @@ -486,8 +512,8 @@ def any_pine64_board(self):

@property
def any_rock_pi_board(self):
"""Check whether the current board is any Clockwork Pi device."""
return self.ROCK_PI_S
"""Check whether the current board is any Rock Pi device."""
return self.id in boards._ROCK_PI_IDS

@property
def any_clockwork_pi_board(self):
Expand Down Expand Up @@ -541,11 +567,21 @@ def ftdi_ft232h(self):
"""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."""
return self.id == boards.MICROCHIP_MCP2221

@property
def pico_u2if(self):
"""Check whether the current board is a RPi Pico w/ u2if."""
return self.id == boards.PICO_U2IF

@property
def binho_nova(self):
"""Check whether the current board is an BINHO NOVA."""
Expand Down
33 changes: 33 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ def id(
)
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

Expand All @@ -95,6 +107,18 @@ def id(
"BLINKA_MCP2221 environment variable "
+ "set, but no MCP2221 device found"
)
if os.environ.get("BLINKA_PICO_U2IF"):
import hid

# look for it based on PID/VID
for dev in hid.enumerate():
if dev["vendor_id"] == 0xCAFE and dev["product_id"] == 0x4005:
self._chip_id = chips.PICO_U2IF
return self._chip_id
raise RuntimeError(
"BLINKA_PICO_U2IF environment variable "
+ "set, but no Pico device found"
)
if os.environ.get("BLINKA_GREATFET"):
import usb

Expand Down Expand Up @@ -138,12 +162,21 @@ def _linux_id(self):
if self.detector.check_dt_compatible_value("fu500"):
return chips.HFU540

if self.detector.check_dt_compatible_value("sun20iw1p1"):
return chips.C906

if self.detector.check_dt_compatible_value("sifive"):
return chips.VICU7

if self.detector.check_dt_compatible_value("sun8i-a33"):
return chips.A33

if self.detector.check_dt_compatible_value("rockchip,rk3308"):
return chips.RK3308

if self.detector.check_dt_compatible_value("rockchip,rk3399"):
return chips.RK3399

if self.detector.check_dt_compatible_value("rockchip,rk3288"):
return chips.RK3288

Expand Down
18 changes: 18 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
BEAGLEBONE_AIR = "BEAGLEBONE_AIR"
BEAGLEBONE_AI = "BEAGLEBONE_AI"
BEAGLEBONE_POCKETBONE = "BEAGLEBONE_POCKETBONE"
BEAGLEV_STARFIV = "BEAGLEV_STARFIVE"
BEAGLELOGIC_STANDALONE = "BEAGLELOGIC_STANDALONE"
OSD3358_DEV_BOARD = "OSD3358_DEV_BOARD"
OSD3358_SM_RED = "OSD3358_SM_RED"
Expand Down Expand Up @@ -54,6 +55,7 @@
# NVIDIA Jetson boards
JETSON_TX1 = "JETSON_TX1"
JETSON_TX2 = "JETSON_TX2"
JETSON_TX2_NX = "JETSON_TX2_NX"
CLARA_AGX_XAVIER = "CLARA_AGX_XAVIER"
JETSON_XAVIER = "JETSON_XAVIER"
JETSON_NANO = "JETSON_NANO"
Expand All @@ -69,6 +71,7 @@

# STM32 MPU boards
STM32MP157C_DK2 = "STM32MP157C_DK2"
OSD32MP1_BRK = "OSD32MP1_BRK"

# Embedfire LubanCat board
LUBANCAT_IMX6ULL = "LUBANCAT_IMX6ULL"
Expand Down Expand Up @@ -102,12 +105,19 @@
ODROID_XU4 = "ODROID_XU4"

FTDI_FT232H = "FTDI_FT232H"
FTDI_FT2232H = "FTDI_FT2232H"
DRAGONBOARD_410C = "DRAGONBOARD_410C"

SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"

ALLWINER_D1 = "ALLWINER_D1"

MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"

# Raspberry Pi Pico with u2if firmware
# https://github.com/execuc/u2if
PICO_U2IF = "PICO_U2IF"

BINHO_NOVA = "BINHO_NOVA"

ONION_OMEGA = "ONION_OMEGA"
Expand All @@ -120,6 +130,7 @@
SOPINE = "SOPINE"

ROCK_PI_S = "ROCK_PI_S"
ROCK_PI_4 = "ROCK_PI_4"
ROCK_PI_X = "ROCK_PI_X"

GREATFET_ONE = "GREATFET_ONE"
Expand All @@ -136,6 +147,7 @@
_STM32MP1_IDS = (
STM32MP157C_DK2,
LUBANCAT_STM32MP157,
OSD32MP1_BRK,
)

# OrangePI
Expand Down Expand Up @@ -195,6 +207,7 @@
"nvidia,storm",
),
),
(JETSON_TX2_NX, ("nvidia,p3509-0000+p3636-0001",)),
(CLARA_AGX_XAVIER, ("nvidia,e3900-0000+p2888-0004",)),
(
JETSON_XAVIER,
Expand Down Expand Up @@ -337,6 +350,7 @@
"1000003",
),
RASPBERRY_PI_B_REV2: (
"0004",
"0005",
"0006",
"000d",
Expand Down Expand Up @@ -442,6 +456,7 @@
RASPBERRY_PI_CM4: (
"a03140",
"b03140",
"c03140",
),
}

Expand All @@ -451,5 +466,8 @@
# Pine64 boards and devices
_PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE, SOPINE)

# RockPi boards and devices
_ROCK_PI_IDS = (ROCK_PI_S, ROCK_PI_4, ROCK_PI_X)

# UDOO
_UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",), UDOO_X86: ("dummy",)}
5 changes: 5 additions & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
APQ8016 = "APQ8016"
GENERIC_X86 = "GENERIC_X86"
FT232H = "FT232H"
FT2232H = "FT2232H"
HFU540 = "HFU540"
C906 = "C906"
VICU7 = "VICU7"
MCP2221 = "MCP2221"
BINHO = "BINHO"
MIPS24KC = "MIPS24KC"
Expand All @@ -33,12 +36,14 @@
H5 = "H5"
H616 = "H616"
RK3308 = "RK3308"
RK3399 = "RK3399"
LPC4330 = "LPC4330"
RK3288 = "RK3288"
PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core
STM32F405 = "STM32F405"
STM32MP157 = "STM32MP157"
MT8167 = "MT8167"
ATOM_X5_Z8350 = "X5-Z8350"
PICO_U2IF = "PICO_U2IF"

BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}
4 changes: 3 additions & 1 deletion bin/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
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,
| detector.board.GREATFET_ONE
| detector.board.PICO_U2IF,
)

if detector.board.any_raspberry_pi:
Expand Down