Skip to content

Commit c93449d

Browse files
authored
Merge pull request #64 from swarren/jetson-nx
Add support for NVIDIA Jetson NX
2 parents a174e7c + f806976 commit c93449d

File tree

3 files changed

+43
-20
lines changed

3 files changed

+43
-20
lines changed

adafruit_platformdetect/board.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,17 +204,14 @@ def _imx8mx_id(self):
204204

205205
def _tegra_id(self):
206206
"""Try to detect the id of aarch64 board."""
207-
board_value = self.detector.get_device_model()
208-
board = None
209-
if 'tx1' in board_value.lower():
210-
board = boards.JETSON_TX1
211-
elif 'quill' in board_value or "storm" in board_value or "lightning" in board_value:
212-
board = boards.JETSON_TX2
213-
elif 'xavier' in board_value.lower() or 'agx' in board_value.lower():
214-
board = boards.JETSON_XAVIER
215-
elif 'nano' in board_value.lower():
216-
board = boards.JETSON_NANO
217-
return board
207+
compatible = self.detector.get_device_compatible()
208+
if not compatible:
209+
return None
210+
compats = compatible.split('\x00')
211+
for board_id, board_compats in boards._JETSON_IDS.items():
212+
if any(v in compats for v in board_compats):
213+
return board_id
214+
return None
218215

219216
def _sifive_id(self):
220217
"""Try to detect the id for Sifive RISCV64 board."""

adafruit_platformdetect/chip.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ def _linux_id(self): # pylint: disable=too-many-branches,too-many-statements
7474

7575
compatible = self.detector.get_device_compatible()
7676
if compatible and 'tegra' in compatible:
77-
if 'cv' in compatible or 'nano' in compatible:
77+
compats = compatible.split('\x00')
78+
if 'nvidia,tegra210' in compats:
7879
linux_id = chips.T210
79-
elif 'quill' in compatible:
80+
elif 'nvidia,tegra186' in compats:
8081
linux_id = chips.T186
81-
elif 'xavier' in compatible:
82+
elif 'nvidia,tegra194' in compats:
8283
linux_id = chips.T194
8384
if compatible and 'imx8m' in compatible:
8485
linux_id = chips.IMX8MX

adafruit_platformdetect/constants/boards.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
JETSON_TX2 = 'JETSON_TX2'
3939
JETSON_XAVIER = 'JETSON_XAVIER'
4040
JETSON_NANO = 'JETSON_NANO'
41+
JETSON_NX = 'JETSON_NX'
4142

4243
# Google Coral dev board
4344
CORAL_EDGE_TPU_DEV = "CORAL_EDGE_TPU_DEV"
@@ -97,12 +98,36 @@
9798
CORAL_EDGE_TPU_DEV,
9899
)
99100

100-
_JETSON_IDS = (
101-
JETSON_TX1,
102-
JETSON_TX2,
103-
JETSON_XAVIER,
104-
JETSON_NANO
105-
)
101+
_JETSON_IDS = {
102+
JETSON_TX1: (
103+
'nvidia,p2371-2180',
104+
'nvidia,jetson-cv',
105+
),
106+
JETSON_TX2: (
107+
'nvidia,p2771-0000',
108+
'nvidia,p2771-0888',
109+
'nvidia,p3489-0000',
110+
'nvidia,lightning',
111+
'nvidia,quill',
112+
'nvidia,storm',
113+
),
114+
JETSON_XAVIER: (
115+
'nvidia,p2972-0000',
116+
'nvidia,p2972-0006',
117+
'nvidia,jetson-xavier',
118+
),
119+
JETSON_NANO: (
120+
'nvidia,p3450-0000',
121+
'nvidia,p3450-0002',
122+
'nvidia,jetson-nano',
123+
),
124+
JETSON_NX: (
125+
'nvidia,p3509-0000+p3668-0000',
126+
'nvidia,p3509-0000+p3668-0001',
127+
'nvidia,p3449-0000+p3668-0000',
128+
'nvidia,p3449-0000+p3668-0001',
129+
),
130+
}
106131

107132
_RASPBERRY_PI_40_PIN_IDS = (
108133
RASPBERRY_PI_B_PLUS,

0 commit comments

Comments
 (0)