Skip to content

ODROID-C4: modify detection through 'compatible' #70

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 1 commit into from
Apr 20, 2020
Merged
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
22 changes: 15 additions & 7 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def id(self): # pylint: disable=invalid-name,too-many-branches,too-many-return-
# look for it based on PID/VID
count = len(UsbTools.find_all([(0x0403, 0x6014)]))
if count == 0:
raise RuntimeError('BLINKA_FT232H environment variable ' + \
raise RuntimeError('BLINKA_FT232H environment variable ' +
'set, but no FT232H device found')
return chips.FT232H
if os.environ.get('BLINKA_MCP2221'):
Expand All @@ -36,7 +36,7 @@ def id(self): # pylint: disable=invalid-name,too-many-branches,too-many-return-
for dev in hid.enumerate():
if dev['vendor_id'] == 0x04D8 and dev['product_id'] == 0x00DD:
return chips.MCP2221
raise RuntimeError('BLINKA_MCP2221 environment variable ' + \
raise RuntimeError('BLINKA_MCP2221 environment variable ' +
'set, but no MCP2221 device found')
if os.environ.get('BLINKA_NOVA'):
return chips.BINHO
Expand All @@ -55,7 +55,9 @@ def id(self): # pylint: disable=invalid-name,too-many-branches,too-many-return-

# pylint: enable=invalid-name

def _linux_id(self): # pylint: disable=too-many-branches,too-many-statements
def _linux_id(self):
# pylint: disable=too-many-branches,too-many-statements
# pylint: disable=too-many-return-statements
"""Attempt to detect the CPU on a computer running the Linux kernel."""

if self.detector.check_dt_compatible_value('qcom,apq8016'):
Expand Down Expand Up @@ -88,10 +90,16 @@ def _linux_id(self): # pylint: disable=too-many-branches,too-many-statements
linux_id = chips.IMX8MX
if compatible and 'odroid-c2' in compatible:
linux_id = chips.S905
if compatible and 'amlogic, g12a' in compatible:
linux_id = chips.S905X3
if compatible and 'amlogic, g12b' in compatible:
linux_id = chips.S922X
if compatible and 'amlogic' in compatible:
compatible_list = compatible.replace('\x00', ',') \
.replace(' ', '').split(',')
if 'g12a' in compatible_list:
# 'sm1' is correct for S905X3, but some kernels use 'g12a'
return chips.S905X3
if 'g12b' in compatible_list:
return chips.S922X
if 'sm1' in compatible_list:
return chips.S905X3
if compatible and 'sun50i-a64' in compatible:
linux_id = chips.A64

Expand Down