Skip to content

Commit 7001c3b

Browse files
committed
Addition of onion omega board running OpenWRT
1 parent b9c0541 commit 7001c3b

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

adafruit_platformdetect/board.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070

7171
BINHO_NOVA = "BINHO_NOVA"
7272

73+
ONION_OMEGA = "ONION_OMEGA"
74+
ONION_OMEGA2 = "ONION_OMEGA2"
75+
7376
# pylint: enable=bad-whitespace
7477

7578
#OrangePI
@@ -288,6 +291,12 @@
288291
),
289292
}
290293

294+
# Onion omega boards
295+
_ONION_OMEGA_BOARD_IDS = (
296+
ONION_OMEGA,
297+
ONION_OMEGA2,
298+
)
299+
291300
class Board:
292301
"""Attempt to detect specific boards."""
293302
def __init__(self, detector):
@@ -343,6 +352,8 @@ def id(self):
343352
board_id = MICROCHIP_MCP2221
344353
elif chip_id == ap_chip.BINHO:
345354
board_id = BINHO_NOVA
355+
elif chip_id == ap_chip.ONION:
356+
board_id = ONION_OMEGA
346357
return board_id
347358
# pylint: enable=invalid-name
348359

@@ -489,13 +500,18 @@ def any_sifive_board(self):
489500
"""Check whether the current board is any defined Jetson Board."""
490501
return self.id in _SIFIVE_IDS
491502

503+
@property
504+
def any_onion_omega_board(self):
505+
"""Check whether the current board is any defined OpenWRT board."""
506+
return self.id in _ONION_OMEGA_BOARD_IDS
507+
492508
@property
493509
def any_embedded_linux(self):
494510
"""Check whether the current board is any embedded Linux device."""
495511
return self.any_raspberry_pi or self.any_beaglebone or \
496512
self.any_orange_pi or self.any_giant_board or self.any_jetson_board or \
497513
self.any_coral_board or self.any_odroid_40_pin or self.any_96boards or \
498-
self.any_sifive_board
514+
self.any_sifive_board or self.any_onion_omega_board
499515

500516
@property
501517
def ftdi_ft232h(self):

adafruit_platformdetect/chip.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
HFU540 = "HFU540"
2323
MCP2221 = "MCP2221"
2424
BINHO = "BINHO"
25+
ONION = "ONION_OMEGA"
2526

2627
class Chip:
2728
"""Attempt detection of current chip / CPU."""
@@ -103,6 +104,11 @@ def _linux_id(self): # pylint: disable=too-many-branches
103104
if compatible and 'amlogic, g12b' in compatible:
104105
linux_id = S922X
105106

107+
machine = self.detector.get_cpuinfo_field("machine")
108+
109+
if machine in ("Onion Omega", "Onion Omega2"):
110+
linux_id = ONION
111+
106112
elif hardware in ("BCM2708", "BCM2709", "BCM2835"):
107113
linux_id = BCM2XXX
108114
elif "AM33XX" in hardware:

bin/detect.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@
3333

3434
if detector.board.any_odroid_40_pin:
3535
print("Odroid detected.")
36+
37+
if detector.board.any_onion_omega_board:
38+
print("Onion Omega detected.")

0 commit comments

Comments
 (0)