Skip to content

Added Siemens Simatic IOT2050 Basic/Advanced #249

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 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def id(self) -> Optional[str]:
board_id = self._pi_id()
elif chip_id == chips.AM33XX:
board_id = self._beaglebone_id()
elif chip_id == chips.AM65XX:
board_id = self._siemens_simatic_iot2000_id()
elif chip_id == chips.DRA74X:
board_id = self._bbai_id()
elif chip_id == chips.SUN8I:
Expand Down Expand Up @@ -541,6 +543,21 @@ def _rp2040_u2if_id(self) -> Optional[str]:
# Will only reach here if a device was added in chip.py but here.
raise RuntimeError("RP2040_U2IF device was added to chip but not board.")

def _siemens_simatic_iot2000_id(self) -> Optional[str]:
"""Try to detect if this is a IOT2050 Gateway."""
board_value = self.detector.get_device_model()
board = None
if board_value and "SIMATIC IOT2050 Advanced" in board_value:
board = boards.SIEMENS_SIMATIC_IOT2050_ADV
elif board_value and "SIMATIC IOT2050 Basic" in board_value:
board = boards.SIEMENS_SIMATIC_IOT2050_BASIC
return board

@property
def any_siemens_simatic_iot2000(self) -> bool:
"""Check whether the current board is a SIEMENS SIMATIC IOT2000 Gateway."""
return self.id in boards._SIEMENS_SIMATIC_IOT2000_IDS

@property
def any_nanopi(self) -> bool:
"""Check whether the current board is any defined Nano Pi."""
Expand Down Expand Up @@ -700,6 +717,7 @@ def any_embedded_linux(self) -> bool:
self.any_bananapi,
self.any_maaxboard,
self.any_tisk_board,
self.any_siemens_simatic_iot2000,
self.any_lichee_riscv_board,
]
)
Expand Down
5 changes: 5 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ def _linux_id(self) -> Optional[str]:
# pylint: disable=too-many-branches,too-many-statements
# pylint: disable=too-many-return-statements
"""Attempt to detect the CPU on a computer running the Linux kernel."""
if self.detector.check_dt_compatible_value("ti,am654"):
return chips.AM65XX

if self.detector.check_dt_compatible_value("ti,am652"):
return chips.AM65XX

if self.detector.check_dt_compatible_value("amlogic,g12a"):
return chips.S905Y2
Expand Down
10 changes: 10 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,3 +524,13 @@

# Lichee RISC-V boards
_LICHEE_RISCV_IDS = (LICHEE_RV,)

# Siemens Simatic IOT2000 Gateways
SIEMENS_SIMATIC_IOT2050_ADV = "SIEMENS_SIMATIC_IOT2050_ADVANCED"
SIEMENS_SIMATIC_IOT2050_BASIC = "SIEMENS_SIMATIC_IOT2050_BASIC"

# Siemens Simatic IOT2000 Gateways
_SIEMENS_SIMATIC_IOT2000_IDS = (
SIEMENS_SIMATIC_IOT2050_ADV,
SIEMENS_SIMATIC_IOT2050_BASIC,
)
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""Definition of chips."""
A311D = "A311D"
AM33XX = "AM33XX"
AM65XX = "AM65XX"
DRA74X = "DRA74X"
TDA4VM = "TDA4VM"
IMX6ULL = "IMX6ULL"
Expand Down