From 0d5dd9eb49b1f852202aa052e7c6e3d3bd2dc04e Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 5 Jun 2019 09:32:15 -0700 Subject: [PATCH] Improved Odroid C2 Detection --- adafruit_platformdetect/board.py | 7 ++++++- adafruit_platformdetect/chip.py | 2 ++ bin/detect.py | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index c15f20aa..8b631e5f 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -402,6 +402,11 @@ def any_giant_board(self): """Check whether the current board is any defined Giant Board.""" return self.GIANT_BOARD + @property + def any_odroid_40_pin(self): + """Check whether the current board is any defined 40-pin Odroid.""" + return self.id in _ODROID_40_PIN_IDS + @property def any_jetson_board(self): """Check whether the current board is any defined Jetson Board.""" @@ -412,7 +417,7 @@ def any_embedded_linux(self): """Check whether the current board is any embedded Linux device.""" return self.any_raspberry_pi or self.any_beaglebone or \ self.any_orange_pi or self.any_giant_board or self.any_jetson_board or \ - self.any_coral_board + self.any_coral_board or self.any_odroid_40_pin def __getattr__(self, attr): """ diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 006e1647..2f6f6b70 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -92,6 +92,8 @@ def _linux_id(self): # pylint: disable=too-many-branches linux_id = T194 if compatible and 'imx8m' in compatible: linux_id = IMX8MX + if compatible and 'odroid-c2' in compatible: + linux_id = S905 elif hardware in ("BCM2708", "BCM2709", "BCM2835"): linux_id = BCM2XXX diff --git a/bin/detect.py b/bin/detect.py index ac62cdb4..6c5a3459 100755 --- a/bin/detect.py +++ b/bin/detect.py @@ -11,7 +11,6 @@ print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS) print("Is this a 40-pin Raspberry Pi?", detector.board.any_raspberry_pi_40_pin) print("Is this a BBB?", detector.board.BEAGLEBONE_BLACK) -print("Is this an Orange Pi PC?", detector.board.ORANGE_PI_PC) print("Is this a Giant Board?", detector.board.GIANT_BOARD) print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV) print("Is this an embedded Linux system?", detector.board.any_embedded_linux) @@ -21,4 +20,10 @@ print("Raspberry Pi detected.") if detector.board.any_jetson_board: - print("Jetson platform detected.") \ No newline at end of file + print("Jetson platform detected.") + +if detector.board.any_orange_pi: + print("Orange Pi detected.") + +if detector.board.any_odroid_40_pin: + print("Odroid detected.")