Skip to content

Commit ea71d32

Browse files
authored
Merge pull request #228 from BytEvil/main
Add Khadas VIM3 board detection.
2 parents a65c30c + 1cf970a commit ea71d32

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

adafruit_platformdetect/board.py

+8
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def id(self) -> Optional[str]:
9292
board_id = boards.ODROID_C4
9393
elif chip_id == chips.S922X:
9494
board_id = boards.ODROID_N2
95+
elif chip_id == chips.A311D:
96+
board_id = boards.KHADAS_VIM3
9597
elif chip_id == chips.EXYNOS5422:
9698
board_id = boards.ODROID_XU4
9799
elif chip_id == chips.FT232H:
@@ -573,6 +575,11 @@ def any_odroid_40_pin(self) -> bool:
573575
"""Check whether the current board is any defined 40-pin Odroid."""
574576
return self.id in boards._ODROID_40_PIN_IDS
575577

578+
@property
579+
def khadas_vim3_40_pin(self) -> bool:
580+
"""Check whether the current board is any defined 40-pin Khadas VIM3."""
581+
return self.id in boards._KHADAS_40_PIN_IDS
582+
576583
@property
577584
def any_jetson_board(self) -> bool:
578585
"""Check whether the current board is any defined Jetson Board."""
@@ -647,6 +654,7 @@ def any_embedded_linux(self) -> bool:
647654
self.any_jetson_board,
648655
self.any_coral_board,
649656
self.any_odroid_40_pin,
657+
self.khadas_vim3_40_pin,
650658
self.any_96boards,
651659
self.any_sifive_board,
652660
self.any_onion_omega_board,

adafruit_platformdetect/chip.py

+7
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ def _linux_id(self) -> Optional[str]:
200200
if self.detector.check_dt_compatible_value("rockchip,rk3328"):
201201
return chips.RK3328
202202

203+
if self.detector.check_dt_compatible_value("amlogic,a311d"):
204+
return chips.A311D
205+
203206
if self.detector.check_dt_compatible_value("st,stm32mp157"):
204207
return chips.STM32MP157
205208

@@ -276,6 +279,8 @@ def _linux_id(self) -> Optional[str]:
276279
return chips.S922X
277280
if "sm1" in compatible_list:
278281
return chips.S905X3
282+
if "vim3amlogic" in compatible_list:
283+
return chips.A311D
279284
if compatible and "sun50i-a64" in compatible:
280285
linux_id = chips.A64
281286
if compatible and "sun50i-h6" in compatible:
@@ -318,6 +323,8 @@ def _linux_id(self) -> Optional[str]:
318323
linux_id = chips.S905X3
319324
elif "ODROID-XU4" in hardware:
320325
linux_id = chips.EXYNOS5422
326+
elif "KHADAS-VIM3" in hardware:
327+
linux_id = chips.A311D
321328
elif "SAMA5" in hardware:
322329
linux_id = chips.SAMA5
323330
elif "Pinebook" in hardware:

adafruit_platformdetect/constants/boards.py

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@
162162
MAAXBOARD = "MAAXBOARD"
163163
MAAXBOARD_MINI = "MAAXBOARD_MINI"
164164

165+
# Khadas VIM3
166+
KHADAS_VIM3 = "KHADAS_VIM3"
167+
168+
_KHADAS_40_PIN_IDS = (KHADAS_VIM3,)
169+
165170
# Asus Tinkerboard
166171
_ASUS_TINKER_BOARD_IDS = (ASUS_TINKER_BOARD,)
167172

adafruit_platformdetect/constants/chips.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
"""Definition of chips."""
6+
A311D = "A311D"
67
AM33XX = "AM33XX"
78
DRA74X = "DRA74X"
89
TDA4VM = "TDA4VM"

bin/detect.py

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
print("Is this a PYNQ Board?", detector.board.PYNQ_Z1 | detector.board.PYNQ_Z2)
4545
print("Is this a Rock Pi board?", detector.board.any_rock_pi_board)
4646
print("Is this a NanoPi board?", detector.board.any_nanopi)
47+
print("Is this a Khadas VIM3 board?", detector.board.KHADAS_VIM3)
4748
print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board)
4849
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
4950
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
@@ -83,6 +84,9 @@
8384
if detector.board.any_odroid_40_pin:
8485
print("Odroid detected.")
8586

87+
if detector.board.khadas_vim3_40_pin:
88+
print("Khadas VIM3 detected.")
89+
8690
if detector.board.any_onion_omega_board:
8791
print("Onion Omega detected.")
8892

0 commit comments

Comments
 (0)