Skip to content

Commit 8339fbf

Browse files
committed
add 96Boards DragonBoard410c
- We use /proc/device-tree/compatible and /proc/device-tree/model to detect chip and board - created get_dt_compatible_field to read said file and compare string - added dragonboard410c as an example Signed-off-by: Sahaj Sarup <[email protected]>
1 parent a97afcd commit 8339fbf

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

adafruit_platformdetect/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ def get_cpuinfo_field(self, field):
5555

5656
return None
5757

58+
def get_dt_compatible_field(self, field):
59+
"""
60+
Search /proc/device-tree/compatible for a field and return True, if found,
61+
otherwise False.
62+
"""
63+
# Match a value like 'qcom,apq8016-sbc':
64+
if field in open('/proc/device-tree/compatible').read():
65+
return True
66+
67+
return False
68+
5869
def get_armbian_release_field(self, field):
5970
"""
6071
Search /etc/armbian-release, if it exists, for a field and return its

adafruit_platformdetect/board.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
RASPBERRY_PI_3B_PLUS = "RASPBERRY_PI_3B_PLUS"
3939
RASPBERRY_PI_CM3 = "RASPBERRY_PI_CM3"
4040
RASPBERRY_PI_3A_PLUS = "RASPBERRY_PI_3A_PLUS"
41+
42+
_96BOARDS = "96BOARDS"
4143
# pylint: enable=bad-whitespace
4244

4345
ANY_RASPBERRY_PI_2_OR_3 = (
@@ -156,6 +158,7 @@ def id(self):
156158
board_id = FEATHER_M0_EXPRESS
157159
elif chip_id == ap_chip.STM32:
158160
board_id = PYBOARD
161+
else board_id = self._is_96boards()
159162

160163
return board_id
161164
# pylint: enable=invalid-name
@@ -202,6 +205,11 @@ def _beaglebone_id(self):
202205
return None
203206
# pylint: enable=no-self-use
204207

208+
def _is_96Boards(self):
209+
if self.detector.get_dt_compatible_field("qcom,apq8016-sbc") or self.detector.get_dt_compatible_field("hisilicon,hi3660-hikey960") or self.detector.get_dt_compatible_field("hisilicon,hi6220-hikey"):
210+
return _96BOARDS
211+
return None
212+
205213
def _armbian_id(self):
206214
"""Check whether the current board is an OrangePi PC."""
207215
board_value = self.detector.get_armbian_release_field('BOARD')

adafruit_platformdetect/chip.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
SAMD21 = "SAMD21"
88
STM32 = "STM32"
99
SUN8I = "SUN8I"
10+
APQ8016 = "APQ8016"
1011
GENERIC_X86 = "GENERIC_X86"
1112

1213
class Chip:
@@ -36,10 +37,14 @@ def _linux_id(self):
3637

3738
hardware = self.detector.get_cpuinfo_field("Hardware")
3839

40+
if self.detector.get_dt_compatible_field("qcom,apq8016"):
41+
linux_id = APQ8016
42+
return linux_id
43+
3944
if hardware is None:
40-
vendor_id = self.detector.get_cpuinfo_field("vendor_id")
41-
if vendor_id in ("GenuineIntel", "AuthenticAMD"):
42-
linux_id = GENERIC_X86
45+
if vendor_id == self.detector.get_cpuinfo_field("vendor_id"):
46+
if vendor_id in ("GenuineIntel", "AuthenticAMD"):
47+
linux_id = GENERIC_X86
4348
elif hardware in ("BCM2708", "BCM2708", "BCM2835"):
4449
linux_id = BCM2XXX
4550
elif "AM33XX" in hardware:

0 commit comments

Comments
 (0)