Skip to content

Added Rock Pi S #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,attribute-defined-outside-init,bad-continuation,invalid-name,import-error,import-outside-toplevel,too-many-branches,too-many-statements
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,attribute-defined-outside-init,bad-continuation,invalid-name,import-error,import-outside-toplevel,too-many-branches,too-many-statements,too-many-public-methods

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
16 changes: 16 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def id(self):
board_id = self._pine64_id()
elif chip_id == chips.A33:
board_id = self._clockwork_pi_id()
elif chip_id == chips.RK3308:
board_id = self._rock_pi_id()
return board_id

# pylint: enable=invalid-name
Expand Down Expand Up @@ -289,6 +291,14 @@ def _pynq_id(self):
except FileNotFoundError:
return None

def _rock_pi_id(self):
"""Check what type of Rock Pi board."""
board_value = self.detector.get_device_model()
board = None
if board_value and "ROCK Pi S" in board_value:
board = boards.ROCK_PI_S
return board

def _clockwork_pi_id(self):
"""Check what type of Clockwork Pi board."""
board_value = self.detector.get_device_model()
Expand Down Expand Up @@ -367,6 +377,11 @@ def any_pine64_board(self):
"""Check whether the current board is any Pine64 device."""
return self.id in boards._PINE64_DEV_IDS

@property
def any_rock_pi_board(self):
"""Check whether the current board is any Clockwork Pi device."""
return self.ROCK_PI_S

@property
def any_clockwork_pi_board(self):
"""Check whether the current board is any Clockwork Pi device."""
Expand All @@ -389,6 +404,7 @@ def any_embedded_linux(self):
self.any_onion_omega_board,
self.any_pine64_board,
self.any_pynq_board,
self.any_rock_pi_board,
self.any_clockwork_pi_board,
]
)
Expand Down
3 changes: 3 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def _linux_id(self):
if self.detector.check_dt_compatible_value("sun8i-a33"):
return chips.A33

if self.detector.check_dt_compatible_value("rockchip,rk3308"):
return chips.RK3308

linux_id = None
hardware = self.detector.get_cpuinfo_field("Hardware")

Expand Down
2 changes: 2 additions & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
PINEBOOK = "PINEBOOK"
PINEPHONE = "PINEPHONE"

ROCK_PI_S = "ROCK_PI_S"

# pylint: enable=bad-whitespace

# OrangePI
Expand Down
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
ZYNQ7000 = "ZYNQ7000"
A64 = "A64"
A33 = "A33"
RK3308 = "RK3308"

BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}
4 changes: 4 additions & 0 deletions bin/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV)
print("Is this a SiFive Unleashed? ", detector.board.SIFIVE_UNLEASHED)
print("Is this a PYNQ Board?", detector.board.PYNQ_Z1 | detector.board.PYNQ_Z2)
print("Is this a Rock Pi board?", detector.board.any_rock_pi_board)
print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board)
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
Expand Down Expand Up @@ -48,5 +49,8 @@
if detector.board.any_pine64_board:
print("Pine64 device detected.")

if detector.board.any_rock_pi_board:
print("Rock Pi device detected.")

if detector.board.any_clockwork_pi:
print("Clockwork Pi device detected.")