Skip to content

Commit 718ecbe

Browse files
authored
Merge pull request #249 from SIMATICmeetsLinux/main
Added Siemens Simatic IOT2050 Basic/Advanced
2 parents 212b754 + 3be4b59 commit 718ecbe

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

adafruit_platformdetect/board.py

+18
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def id(self) -> Optional[str]:
6767
board_id = self._pi_id()
6868
elif chip_id == chips.AM33XX:
6969
board_id = self._beaglebone_id()
70+
elif chip_id == chips.AM65XX:
71+
board_id = self._siemens_simatic_iot2000_id()
7072
elif chip_id == chips.DRA74X:
7173
board_id = self._bbai_id()
7274
elif chip_id == chips.SUN8I:
@@ -541,6 +543,21 @@ def _rp2040_u2if_id(self) -> Optional[str]:
541543
# Will only reach here if a device was added in chip.py but here.
542544
raise RuntimeError("RP2040_U2IF device was added to chip but not board.")
543545

546+
def _siemens_simatic_iot2000_id(self) -> Optional[str]:
547+
"""Try to detect if this is a IOT2050 Gateway."""
548+
board_value = self.detector.get_device_model()
549+
board = None
550+
if board_value and "SIMATIC IOT2050 Advanced" in board_value:
551+
board = boards.SIEMENS_SIMATIC_IOT2050_ADV
552+
elif board_value and "SIMATIC IOT2050 Basic" in board_value:
553+
board = boards.SIEMENS_SIMATIC_IOT2050_BASIC
554+
return board
555+
556+
@property
557+
def any_siemens_simatic_iot2000(self) -> bool:
558+
"""Check whether the current board is a SIEMENS SIMATIC IOT2000 Gateway."""
559+
return self.id in boards._SIEMENS_SIMATIC_IOT2000_IDS
560+
544561
@property
545562
def any_nanopi(self) -> bool:
546563
"""Check whether the current board is any defined Nano Pi."""
@@ -700,6 +717,7 @@ def any_embedded_linux(self) -> bool:
700717
self.any_bananapi,
701718
self.any_maaxboard,
702719
self.any_tisk_board,
720+
self.any_siemens_simatic_iot2000,
703721
self.any_lichee_riscv_board,
704722
]
705723
)

adafruit_platformdetect/chip.py

+5
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ def _linux_id(self) -> Optional[str]:
166166
# pylint: disable=too-many-branches,too-many-statements
167167
# pylint: disable=too-many-return-statements
168168
"""Attempt to detect the CPU on a computer running the Linux kernel."""
169+
if self.detector.check_dt_compatible_value("ti,am654"):
170+
return chips.AM65XX
171+
172+
if self.detector.check_dt_compatible_value("ti,am652"):
173+
return chips.AM65XX
169174

170175
if self.detector.check_dt_compatible_value("amlogic,g12a"):
171176
return chips.S905Y2

adafruit_platformdetect/constants/boards.py

+10
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,13 @@
524524

525525
# Lichee RISC-V boards
526526
_LICHEE_RISCV_IDS = (LICHEE_RV,)
527+
528+
# Siemens Simatic IOT2000 Gateways
529+
SIEMENS_SIMATIC_IOT2050_ADV = "SIEMENS_SIMATIC_IOT2050_ADVANCED"
530+
SIEMENS_SIMATIC_IOT2050_BASIC = "SIEMENS_SIMATIC_IOT2050_BASIC"
531+
532+
# Siemens Simatic IOT2000 Gateways
533+
_SIEMENS_SIMATIC_IOT2000_IDS = (
534+
SIEMENS_SIMATIC_IOT2050_ADV,
535+
SIEMENS_SIMATIC_IOT2050_BASIC,
536+
)

adafruit_platformdetect/constants/chips.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""Definition of chips."""
66
A311D = "A311D"
77
AM33XX = "AM33XX"
8+
AM65XX = "AM65XX"
89
DRA74X = "DRA74X"
910
TDA4VM = "TDA4VM"
1011
IMX6ULL = "IMX6ULL"

0 commit comments

Comments
 (0)