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 Vivid Unit Detection #362

Merged
merged 1 commit into from
Jun 17, 2024
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: 16 additions & 1 deletion adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def id(self) -> Optional[str]:
or self._armbian_id()
or self._diet_pi_id()
or self._asus_tinker_board_id()
or self._vivid_unit_id()
)
elif chip_id == chips.RK3399PRO:
board_id = self._asus_tinker_board_id()
Expand Down Expand Up @@ -712,6 +713,14 @@ def _asus_tinker_board_id(self) -> Optional[str]:

return board

def _vivid_unit_id(self) -> Optional[str]:
"""Check what type of vivid unit."""
board_value = self.detector.get_device_model()
board = None
if board_value and "RK3399 VIVID" in board_value:
board = boards.VIVID_UNIT
return board

def _pcduino_board_id(self) -> Optional[str]:
"""Check on the type of Pcduino"""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -1023,7 +1032,7 @@ def any_nxp_navq_board(self) -> bool:

@property
def any_olimex_board(self):
"""Check whether the current board is any Pine64 device."""
"""Check whether the current board is any Olimex device."""
return self.id in boards._OLIMEX_IDS

@property
Expand All @@ -1036,6 +1045,11 @@ def any_luckfox_pico_board(self):
"""Check whether the current board is any Luckfox Pico device."""
return self.id in boards._LUCKFOX_IDS

@property
def any_vivid_unit(self):
"""Check whether the current board is any Vivid Unit device."""
return self.id in boards._VIVID_UNIT_IDS

@property
def os_environ_board(self) -> bool:
"""Check whether the current board is an OS environment variable special case."""
Expand Down Expand Up @@ -1103,6 +1117,7 @@ def lazily_generate_conditions():
yield self.any_repka_board
yield self.any_milkv_board
yield self.any_luckfox_pico_board
yield self.any_vivid_unit

return any(condition for condition in lazily_generate_conditions())

Expand Down
5 changes: 5 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@

_KHADAS_40_PIN_IDS = (KHADAS_VIM3,)

# Vivid Unit
VIVID_UNIT = "VIVID_UNIT"

_VIVID_UNIT_IDS = (VIVID_UNIT,)

# Luckfox Pico boards
LUCKFOX_PICO = "LUCKFOX_PICO"
LUCKFOX_PICO_MAX = "LUCKFOX_PICO_MAX"
Expand Down
Loading