Skip to content
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

Add support for LubanCat-4 #307

Merged
merged 3 commits into from
Aug 29, 2023
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
17 changes: 15 additions & 2 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, detector) -> None:
self.detector = detector
self._board_id = None

# pylint: disable=invalid-name, protected-access, too-many-return-statements
# pylint: disable=invalid-name, protected-access, too-many-return-statements, too-many-lines
@property
def id(self) -> Optional[str]:
"""Return a unique id for the detected board, if any."""
Expand Down Expand Up @@ -177,7 +177,12 @@ def id(self) -> Optional[str]:
elif chip_id == chips.RK3568:
board_id = self._rk3568_id()
elif chip_id == chips.RK3588:
board_id = self._rock_pi_id() or self._orange_pi_id() or self._armbian_id()
board_id = (
self._rock_pi_id()
or self._orange_pi_id()
or self._armbian_id()
or self._rk3588_id()
)
elif chip_id == chips.RYZEN_V1605B:
board_id = self._udoo_id()
elif chip_id == chips.PENTIUM_N3710:
Expand Down Expand Up @@ -559,6 +564,14 @@ def _rk3568_id(self) -> Optional[str]:
board = boards.ROCK_PI_3A
return board

def _rk3588_id(self) -> Optional[str]:
"""Check what type of rk3588 board."""
board_value = self.detector.get_device_model()
board = None
if board_value and "LubanCat-4" in board_value:
board = boards.LUBANCAT4
return board

def _rock_pi_id(self) -> Optional[str]:
"""Check what type of Rock Pi board."""
board_value = self.detector.get_device_model()
Expand Down
2 changes: 2 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
LUBANCAT_ZERO = "LUBANCAT_ZERO"
LUBANCAT1 = "LUBANCAT1"
LUBANCAT2 = "LUBANCAT2"
LUBANCAT4 = "LUBANCAT4"

# Various Raspberry Pi models
RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1"
Expand Down Expand Up @@ -273,6 +274,7 @@
LUBANCAT_ZERO,
LUBANCAT1,
LUBANCAT2,
LUBANCAT4,
)

# Coral boards
Expand Down