pax_global_header00006660000000000000000000000064151473724010014516gustar00rootroot0000000000000052 comment=5fe11b6252e1dbac82e5258b0793617a7f48688e adafruit-Adafruit_Python_PlatformDetect-5fe11b6/000077500000000000000000000000001514737240100220235ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.github/000077500000000000000000000000001514737240100233635ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.github/release-drafter.yml000066400000000000000000000007471514737240100271630ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams, written for Adafruit Industries # # SPDX-License-Identifier: MIT categories: - title: "New Boards" collapse-after: 1 labels: - "New Board" change-template: "- $TITLE #$NUMBER by @$AUTHOR" template: | ## What's Changed $CHANGES To use in CPython, `pip3 install Adafruit-PlatformDetect`. Read the [docs](https://circuitpython.readthedocs.io/projects/platformdetect/en/latest/) for info on how to use it. adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.github/workflows/000077500000000000000000000000001514737240100254205ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.github/workflows/build.yml000066400000000000000000000041221514737240100272410ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries # # SPDX-License-Identifier: MIT name: Build CI on: [pull_request, push] jobs: test: runs-on: ubuntu-latest steps: - name: Translate Repo Name For Build Tools filename_prefix id: repo-name run: | echo ::set-output name=repo-name::$( echo ${{ github.repository }} | awk -F '\/' '{ print tolower($2) }' | tr '_' '-' ) - name: Set up Python 3.8 uses: actions/setup-python@v4 with: python-version: 3.8 - name: Versions run: | python3 --version - name: Checkout Current Repo uses: actions/checkout@v3 with: submodules: true - name: Checkout tools repo uses: actions/checkout@v3 with: repository: adafruit/actions-ci-circuitpython-libs path: actions-ci - name: Install dependencies # (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.) run: | source actions-ci/install.sh - name: Pip install Sphinx, pre-commit run: | pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit - name: Library version run: git describe --dirty --always --tags - name: Setup problem matchers uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 - name: Pre-commit hooks run: | pre-commit run --all-files - name: Build docs working-directory: docs run: sphinx-build -E -W -b html . _build/html - name: Check For pyproject.toml id: need-pypi run: | echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT - name: Build Python package if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') run: | pip install --upgrade build setuptools wheel twine readme_renderer testresources find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/1.2.3/" {} + python -m build twine check dist/* adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.github/workflows/release-drafter.yml000066400000000000000000000010261514737240100312070ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams, written for Adafruit Industries # # SPDX-License-Identifier: MIT name: Release Drafter on: push: branches: - main permissions: contents: read jobs: update_release_draft: permissions: # write permission is required to create a github release contents: write pull-requests: read runs-on: ubuntu-latest steps: - uses: release-drafter/release-drafter@v5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.github/workflows/release.yml000066400000000000000000000023731514737240100275700ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries # # SPDX-License-Identifier: MIT name: Release Actions on: release: types: [published] jobs: upload-pypi: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Check For pyproject.toml id: need-pypi run: | echo pyproject-toml=$( find . -wholename './pyproject.toml' ) >> $GITHUB_OUTPUT - name: Set up Python if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install dependencies if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') run: | python -m pip install --upgrade pip pip install --upgrade build twine - name: Build and publish if: contains(steps.need-pypi.outputs.pyproject-toml, 'pyproject.toml') env: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | find -type f -not -path "./.*" -not -path "./docs*" \( -name "*.py" -o -name "*.toml" \) -exec sed -i -e "s/0.0.0+auto.0/${{github.event.release.tag_name}}/" {} + python -m build twine upload dist/* adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.gitignore000066400000000000000000000003031514737240100240070ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # # SPDX-License-Identifier: Unlicense *.mpy .idea __pycache__ _build build *.pyc .env bundles *.DS_Store .eggs dist **/*.egg-info adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.pre-commit-config.yaml000066400000000000000000000023221514737240100263030ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2020 Adafruit # # SPDX-License-Identifier: Unlicense repos: - repo: https://github.com/python/black rev: 23.3.0 hooks: - id: black - repo: https://github.com/fsfe/reuse-tool rev: v1.1.2 hooks: - id: reuse - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pycqa/pylint rev: v2.17.4 hooks: - id: pylint name: pylint (library code) types: [python] args: - --disable=consider-using-f-string,duplicate-code exclude: "^(docs/|examples/|tests/|setup.py$)" - id: pylint name: pylint (example code) description: Run pylint rules on "examples/*.py" files types: [python] files: "^examples/" args: - --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code - id: pylint name: pylint (test code) description: Run pylint rules on "tests/*.py" files types: [python] files: "^tests/" args: - --disable=missing-docstring,consider-using-f-string,duplicate-code adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.pylintrc000066400000000000000000000315311514737240100236730ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # # SPDX-License-Identifier: Unlicense [MASTER] # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code extension-pkg-whitelist=hid # Add files or directories to the ignore-list. They should be base names, not # paths. ignore=CVS # Add files or directories matching the regex patterns to the ignore-list. The # regex matches against base names, not paths. ignore-patterns= # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). #init-hook= # Use multiple processes to speed up Pylint. jobs=1 # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. load-plugins=pylint.extensions.no_self_use # Pickle collected data for later comparisons. persistent=yes # Specify a configuration file. #rcfile= # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no [MESSAGES CONTROL] # Only show warnings with the listed confidence levels. Leave empty to show # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED confidence= # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once).You can also use "--disable=all" to # disable everything first and then reenable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" # disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding,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 # multiple time (only on the command line, not in the configuration file where # it should appear only once). See also the "--disable" option for examples. enable= [REPORTS] # Python expression which should return a note less than 10 (10 is the highest # note). You have access to the variables errors warning, statement which # respectively contain the number of errors / warnings messages and the total # number of statements analyzed. This is used by the global evaluation report # (RP0004). evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) # Template used to display messages. This is a python new-style format string # used to format the message information. See doc for all details #msg-template= # Set the output format. Available formats are text, parseable, colorized, json # and msvs (visual studio).You can also give a reporter class, eg # mypackage.mymodule.MyReporterClass. output-format=text # Tells whether to display a full report or only the messages reports=no # Activate the evaluation score. score=yes [REFACTORING] # Maximum number of nested blocks for function / method body max-nested-blocks=5 [LOGGING] # Logging modules to check that the string format arguments are in logging # function parameter format logging-modules=logging [SPELLING] # Spelling dictionary name. Available dictionaries: none. To make it working # install python-enchant package. spelling-dict= # List of comma separated words that should not be checked. spelling-ignore-words= # A path to a file that contains private dictionary; one word per line. spelling-private-dict-file= # Tells whether to store unknown words to indicated private dictionary in # --spelling-private-dict-file option instead of raising a message. spelling-store-unknown-words=no [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. # notes=FIXME,XXX,TODO notes=FIXME,XXX [TYPECHECK] # List of decorators that produce context managers, such as # contextlib.contextmanager. Add to this list to register other decorators that # produce valid context managers. contextmanager-decorators=contextlib.contextmanager # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E1101 when accessed. Python regular # expressions are accepted. generated-members= # Tells whether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). ignore-mixin-members=yes # This flag controls whether pylint should warn about no-member and similar # checks whenever an opaque object is returned when inferring. The inference # can return multiple potential results while evaluating a Python object, but # some branches might not be evaluated, which results in partial inference. In # that case, it might be useful to still emit no-member and other checks for # the rest of the inferred objects. ignore-on-opaque-inference=yes # List of class names for which member attributes should not be checked (useful # for classes with dynamically set attributes). This supports the use of # qualified names. ignored-classes=optparse.Values,thread._local,_thread._local # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis. It # supports qualified module names, as well as Unix pattern matching. ignored-modules= # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. missing-member-hint=yes # The minimum edit distance a name should have in order to be considered a # similar match for a missing member name. missing-member-hint-distance=1 # The total number of similar names that should be taken in consideration when # showing a hint for a missing member. missing-member-max-choices=1 [VARIABLES] # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. additional-builtins= # Tells whether unused global variables should be treated as a violation. allow-global-unused-variables=yes # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. callbacks=cb_,_cb # A regular expression matching the name of dummy variables (i.e. expectedly # not used). dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ # Argument names that match this expression will be ignored. Default to name # with leading underscore ignored-argument-names=_.*|^ignored_|^unused_ # Tells whether we should check for unused import in __init__ files. init-import=no # List of qualified module names which can have objects that can redefine # builtins. redefining-builtins-modules=six.moves,future.builtins [FORMAT] # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. # expected-line-ending-format= expected-line-ending-format=LF # Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=^\s*(# )??$ # Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 # tab). indent-string=' ' # Maximum number of characters on a single line. max-line-length=100 # Maximum number of lines in a module max-module-lines=1000 # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no # Allow the body of an if to be on the same line as the test if there is no # else. single-line-if-stmt=no [SIMILARITIES] # Ignore comments when computing similarities. ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes # Ignore imports when computing similarities. ignore-imports=yes # Minimum lines number of a similarity. min-similarity-lines=12 [BASIC] # Regular expression matching correct argument names argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ # Regular expression matching correct attribute names attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata # Regular expression matching correct class attribute names class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ # Regular expression matching correct class names # class-rgx=[A-Z_][a-zA-Z0-9]+$ class-rgx=[A-Z_][a-zA-Z0-9_]+$ # Regular expression matching correct constant names const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ # Minimum line length for functions/classes that require docstrings, shorter # ones are exempt. docstring-min-length=-1 # Regular expression matching correct function names function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ # Good variable names which should always be accepted, separated by a comma # good-names=i,j,k,ex,Run,_ good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_ # Include a hint for the correct naming format with invalid-name include-naming-hint=no # Regular expression matching correct inline iteration names inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ # Regular expression matching correct method names method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ # Regular expression matching correct module names module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ # Colon-delimited sets of names that determine each other's naming style when # the name regexes allow several styles. name-group= # Regular expression which should only match function or class names that do # not require a docstring. no-docstring-rgx=^_ # List of decorators that produce properties, such as abc.abstractproperty. Add # to this list to register other decorators that produce valid properties. property-classes=abc.abstractproperty # Regular expression matching correct variable names variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ [IMPORTS] # Allow wildcard imports from modules that define __all__. allow-wildcard-with-all=no # Analyse import fallback blocks. This can be used to support both Python 2 and # 3 compatible code, which means that the block might have code that exists # only in one or another interpreter, leading to false positives when analysed. analyse-fallback-blocks=no # Deprecated modules which should not be used, separated by a comma deprecated-modules=optparse,tkinter.tix # Create a graph of external dependencies in the given file (report RP0402 must # not be disabled) ext-import-graph= # Create a graph of every (i.e. internal and external) dependencies in the # given file (report RP0402 must not be disabled) import-graph= # Create a graph of internal dependencies in the given file (report RP0402 must # not be disabled) int-import-graph= # Force import order to recognize a module as part of the standard # compatibility libraries. known-standard-library= # Force import order to recognize a module as part of a third party library. known-third-party=enchant [CLASSES] # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__,__new__,setUp # List of member names, which should be excluded from the protected access # warning. exclude-protected=_asdict,_fields,_replace,_source,_make # List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls # List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=mcs [DESIGN] # Maximum number of arguments for function / method max-args=5 # Maximum number of attributes for a class (see R0902). # max-attributes=7 max-attributes=11 # Maximum number of boolean expressions in a if statement max-bool-expr=5 # Maximum number of branch for function / method body max-branches=12 # Maximum number of locals for function / method body max-locals=15 # Maximum number of parents for a class (see R0901). max-parents=7 # Maximum number of public methods for a class (see R0904). max-public-methods=20 # Maximum number of return / yield for function / method body max-returns=6 # Maximum number of statements in function / method body max-statements=50 # Minimum number of public methods for a class (see R0903). min-public-methods=1 [EXCEPTIONS] # Exceptions that will emit a warning when being caught. Defaults to # "Exception" overgeneral-exceptions=builtins.Exception adafruit-Adafruit_Python_PlatformDetect-5fe11b6/.readthedocs.yaml000066400000000000000000000006101514737240100252470ustar00rootroot00000000000000 # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # # SPDX-License-Identifier: Unlicense # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 build: os: "ubuntu-20.04" tools: python: "3.7" python: install: - requirements: docs/requirements.txt - requirements: requirements.txt adafruit-Adafruit_Python_PlatformDetect-5fe11b6/CODE_OF_CONDUCT.md000066400000000000000000000140031514737240100246200ustar00rootroot00000000000000 # Adafruit Community Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and leaders pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level or type of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards We are committed to providing a friendly, safe and welcoming environment for all. Examples of behavior that contributes to creating a positive environment include: * Be kind and courteous to others * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Collaborating with other community members * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and sexual attention or advances * The use of inappropriate images, including in a community member's avatar * The use of inappropriate language, including in a community member's nickname * Any spamming, flaming, baiting or other attention-stealing behavior * Excessive or unwelcome helping; answering outside the scope of the question asked * Trolling, insulting/derogatory comments, and personal or political attacks * Promoting or spreading disinformation, lies, or conspiracy theories against a person, group, organisation, project, or community * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate The goal of the standards and moderation guidelines outlined here is to build and maintain a respectful community. We ask that you don’t just aim to be "technically unimpeachable", but rather try to be your best self. We value many things beyond technical expertise, including collaboration and supporting others within our community. Providing a positive experience for other community members can have a much more significant impact than simply providing the correct answer. ## Our Responsibilities Project leaders are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project leaders have the right and responsibility to remove, edit, or reject messages, comments, commits, code, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any community member for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Moderation Instances of behaviors that violate the Adafruit Community Code of Conduct may be reported by any member of the community. Community members are encouraged to report these situations, including situations they witness involving other community members. You may report in the following ways: In any situation, you may send an email to . On the Adafruit Discord, you may send an open message from any channel to all Community Moderators by tagging @community moderators. You may also send an open message from any channel, or a direct message to @kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175. Email and direct message reports will be kept confidential. In situations on Discord where the issue is particularly egregious, possibly illegal, requires immediate action, or violates the Discord terms of service, you should also report the message directly to Discord. These are the steps for upholding our community’s standards of conduct. 1. Any member of the community may report any situation that violates the Adafruit Community Code of Conduct. All reports will be reviewed and investigated. 2. If the behavior is an egregious violation, the community member who committed the violation may be banned immediately, without warning. 3. Otherwise, moderators will first respond to such behavior with a warning. 4. Moderators follow a soft "three strikes" policy - the community member may be given another chance, if they are receptive to the warning and change their behavior. 5. If the community member is unreceptive or unreasonable when warned by a moderator, or the warning goes unheeded, they may be banned for a first or second offense. Repeated offenses will result in the community member being banned. ## Scope This Code of Conduct and the enforcement policies listed above apply to all Adafruit Community venues. This includes but is not limited to any community spaces (both public and private), the entire Adafruit Discord server, and Adafruit GitHub repositories. Examples of Adafruit Community spaces include but are not limited to meet-ups, audio chats on the Adafruit Discord, or interaction at a conference. This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. As a community member, you are representing our community, and are expected to behave accordingly. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at , and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html). For other projects adopting the Adafruit Community Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. adafruit-Adafruit_Python_PlatformDetect-5fe11b6/LICENSE000066400000000000000000000020761514737240100230350ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2018 Adafruit Industries Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. adafruit-Adafruit_Python_PlatformDetect-5fe11b6/LICENSES/000077500000000000000000000000001514737240100232305ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/LICENSES/CC-BY-4.0.txt000066400000000000000000000406561514737240100251000ustar00rootroot00000000000000Creative Commons Attribution 4.0 International Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public : wiki.creativecommons.org/Considerations_for_licensees Creative Commons Attribution 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 – Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. h. Licensor means the individual(s) or entity(ies) granting rights under this Public License. i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 – Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: A. reproduce and Share the Licensed Material, in whole or in part; and B. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 5. Downstream recipients. A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. B. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 – License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: A. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. Section 4 – Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 – Disclaimer of Warranties and Limitation of Liability. a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 – Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 – Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 – Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org. adafruit-Adafruit_Python_PlatformDetect-5fe11b6/LICENSES/MIT.txt000066400000000000000000000021241514737240100244210ustar00rootroot00000000000000MIT License Copyright (c) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. adafruit-Adafruit_Python_PlatformDetect-5fe11b6/LICENSES/Unlicense.txt000066400000000000000000000022731514737240100257220ustar00rootroot00000000000000This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to adafruit-Adafruit_Python_PlatformDetect-5fe11b6/README.rst000066400000000000000000000057731514737240100235260ustar00rootroot00000000000000Introduction ============ .. image:: https://readthedocs.org/projects/adafruit-platformdetect/badge/?version=latest :target: https://circuitpython.readthedocs.io/projects/platformdetect/en/latest/ :alt: Documentation Status .. image:: https://img.shields.io/discord/327254708534116352.svg :target: https://adafru.it/discord :alt: Discord .. image:: https://github.com/adafruit/Adafruit_Python_PlatformDetect/workflows/Build%20CI/badge.svg :target: https://github.com/adafruit/Adafruit_Python_PlatformDetect/actions :alt: Build Status .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black :alt: Code Style: Black This library provides best-guess platform detection for a range of single-board computers and (potentially) other platforms. It was written primarily for use in `Adafruit_Blinka `_, but may be useful in other contexts. Platform detection is divided into "chip" and "board" detection, with the latter generally dependent on the former. Platform info is gathered from: - Python's `sys.platform` - Various files on Linux systems: - /proc/cpuinfo (for processor info, Raspberry Pi hardware revisions, etc.) - /proc/device-tree/compatible (for 96Boards info) - Beaglebone EEPROM board IDs - Distribution-specific files such as /etc/armbian-release. Dependencies ============= This driver depends on: * Python 3.7 or higher Installing from PyPI ===================== On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from PyPI `_. To install for current user: .. code-block:: shell pip3 install Adafruit-PlatformDetect To install system-wide (this may be required in some cases): .. code-block:: shell sudo pip3 install Adafruit-PlatformDetect To install in a virtual environment in your current project: .. code-block:: shell mkdir project-name && cd project-name python3 -m venv .env source .env/bin/activate pip3 install Adafruit-PlatformDetect Usage Example ============= .. code-block:: python from adafruit_platformdetect import Detector detector = Detector() print("Chip id: ", detector.chip.id) print("Board id: ", detector.board.id) # Check for specific board models: print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS) print("BBB? ", detector.board.BEAGLEBONE_BLACK) print("Orange Pi PC? ", detector.board.ORANGE_PI_PC) print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC) Contributing ============ Contributions are welcome! Please read our `Code of Conduct `_ before contributing to help this project stay welcoming. Documentation ============= For information on building library documentation, please check out `this guide `_. adafruit-Adafruit_Python_PlatformDetect-5fe11b6/README.rst.license000066400000000000000000000001611514737240100251310ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/000077500000000000000000000000001514737240100267175ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/__init__.py000066400000000000000000000102611514737240100310300ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2014-2018 Tony DiCola, Limor Fried, Brennen Bearnes # # SPDX-License-Identifier: MIT """ Attempt to detect the current platform. """ import os import re import sys try: from typing import Optional except ImportError: pass from adafruit_platformdetect.board import Board from adafruit_platformdetect.chip import Chip # Needed to find libs (like libusb) installed by homebrew on Apple Silicon if sys.platform == "darwin": os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = "/opt/homebrew/lib/" # Various methods here may retain state in future, so tell pylint not to worry # that they don't use self right now: # pylint: disable=no-self-use class Detector: """Wrap various platform detection functions.""" def __init__(self) -> None: self.board = Board(self) self.chip = Chip(self) def get_cpuinfo_field(self, field: str) -> Optional[str]: """ Search /proc/cpuinfo for a field and return its value, if found, otherwise None. """ # Match a line like 'Hardware : BCM2709': pattern = r"^" + field + r"\s+:\s+(.*)$" with open("/proc/cpuinfo", "r", encoding="utf-8") as infile: cpuinfo = infile.read().split("\n") for line in cpuinfo: match = re.search(pattern, line, flags=re.IGNORECASE) if match: return match.group(1) return None def check_dt_compatible_value(self, value: str) -> bool: """ Search /proc/device-tree/compatible for a value and return True, if found, otherwise False. """ # Match a value like 'qcom,apq8016-sbc': dt_compatible = self.get_device_compatible() if dt_compatible and value in dt_compatible: return True return False def get_armbian_release_field(self, field: str) -> Optional[str]: """ Search /etc/armbian-release, if it exists, for a field and return its value, if found, otherwise None. """ field_value = None pattern = r"^" + field + r"=(.*)" try: with open("/etc/armbian-release", "r", encoding="utf-8") as release_file: armbian = release_file.read().split("\n") for line in armbian: match = re.search(pattern, line) if match: field_value = match.group(1) except FileNotFoundError: pass return field_value def get_device_model(self) -> Optional[str]: """ Search /proc/device-tree/model for the device model and return its value, if found, otherwise None. """ try: with open("/proc/device-tree/model", "r", encoding="utf-8") as model_file: return model_file.read() except FileNotFoundError: pass return None def get_device_compatible(self) -> Optional[str]: """ Search /proc/device-tree/compatible for the compatible chip name. """ try: with open( "/proc/device-tree/compatible", "r", encoding="utf-8" ) as model_file: return model_file.read() except FileNotFoundError: pass return None def check_board_asset_tag_value(self) -> Optional[str]: """ Search /sys/devices/virtual/dmi/id for the device model and return its value, if found, otherwise None. """ try: with open( "/sys/devices/virtual/dmi/id/board_asset_tag", "r", encoding="utf-8" ) as tag_file: return tag_file.read().strip() except FileNotFoundError: pass return None def check_board_name_value(self) -> Optional[str]: """ Search /sys/devices/virtual/dmi/id for the board name and return its value, if found, otherwise None. Debian/ubuntu based """ try: with open( "/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8" ) as board_name_file: return board_name_file.read().strip() except FileNotFoundError: pass return None adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/board.py000066400000000000000000001525561514737240100303760ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `adafruit_platformdetect.board` ================================================================================ Detect boards * Author(s): Melissa LeBlanc-Williams Implementation Notes -------------------- **Software and Dependencies:** * Linux and Python 3.7 or Higher * or MicroPython """ try: import glob except ImportError: pass import os import re try: from typing import Optional except ImportError: pass from adafruit_platformdetect.constants import boards, chips __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git" class Board: """Attempt to detect specific boards.""" def __init__(self, detector) -> None: self.detector = detector self._board_id = None # pylint: disable=invalid-name, protected-access, too-many-return-statements, too-many-lines @property def id(self) -> Optional[str]: """Return a unique id for the detected board, if any.""" # There are some times we want to trick the platform detection # say if a raspberry pi doesn't have the right ID, or for testing # Caching if self._board_id: return self._board_id try: return os.environ["BLINKA_FORCEBOARD"] except (AttributeError, KeyError): # no forced board, continue with testing! pass chip_id = self.detector.chip.id board_id = None if chip_id == chips.H3: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.JH7110: board_id = self._starfive_id() elif chip_id == chips.BCM2XXX: board_id = self._pi_id() elif chip_id == chips.OS_AGNOSTIC: board_id = boards.OS_AGNOSTIC_BOARD elif chip_id == chips.AM625X: board_id = self._beaglebone_id() elif chip_id == chips.AM33XX: board_id = self._beaglebone_id() elif chip_id == chips.AM65XX: board_id = self._siemens_simatic_iot2000_id() elif chip_id == chips.AM67A: board_id = self._beagleyai_id() elif chip_id == chips.DRA74X: board_id = self._bbai_id() elif chip_id == chips.SUN4I: board_id = self._armbian_id() elif chip_id == chips.SUN7I: board_id = self._armbian_id() elif chip_id == chips.SUN8I: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.SAMA5: board_id = self._sama5_id() elif chip_id == chips.IMX8MX: board_id = self._imx8mx_id() elif chip_id == chips.IMX8MP: board_id = self._imx8mp_id() elif chip_id == chips.IMX6ULL: board_id = self._imx6ull_id() elif chip_id == chips.S905Y2: board_id = boards.RADXA_ZERO elif chip_id == chips.ESP8266: board_id = boards.FEATHER_HUZZAH elif chip_id == chips.SAMD21: board_id = boards.FEATHER_M0_EXPRESS elif chip_id == chips.STM32F405: board_id = boards.PYBOARD elif chip_id in (chips.RP2040, chips.RP2350): board_id = self._raspberry_pi_pico_id() elif chip_id == chips.S805: board_id = boards.ODROID_C1 elif chip_id == chips.S905: board_id = boards.ODROID_C2 elif chip_id == chips.S905X3: board_id = self._s905x3_id() elif chip_id == chips.S922X: board_id = boards.ODROID_N2 elif chip_id == chips.A311D: board_id = boards.KHADAS_VIM3 elif chip_id == chips.EXYNOS5422: board_id = boards.ODROID_XU4 elif chip_id == chips.FT232H: board_id = boards.FTDI_FT232H elif chip_id == chips.FT2232H: board_id = boards.FTDI_FT2232H elif chip_id == chips.FT4232H: board_id = boards.FTDI_FT4232H elif chip_id == chips.SPIDRIVER: board_id = boards.EXCAMERA_SPIDRIVER elif chip_id == chips.APQ8016: board_id = boards.DRAGONBOARD_410C elif chip_id in (chips.T210, chips.T186, chips.T194, chips.T234, chips.T264): board_id = self._tegra_id() elif chip_id == chips.HFU540: board_id = self._sifive_id() elif chip_id == chips.C906: board_id = self._allwinner_id() elif chip_id == chips.JH71X0: board_id = self._beaglebone_id() elif chip_id == chips.MCP2221: board_id = boards.MICROCHIP_MCP2221 elif chip_id == chips.BINHO: board_id = boards.BINHO_NOVA elif chip_id == chips.LPC4330: board_id = boards.GREATFET_ONE elif chip_id == chips.MIPS24KC: board_id = boards.ONION_OMEGA elif chip_id == chips.MIPS24KEC: board_id = boards.ONION_OMEGA2 elif chip_id == chips.ZYNQ7000: board_id = self._pynq_id() elif chip_id == chips.A10: board_id = self._armbian_id() elif chip_id == chips.A20: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.A64: board_id = self._pine64_id() elif chip_id == chips.H6: board_id = ( self._pine64_id() or self._armbian_id() or self._repka_variants_id() ) elif chip_id == chips.H5: board_id = ( self._armbian_id() or self._allwinner_variants_id() or self._repka_variants_id() ) elif chip_id == chips.T527: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.H618: board_id = ( self._armbian_id() or self._allwinner_variants_id() or self._orange_pi_id() ) elif chip_id == chips.H616: board_id = self._armbian_id() or self._allwinner_variants_id() elif chip_id == chips.A33: board_id = self._clockwork_pi_id() elif chip_id == chips.K1: board_id = self._armbian_id() or self._spacemit_variants_id() elif chip_id == chips.RZV2N: board_id = self._armbian_id() or self._renesas_variants_id() elif chip_id == chips.RZV2H: board_id = self._armbian_id() or self._renesas_variants_id() elif chip_id == chips.RK3308: board_id = self._rock_pi_id() or self._banana_pi_id() elif chip_id == chips.RK3399: board_id = ( self._rock_pi_id() or self._armbian_id() or self._diet_pi_id() or self._asus_tinker_board_id() or self._vivid_unit_id() or self._vicharak_id() ) elif chip_id == chips.RK3399PRO: board_id = self._asus_tinker_board_id() elif chip_id == chips.RK3399_T: board_id = self._rock_pi_id() or self._armbian_id() elif chip_id == chips.ATOM_X5_Z8350: board_id = self._rock_pi_id() elif chip_id == chips.ATOM_J4105: board_id = self._j4105_id() elif chip_id == chips.RK3288: board_id = self._asus_tinker_board_id() elif chip_id == chips.RK3328: board_id = self._rock_pi_id() or self._libre_id() elif chip_id == chips.RK3566: board_id = self._rk3566_id() elif chip_id == chips.RK3568: board_id = self._rk3568_id() elif chip_id == chips.RK3588: board_id = ( self._rock_pi_id() or self._orange_pi_id() or self._armbian_id() or self._rk3588_id() or self._ameridroid_id() or self._vicharak_id() ) elif chip_id == chips.RK3588S: board_id = ( self._orange_pi_id() or self._armbian_id() or self._ameridroid_id() ) elif chip_id == chips.RYZEN_V1605B: board_id = self._udoo_id() elif chip_id == chips.PENTIUM_N3710: board_id = self._udoo_id() elif chip_id == chips.CELERON_N5105: board_id = self._intel_n_series_id() elif chip_id == chips.STM32MP157: board_id = self._stm32mp1_id() elif chip_id == chips.STM32MP157DAA1: board_id = self._stm32mp1_id() elif chip_id == chips.MT8167: board_id = boards.CORAL_EDGE_TPU_DEV_MINI elif chip_id == chips.RP2040_U2IF: board_id = self._rp2040_u2if_id() elif chip_id == chips.GENERIC_X86: board_id = boards.GENERIC_LINUX_PC elif chip_id == chips.TDA4VM: board_id = self._beaglebone_id() or self._tisk_id() elif chip_id == chips.D1_RISCV: board_id = self._armbian_id() elif chip_id == chips.S905X: board_id = boards.AML_S905X_CC elif chip_id == chips.CV1800B: board_id = boards.MILKV_DUO elif chip_id == chips.TH1520: board_id = boards.LICHEEPI_4A elif chip_id == chips.RV1103: board_id = self._rv1103_id() elif chip_id == chips.RV1106: board_id = self._rv1106_id() elif chip_id == chips.SUNRISE_X3: board_id = boards.RDK_X3 elif chip_id == chips.SUNRISE_X5: board_id = boards.RDK_X5 elif chip_id == chips.QCM6490: board_id = boards.PARTICLE_TACHYON self._board_id = board_id return board_id # pylint: enable=invalid-name def _starfive_id(self) -> Optional[str]: model = None model_value = self.detector.get_device_model() if "VisionFive" in model_value and "V2" in model_value: model = boards.VISIONFIVE2 return model @property def any_starfive_id(self): """Check whether the current board is any Pine64 device.""" return self.id in boards._STARFIVE_BOARD_IDS def _pi_id(self) -> Optional[str]: """Try to detect id of a Raspberry Pi.""" # Check for Pi boards: pi_rev_code = self._pi_rev_code() if pi_rev_code: from adafruit_platformdetect.revcodes import PiDecoder try: decoder = PiDecoder(pi_rev_code) model = boards._PI_MODELS[decoder.type_raw] if isinstance(model, dict): model = model[decoder.revision] return model except ValueError: pass # We may be on a non-Raspbian OS, so try to lazily determine # the version based on `get_device_model` else: pi_model = self.detector.get_device_model() if pi_model: pi_model = pi_model.upper().replace(" ", "_") if "PLUS" in pi_model: re_model = re.search(r"(RASPBERRY_PI_\d).*([AB]_*)(PLUS)", pi_model) elif "CM" in pi_model: # untested for Compute Module re_model = re.search(r"(RASPBERRY_PI_CM)(\d)", pi_model) else: # untested for non-plus models re_model = re.search(r"(RASPBERRY_PI_\d).*([AB])", pi_model) if re_model: pi_model = "".join(re_model.groups()) available_models = boards._PI_MODELS.values() for model in available_models: # Account for the PI_B_REV1/2 case if isinstance(model, dict) and pi_model in model: return model[pi_model] if model == pi_model: return model return None def _pi_rev_code(self) -> Optional[str]: """Attempt to find a Raspberry Pi revision code for this board.""" # 2708 is Pi 1 # 2709 is Pi 2 # 2835 is Pi 3 (or greater) on 4.9.x kernel # Anything else is not a Pi. if self.detector.chip.id != chips.BCM2XXX: # Something else, not a Pi. return None rev = self.detector.get_cpuinfo_field("Revision") if rev is not None: return rev try: with open("/proc/device-tree/system/linux,revision", "rb") as revision: rev_bytes = revision.read() if rev_bytes[:1] == b"\x00": rev_bytes = rev_bytes[1:] return rev_bytes.hex() except FileNotFoundError: return None # pylint: disable=no-self-use def _beaglebone_id(self) -> Optional[str]: """Try to detect id of a Beaglebone.""" board_value = self.detector.get_device_compatible() # Older Builds if "freedom-u74-arty" in board_value: return boards.BEAGLEV_STARLIGHT # Newer Builds if "beaglev-starlight" in board_value: return boards.BEAGLEV_STARLIGHT # find device alias at i2c address 0x50 (0-00500, 0-00501, etc) nvmem_devices = glob.glob("/sys/bus/nvmem/devices/0-0050*") # do not expect there to be anything but one eeprom if len(nvmem_devices) != 1: return None eeprom_dir = nvmem_devices[0] try: with open(f"{eeprom_dir}/nvmem", "rb") as eeprom: eeprom_bytes = eeprom.read(16) except FileNotFoundError: try: # Special Case for AI64 with open("/sys/bus/nvmem/devices/2-00500/nvmem", "rb") as eeprom: eeprom_bytes = eeprom.read(16) except FileNotFoundError: return None if eeprom_bytes[:4] != b"\xaaU3\xee": return None # special condition for BeagleBone Green rev. 1A # refer to GitHub issue #57 in this repo for more info if eeprom_bytes == b"\xaaU3\xeeA335BNLT\x1a\x00\x00\x00": return boards.BEAGLEBONE_GREEN # BeaglePlay Special Condition # new Beagle EEPROM IDs are 24 Bit, so we need to verify full range if eeprom_bytes == b"\xaaU3\xee\x017\x00\x10.\x00BEAGLE": with open("/sys/bus/nvmem/devices/0-00500/nvmem", "rb") as eeprom: eeprom_bytes = eeprom.read(24) if eeprom_bytes == b"\xaaU3\xee\x017\x00\x10.\x00BEAGLEPLAY-A0-": return boards.BEAGLE_PLAY id_string = eeprom_bytes[4:].decode("ascii") for model, bb_ids in boards._BEAGLEBONE_BOARD_IDS.items(): for bb_id in bb_ids: if id_string == bb_id[1]: return model board_value = self.detector.get_armbian_release_field("BOARD") return None # pylint: enable=no-self-use def _beagleyai_id(self) -> Optional[str]: """Try to detect id of a BeagleY-AI board.""" board_value = self.detector.get_device_model() if "BeagleY-AI" in board_value: return boards.BEAGLEY_AI return None def _bbai_id(self) -> Optional[str]: """Try to detect id of a Beaglebone AI related board.""" board_value = self.detector.get_device_model() if "BeagleBone AI" in board_value: return boards.BEAGLEBONE_AI return None def _tisk_id(self) -> Optional[str]: """Try to detect the id of aarch64 board.""" compatible = self.detector.get_device_compatible() print(compatible) if not compatible: return None compats = compatible.split("\x00") for board_id, board_compats in boards._TI_SK_BOARD_IDS: if any(v in compats for v in board_compats): return board_id return None # pylint: disable=too-many-return-statements def _armbian_id(self) -> Optional[str]: """Get the current board via the ARMBIAN release field.""" board_value = self.detector.get_armbian_release_field("BOARD") board = None if board_value == "orangepipc": board = boards.ORANGE_PI_PC elif board_value == "orangepi-r1": board = boards.ORANGE_PI_R1 elif board_value == "orangepizero": board = boards.ORANGE_PI_ZERO elif board_value == "orangepione": board = boards.ORANGE_PI_ONE elif board_value == "orangepilite": board = boards.ORANGE_PI_LITE elif board_value == "orangepiplus2e": board = boards.ORANGE_PI_PLUS_2E elif board_value == "orangepipcplus": board = boards.ORANGE_PI_PC_PLUS elif board_value == "pinebook-a64": board = boards.PINEBOOK elif board_value == "pineH64": board = boards.PINEH64 elif board_value == "orangepi2": board = boards.ORANGE_PI_2 elif board_value == "orangepipc2": board = boards.ORANGE_PI_PC2 elif board_value == "orangepizero3": board = boards.ORANGE_PI_ZERO_3 elif board_value == "orangepi3b": board = boards.ORANGE_PI_3B elif board_value == "orangepi3": board = boards.ORANGE_PI_3 elif board_value == "orangepi3-lts": board = boards.ORANGE_PI_3_LTS elif board_value == "orangepi4": board = boards.ORANGE_PI_4 elif board_value == "orangepi4-lts": board = boards.ORANGE_PI_4_LTS elif board_value == "orangepi5-plus": board = boards.ORANGE_PI_5_PLUS elif board_value == "orangepi5": board = boards.ORANGE_PI_5 elif board_value == "orangepi5-pro": board = boards.ORANGE_PI_5_PRO elif board_value == "bananapim2zero": board = boards.BANANA_PI_M2_ZERO elif board_value == "bananapim2plus": board = boards.BANANA_PI_M2_PLUS elif board_value == "bananapim2berry": board = boards.BANANA_PI_M2_BERRY elif board_value == "bananapim4berry": board = boards.BANANA_PI_M4_BERRY elif board_value == "bananapim4zero": board = boards.BANANA_PI_M4_ZERO elif board_value == "bananapim5": board = boards.BANANA_PI_M5 elif board_value == "bananapif3": board = boards.BANANA_PI_F3 elif board_value == "bananapif5": board = boards.BANANA_PI_F5 elif board_value == "bananapiai2n": board = boards.BANANA_PI_AI2N elif board_value == "bananapiai2h": board = boards.BANANA_PI_AI2H elif board_value == "orangepizeroplus2-h5": board = boards.ORANGE_PI_ZERO_PLUS_2H5 elif board_value == "orangepizeroplus": board = boards.ORANGE_PI_ZERO_PLUS elif board_value == "orangepizero2": board = boards.ORANGE_PI_ZERO_2 elif board_value == "nanopiair": board = boards.NANOPI_NEO_AIR elif board_value == "nanopiduo2": board = boards.NANOPI_DUO2 elif board_value == "nanopineo": board = boards.NANOPI_NEO elif board_value == "nanopineo2": board = boards.NANOPI_NEO_2 elif board_value == "nezha": board = boards.LICHEE_RV elif board_value == "pcduino2": board = boards.PCDUINO2 elif board_value == "pcduino3": board = boards.PCDUINO3 elif board_value == "rock-3a": board = boards.ROCK_PI_3A elif board_value == "radxa-zero3": board = boards.RADXA_ZERO3 elif board_value == "repka-pi3-h5": board = boards.REPKA_PI_3_H5 elif board_value == "repka-pi4-h6": board = boards.REPKA_PI_4_H6 elif board_value == "milkv_duo": board = boards.MILKV_DUO return board @staticmethod def _raspberry_pi_pico_id() -> Optional[str]: """Try to detect id of a Raspberry Pi Pico.""" board_id = os.uname().machine if "Raspberry Pi Pico 2 W" in board_id: return boards.RASPBERRY_PI_PICO_2_W if "Raspberry Pi Pico 2" in board_id: return boards.RASPBERRY_PI_PICO_2 if "Raspberry Pi Pico W" in board_id: return boards.RASPBERRY_PI_PICO_W if "Raspberry Pi Pico" in board_id: return boards.RASPBERRY_PI_PICO return None # pylint: enable=too-many-return-statements def _diet_pi_id(self) -> Optional[str]: board_value = self.detector.get_device_model() if "OrangePi 4" in board_value: return boards.ORANGE_PI_4 return None def _ameridroid_id(self) -> Optional[str]: board_value = self.detector.get_device_model().upper() if "INDIEDROID NOVA" in board_value: return boards.INDIEDROID_NOVA return None def _orange_pi_id(self) -> Optional[str]: # pylint: disable=too-many-return-statements board_value = self.detector.get_device_model() if "OPi 5 Max" in board_value: return boards.ORANGE_PI_5_MAX if "OPi 5 Ultra" in board_value: return boards.ORANGE_PI_5_ULTRA if "OPi 5 Pro" in board_value: return boards.ORANGE_PI_5_PRO if "Orange Pi 5 Max" in board_value: return boards.ORANGE_PI_5_MAX if "Orange Pi 5 Plus" in board_value: return boards.ORANGE_PI_5_PLUS if "Orange Pi 5" in board_value: return boards.ORANGE_PI_5 if "Orange Pi 3B" in board_value: return boards.ORANGE_PI_3B if "OrangePi Zero 2W" in board_value: return boards.ORANGE_PI_ZERO_2W return None # pylint: enable=too-many-return-statements def _banana_pi_id(self) -> Optional[str]: """Check what type of Banana Pi board.""" board_value = self.detector.get_device_model() if "bpi-p2pro" in board_value: return boards.BANANA_PI_P2_PRO return None def _sama5_id(self) -> Optional[str]: """Check what type sama5 board.""" board_value = self.detector.get_device_model() if "Giant Board" in board_value: return boards.GIANT_BOARD return None def _s905x3_id(self) -> Optional[str]: """Check what type S905X3 board.""" board_value = self.detector.get_device_model() if "Bananapi BPI-M5" in board_value: return boards.BANANA_PI_M5 return boards.ODROID_C4 def _stm32mp1_id(self) -> Optional[str]: """Check what type stm32mp1 board.""" board_value = self.detector.get_device_model() if "STM32MP157C-DK2" in board_value: return boards.STM32MP157C_DK2 if "LubanCat" in board_value: return boards.LUBANCAT_STM32MP157 if "OSD32MP1-BRK" in board_value: return boards.OSD32MP1_BRK if "OSD32MP1-RED" in board_value: return boards.OSD32MP1_RED if "STM32MP1XX OLinuXino" in board_value: return boards.STMP157_OLINUXINO_LIME2 return None def _imx8mx_id(self) -> Optional[str]: """Check what type iMX8M board.""" board_value = self.detector.get_device_model() if "FSL i.MX8MM DDR4 EVK" in board_value: return boards.MAAXBOARD_MINI if "Freescale i.MX8MQ EVK" in board_value: return boards.MAAXBOARD if "Phanbell" in board_value: return boards.CORAL_EDGE_TPU_DEV return None def _imx8mp_id(self) -> Optional[str]: """Check what type iMX8M board.""" board_value = self.detector.get_device_model() if "NXP i.MX8MPlus SOM" in board_value: return boards.NXP_IMX8MPLUS_SOM return None def _imx6ull_id(self) -> Optional[str]: """Check what type iMX6ULL board.""" board_value = self.detector.get_device_model() if "LubanCat" in board_value or "Embedfire" in board_value: return boards.LUBANCAT_IMX6ULL return None def _tegra_id(self) -> Optional[str]: """Try to detect the id of aarch64 board.""" compatible = self.detector.get_device_compatible() if not compatible: return None compats = compatible.split("\x00") for board_id, board_compats in boards._JETSON_IDS: if any(v in compats for v in board_compats): return board_id return None def _sifive_id(self) -> Optional[str]: """Try to detect the id for Sifive RISCV64 board.""" board_value = self.detector.get_device_model() if "hifive-unleashed-a00" in board_value: return boards.SIFIVE_UNLEASHED return None def _allwinner_id(self) -> Optional[str]: """Try to detect the id for Allwiner D1 board.""" board_value = self.detector.get_device_model() if "sun20iw1p1" in board_value: return boards.ALLWINER_D1 return None def _pine64_id(self) -> Optional[str]: """Try to detect the id for Pine64 board or device.""" board_value = self.detector.get_device_model() board = None if "pinephone" in board_value.lower(): board = boards.PINEPHONE elif "pine64" in board_value.lower(): board = boards.PINE64 elif "pine h64" in board_value.lower(): board = boards.PINEH64 elif "pinebook" in board_value.lower(): board = boards.PINEBOOK elif "sopine" in board_value.lower(): board = boards.SOPINE return board # pylint: disable=no-self-use def _pynq_id(self) -> Optional[str]: """Try to detect the id for Xilinx PYNQ boards.""" try: with open( "/proc/device-tree/chosen/pynq_board", "r", encoding="utf-8" ) as board_file: board_model = board_file.read() match = board_model.upper().replace("-", "_").rstrip("\x00") for model in boards._PYNQ_IDS: if model == match: return model return None except FileNotFoundError: return None def _rk3566_id(self) -> Optional[str]: """Check what type of rk3566 board.""" board_value = self.detector.get_device_model() board = None if board_value and "LubanCat-Zero" in board_value: board = boards.LUBANCAT_ZERO if board_value and any(x in board_value for x in ("LubanCat1", "LubanCat-1")): board = boards.LUBANCAT1 if board_value and "Radxa CM3 IO" in board_value: board = boards.RADXA_CM3 if board_value and "Radxa ZERO 3" in board_value: board = boards.RADXA_ZERO3 if board_value and "Radxa ROCK3 Model C" in board_value: board = boards.ROCK_PI_3C if board_value and "Rockchip RK3566 OPi 3B" in board_value: board = boards.ORANGE_PI_3B if board_value and "Hardkernel ODROID-M1S" in board_value: board = boards.ODROID_M1S elif "quartz64-a" in board_value.lower(): board = boards.QUARTZ64_A return board def _rk3568_id(self) -> Optional[str]: """Check what type of rk3568 board.""" board_value = self.detector.get_device_model() board = None if board_value and any(x in board_value for x in ("LubanCat2", "LubanCat-2")): board = boards.LUBANCAT2 if board_value and "ROCK3 Model A" in board_value: board = boards.ROCK_PI_3A if board_value and "ROCK 3 Model B" in board_value: board = boards.ROCK_3B if board_value and "Hardkernel ODROID-M1" in board_value: board = boards.ODROID_M1 return board def _rk3588_id(self) -> Optional[str]: """Check what type of rk3588 board.""" board_value = self.detector.get_device_model() board = None if board_value and "LubanCat-4" in board_value: board = boards.LUBANCAT4 if board_value and "LubanCat-5" in board_value: board = boards.LUBANCAT5 return board def _rock_pi_id(self) -> Optional[str]: """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 if board_value and "ROCK PI 4" in board_value.upper(): board = boards.ROCK_PI_4 if board_value and "ROCK PI E" in board_value.upper(): board = boards.ROCK_PI_E if self.detector.check_board_name_value() == "ROCK Pi X": board = boards.ROCK_PI_X if board_value and "ROCK 5C" in board_value.upper(): board = boards.ROCK_PI_5C elif board_value and "ROCK 5" in board_value.upper(): board = boards.ROCK_PI_5 if board_value and "RADXA ROCK 4C+" in board_value.upper(): board = boards.ROCK_PI_4_C_PLUS if board_value and "RADXA ROCK 4SE" in board_value.upper(): board = boards.ROCK_PI_4_SE if board_value and "ROCK3 Model A" in board_value: board = boards.ROCK_PI_3A return board def _vicharak_id(self) -> Optional[str]: """Check what type of Vicharak Board.""" board_value = self.detector.get_device_model() board = None if board_value and "VAAMAN" in board_value.upper(): board = boards.VAAMAN if board_value and "AXON" in board_value.upper(): board = boards.AXON return board def _libre_id(self) -> Optional[str]: """Check what type of Libre Computer board.""" board_value = self.detector.get_device_model() board = None if board_value and "Libre Computer ROC-RK3328-CC" in board_value: board = boards.ROC_RK3328_CC return board def _clockwork_pi_id(self) -> Optional[str]: """Check what type of Clockwork Pi board.""" board_value = self.detector.get_device_model() board = None if board_value and "Clockwork CPI3" in board_value: board = boards.CLOCKWORK_CPI3 return board def _udoo_id(self) -> Optional[str]: """Try to detect the id of udoo board.""" board_asset_tag = self.detector.check_board_asset_tag_value() for board_id, board_tags in boards._UDOO_BOARD_IDS.items(): if any(v == board_asset_tag for v in board_tags): return board_id if self.detector.check_board_name_value() == "UDOO x86": return boards.UDOO_X86 return None def _intel_n_series_id(self) -> Optional[str]: """Try to detect the id of an Intel N-Series board.""" if self.detector.check_board_name_value() == "ODROID-H3": return boards.ODROID_H3 return None def _j4105_id(self) -> Optional[str]: """Try to detect the id of J4105 board.""" try: with open( "/sys/devices/virtual/dmi/id/board_name", "r", encoding="utf-8" ) as board_name: board_value = board_name.read().rstrip() if board_value in ("ODYSSEY-X86J41X5", "ODYSSEY-X86J41O5"): return boards.ODYSSEY_X86J41X5 return None except FileNotFoundError: return None def _asus_tinker_board_id(self) -> Optional[str]: """Check what type of Tinker Board.""" board_value = self.detector.get_device_model() board = None if board_value and "ASUS Tinker Board" in board_value: board = boards.ASUS_TINKER_BOARD if board_value and "ASUS TINKER BOARD 2" in board_value: board = boards.ASUS_TINKER_BOARD_2 if board_value and "ASUS_TINKER_EDGE_R" in board_value: board = boards.ASUS_TINKER_EDGE_R return board def _vivid_unit_id(self) -> Optional[str]: """Check what type of vivid unit.""" board_value = self.detector.get_device_model() board = None if board_value and "RK3399 VIVID" in board_value: board = boards.VIVID_UNIT return board def _pcduino_board_id(self) -> Optional[str]: """Check on the type of Pcduino""" board_value = self.detector.get_device_model() board = None if "pcduino2" in board_value.lower(): board = boards.PCDUINO2 if "pcduino3" in board_value.lower(): board = boards.PCDUINO3 return board def _allwinner_variants_id(self) -> Optional[str]: """Try to detect the id of allwinner based board. (orangepi, nanopi)""" board_value = self.detector.get_device_model() board = None if not board_value: return board board_value = board_value.lower() chip_id = self.detector.chip.id if "banana pro" in board_value: board = boards.LEMAKER_BANANA_PRO if any(x in board_value for x in ("banana pi", "bananapi")): if "m2 berry" in board_value: board = boards.BANANA_PI_M2_BERRY elif "m4berry" in board_value or "m4 berry" in board_value: board = boards.BANANA_PI_M4_BERRY elif "m4zero" in board_value or "m4 zero" in board_value: board = boards.BANANA_PI_M4_ZERO elif "f5" in board_value or "bpi-f5" in board_value: board = boards.BANANA_PI_F5 if "nanopi" in board_value: if "neo" in board_value and "SUN8I" in chip_id: board = boards.NANOPI_NEO_AIR elif "neo2" in board_value and "H5" in chip_id: board = boards.NANOPI_NEO_2 elif any(x in board_value for x in ("orange pi", "orangepi")): if "zero" in board_value: if "H5" in chip_id: board = boards.ORANGE_PI_ZERO_PLUS_2H5 elif "H616" in chip_id: board = boards.ORANGE_PI_ZERO_2 elif "walnutpi-1b-emmc" in board_value: board = boards.WALNUT_PI_1B_EMMC elif "walnutpi-1b" in board_value: board = boards.WALNUT_PI_1B # TODO: Add other specifc board contexts here elif "lime2" in board_value: board = boards.OLIMEX_LIME2 return board def _spacemit_variants_id(self) -> Optional[str]: """Try to detect the id of spacemit based board. (bananapi)""" board_value = self.detector.get_device_model() board = None if not board_value: return board board_value = board_value.lower() if any(x in board_value for x in ("banana pi", "bananapi")): if "bpi-f3" in board_value: board = boards.BANANA_PI_F3 if "spacemit" in board_value: if "deb1" in board_value: board = boards.BANANA_PI_F3 return board def _renesas_variants_id(self) -> Optional[str]: """Try to detect the id of renesas based board. (bananapi)""" board_value = self.detector.get_device_model() board = None if not board_value: return board board_value = board_value.lower() if any(x in board_value for x in ("banana pi", "bananapi")): if "bpi-ai2n" in board_value: board = boards.BANANA_PI_AI2N if "bpi-ai2h" in board_value: board = boards.BANANA_PI_AI2H return board def _repka_variants_id(self) -> Optional[str]: board_value = self.detector.get_device_model() board = None if not board_value: return board board_value = board_value.lower() if "repka-pi3-h5" in board_value: board = boards.REPKA_PI_3_H5 if "repka-pi4-h6" in board_value: board = boards.REPKA_PI_4_H6 return board # pylint: disable=too-many-return-statements def _rp2040_u2if_id(self) -> Optional[str]: import hid # look for it based on PID/VID for dev in hid.enumerate(): # Raspberry Pi Pico vendor = dev["vendor_id"] product = dev["product_id"] if vendor == 0xCAFE and product == 0x4005: return boards.PICO_U2IF if vendor == 0xCAFF and product == 0x4005: return boards.RADXA_X4_U2IF if vendor == 0x239A: # Feather RP2040 if product == 0x00F1: return boards.FEATHER_U2IF # Itsy Bitsy RP2040 if product == 0x00FD: return boards.ITSYBITSY_U2IF # QT Py RP2040 if product == 0x00F7: return boards.QTPY_U2IF # QT2040 Trinkey if product == 0x0109: return boards.QT2040_TRINKEY_U2IF # MacroPad RP2040 if product == 0x0107: return boards.MACROPAD_U2IF # Feather RP2040 ThinkInk if product == 0x812C: return boards.FEATHER_EPD_U2IF # Feather RP2040 RFM if product == 0x812E: return boards.FEATHER_RFM_U2IF # Feather RP2040 CAN if product == 0x8130: return boards.FEATHER_CAN_U2IF # KB2040 Kee Board if product == 0x0105: return boards.KB2040_U2IF if vendor == 0x2E8A and product == 0x103A: return boards.RP2040_ONE_U2IF # Will only reach here if a device was added in chip.py but here. raise RuntimeError("RP2040_U2IF device was added to chip but not board.") # pylint: enable=too-many-return-statements def _siemens_simatic_iot2000_id(self) -> Optional[str]: """Try to detect if this is a IOT2050 Gateway.""" board_value = self.detector.get_device_model() board = None if board_value and "SIMATIC IOT2050 Advanced" in board_value: board = boards.SIEMENS_SIMATIC_IOT2050_ADV elif board_value and "SIMATIC IOT2050 Basic" in board_value: board = boards.SIEMENS_SIMATIC_IOT2050_BASIC return board def _rv1103_id(self) -> Optional[str]: """Check what type of rv1103 board.""" board_value = self.detector.get_device_model() board = None if board_value and "Luckfox Pico Mini" in board_value: board = boards.LUCKFOX_PICO_MINI elif board_value and "Luckfox Pico Plus" in board_value: board = boards.LUCKFOX_PICO_PLUS elif board_value and "Luckfox Pico" in board_value: board = boards.LUCKFOX_PICO return board def _rv1106_id(self) -> Optional[str]: """Check what type of rv1106 board.""" board_value = self.detector.get_device_model() board = None if board_value and "Luckfox Pico Max" in board_value: board = boards.LUCKFOX_PICO_MAX elif board_value and "Luckfox Pico Ultra" in board_value: board = boards.LUCKFOX_PICO_ULTRA return board @property def any_siemens_simatic_iot2000(self) -> bool: """Check whether the current board is a SIEMENS SIMATIC IOT2000 Gateway.""" return self.id in boards._SIEMENS_SIMATIC_IOT2000_IDS @property def any_walnutpi(self) -> bool: """Check whether the current board is any defined Walnut Pi.""" return self.id in boards._WALNUT_PI_IDS @property def any_nanopi(self) -> bool: """Check whether the current board is any defined Nano Pi.""" return self.id in boards._NANOPI_IDS @property def any_96boards(self) -> bool: """Check whether the current board is any 96boards board.""" return self.id in boards._LINARO_96BOARDS_IDS @property def any_raspberry_pi(self) -> bool: """Check whether the current board is any Raspberry Pi.""" return self._pi_rev_code() is not None @property def any_raspberry_pi_40_pin(self) -> bool: """Check whether the current board is any 40-pin Raspberry Pi.""" return self.id in boards._RASPBERRY_PI_40_PIN_IDS @property def any_raspberry_pi_cm(self) -> bool: """Check whether the current board is any Compute Module Raspberry Pi.""" return self.id in boards._RASPBERRY_PI_CM_IDS @property def any_raspberry_pi_4_board(self) -> bool: """Check whether the current board is any Raspberry Pi 4.""" return self.id in boards._RASPBERRY_PI_4_IDS @property def any_raspberry_pi_5_board(self) -> bool: """Check whether the current board is any Raspberry Pi 5.""" return self.id in boards._RASPBERRY_PI_5_IDS @property def any_beaglebone(self) -> bool: """Check whether the current board is any Beaglebone-family system.""" return self.id in boards._BEAGLEBONE_IDS @property def any_ameridroid(self) -> bool: """Check whether the current board is any Ameridroid device.""" return self.id in boards._AMERIDROID_IDS @property def any_orange_pi(self) -> bool: """Check whether the current board is any defined Orange Pi.""" return self.id in boards._ORANGE_PI_IDS @property def any_lubancat(self) -> bool: """Check whether the current board is any defined lubancat.""" return self.id in boards._LUBANCAT_IDS @property def any_coral_board(self) -> bool: """Check whether the current board is any defined Coral.""" return self.id in boards._CORAL_IDS @property def any_pynq_board(self) -> bool: """Check whether the current board is any defined PYNQ Board.""" return self.id in boards._PYNQ_IDS @property def any_giant_board(self) -> bool: """Check whether the current board is any defined Giant Board.""" return self.GIANT_BOARD @property def any_odroid_40_pin(self) -> bool: """Check whether the current board is any defined 40-pin Odroid.""" return self.id in boards._ODROID_40_PIN_IDS @property def any_odroid_mini_pc(self) -> bool: """Check whether the current board is any defined Odroid Mini PC.""" return self.id in boards._ODROID_MINI_PC_IDS @property def khadas_vim3_40_pin(self) -> bool: """Check whether the current board is any defined 40-pin Khadas VIM3.""" return self.id in boards._KHADAS_40_PIN_IDS @property def any_jetson_board(self) -> bool: """Check whether the current board is any defined Jetson Board.""" return self.id in [v[0] for v in boards._JETSON_IDS] @property def any_sifive_board(self) -> bool: """Check whether the current board is any defined Jetson Board.""" return self.id in boards._SIFIVE_IDS @property def any_onion_omega_board(self) -> bool: """Check whether the current board is any defined OpenWRT board.""" return self.id in boards._ONION_OMEGA_BOARD_IDS @property def any_pine64_board(self) -> bool: """Check whether the current board is any Pine64 device.""" return self.id in boards._PINE64_DEV_IDS @property def any_milkv_board(self) -> bool: """Check whether the current board is any MilkV device.""" return self.id in boards._MILKV_IDS_ @property def any_rock_pi_board(self) -> bool: """Check whether the current board is any Rock Pi device.""" return self.id in boards._ROCK_PI_IDS @property def any_vicharak_board(self) -> bool: """Check whether the current board is any vicharak device.""" return self.id in boards._VICHARAK_BOARD_IDS @property def any_clockwork_pi_board(self) -> bool: """Check whether the current board is any Clockwork Pi device.""" return self.CLOCKWORK_CPI3 @property def any_udoo_board(self) -> bool: """Check to see if the current board is an UDOO board""" return self.id in boards._UDOO_BOARD_IDS @property def any_seeed_board(self) -> bool: """Check to see if the current board is an SEEED board""" return self.id in boards._SEEED_BOARD_IDS @property def any_asus_tinker_board(self) -> bool: """Check to see if the current board is an ASUS Tinker Board""" return self.id in boards._ASUS_TINKER_BOARD_IDS @property def any_pcduino_board(self) -> bool: """Check whether the current board is any Pcduino board""" return self.id in boards._PCDUINO_DEV_IDS @property def any_stm32mp1(self) -> bool: """Check whether the current board is any stm32mp1 board.""" return self.id in boards._STM32MP1_IDS @property def any_bananapi(self) -> bool: """Check whether the current board is any BananaPi-family system.""" return self.id in boards._BANANA_PI_IDS @property def any_lemaker(self) -> bool: """Check whether the current board is any LeMaker board.""" return self.id in boards._LEMAKER_IDS @property def any_maaxboard(self) -> bool: """Check whether the current board is any BananaPi-family system.""" return self.id in boards._MAAXBOARD_IDS @property def any_tisk_board(self) -> bool: """Check whether the current board is any defined TI SK Board.""" return self.id in [v[0] for v in boards._TI_SK_BOARD_IDS] @property def any_lichee_riscv_board(self) -> bool: """Check whether the current board is any defined Lichee RISC-V.""" return self.id in boards._LICHEE_RISCV_IDS @property def any_libre_computer_board(self) -> bool: """Check whether the current board is any defined Libre Computer board.""" return self.id in boards._LIBRE_COMPUTER_IDS @property def any_nxp_navq_board(self) -> bool: """Check whether the current board is any NXP NavQ board""" return self.id in boards._NXP_SOM_IDS @property def any_olimex_board(self): """Check whether the current board is any Olimex device.""" return self.id in boards._OLIMEX_IDS @property def any_repka_board(self): """Check whether the current board is any Repka device.""" return self.id in boards._REPKA_PI_IDS @property def any_luckfox_pico_board(self): """Check whether the current board is any Luckfox Pico device.""" return self.id in boards._LUCKFOX_IDS @property def any_vivid_unit(self): """Check whether the current board is any Vivid Unit device.""" return self.id in boards._VIVID_UNIT_IDS @property def any_horizon_board(self): """Check whether the current board is any Horizon device.""" return self.id in boards._HORIZON_IDS @property def any_particle_board(self): """Check whether the current board is any Particle device.""" return self.id in boards._PARTICLE_IDS @property def any_raspberry_pi_pico_id(self): """Check whether the current board is any Raspberry Pi Pico.""" return self.id in boards._RASPBERRY_PI_PICO_IDS @property def os_environ_board(self) -> bool: """Check whether the current board is an OS environment variable special case.""" def lazily_generate_conditions(): yield self.board.FTDI_FT232H yield self.board.FTDI_FT2232H yield self.board.FTDI_FT4232H yield self.board.MICROCHIP_MCP2221 yield self.board.BINHO_NOVA yield self.board.GREATFET_ONE yield self.board.PICO_U2IF yield self.board.FEATHER_U2IF yield self.board.FEATHER_CAN_U2IF yield self.board.FEATHER_EPD_U2IF yield self.board.FEATHER_RFM_U2IF yield self.board.ITSYBITY_U2IF yield self.board.MACROPAD_U2IF yield self.board.QTPY_U2IF yield self.board.QT2040_TRINKEY_U2IF yield self.board.KB2040_U2IF yield self.board.RP2040_ONE_U2IF yield self.board.RADXA_X4_U2IF yield self.board.OS_AGNOSTIC_BOARD return any(condition for condition in lazily_generate_conditions()) @property def any_embedded_linux(self) -> bool: """Check whether the current board is any embedded Linux device.""" def lazily_generate_conditions(): yield self.any_raspberry_pi_40_pin yield self.any_raspberry_pi yield self.any_beaglebone yield self.any_ameridroid yield self.any_orange_pi yield self.any_nanopi yield self.any_giant_board yield self.any_jetson_board yield self.any_coral_board yield self.any_odroid_40_pin yield self.any_odroid_mini_pc yield self.khadas_vim3_40_pin yield self.any_96boards yield self.any_sifive_board yield self.any_onion_omega_board yield self.any_pine64_board yield self.any_pynq_board yield self.any_rock_pi_board yield self.any_clockwork_pi_board yield self.any_udoo_board yield self.any_seeed_board yield self.any_asus_tinker_board yield self.any_stm32mp1 yield self.any_lubancat yield self.any_bananapi yield self.any_lemaker yield self.any_maaxboard yield self.any_tisk_board yield self.any_siemens_simatic_iot2000 yield self.any_lichee_riscv_board yield self.any_pcduino_board yield self.any_libre_computer_board yield self.generic_linux yield self.any_nxp_navq_board yield self.any_walnutpi yield self.any_olimex_board yield self.any_repka_board yield self.any_milkv_board yield self.any_luckfox_pico_board yield self.any_vivid_unit yield self.any_starfive_id yield self.any_horizon_board yield self.any_particle_board return any(condition for condition in lazily_generate_conditions()) @property def generic_linux(self) -> bool: """Check whether the current board is an Generic Linux System.""" return self.id == boards.GENERIC_LINUX_PC @property def ftdi_ft232h(self) -> bool: """Check whether the current board is an FTDI FT232H.""" return self.id == boards.FTDI_FT232H @property def ftdi_ft2232h(self) -> bool: """Check whether the current board is an FTDI FT2232H.""" return self.id == boards.FTDI_FT2232H @property def excamera_spidriver(self) -> bool: """Check whether the current board is an Excamera SPIDriver.""" return self.id == boards.EXCAMERA_SPIDRIVER @property def ftdi_ft4232h(self) -> bool: """Check whether the current board is an FTDI FT4232H.""" return self.id == boards.FTDI_FT4232H @property def microchip_mcp2221(self) -> bool: """Check whether the current board is a Microchip MCP2221.""" return self.id == boards.MICROCHIP_MCP2221 @property def os_agnostic_board(self) -> bool: """Check whether the current board is an OS agnostic special case.""" return self.id == boards.OS_AGNOSTIC_BOARD @property def pico_u2if(self) -> bool: """Check whether the current board is a RPi Pico w/ u2if.""" return self.id == boards.PICO_U2IF @property def feather_u2if(self) -> bool: """Check whether the current board is a Feather RP2040 w/ u2if.""" return self.id == boards.FEATHER_U2IF @property def feather_can_u2if(self) -> bool: """Check whether the current board is a Feather CAN Bus RP2040 w/ u2if.""" return self.id == boards.FEATHER_CAN_U2IF @property def feather_epd_u2if(self) -> bool: """Check whether the current board is a Feather ThinkInk RP2040 w/ u2if.""" return self.id == boards.FEATHER_EPD_U2IF @property def feather_rfm_u2if(self) -> bool: """Check whether the current board is a Feather RFM RP2040 w/ u2if.""" return self.id == boards.FEATHER_RFM_U2IF @property def itsybitsy_u2if(self) -> bool: """Check whether the current board is a Itsy Bitsy w/ u2if.""" return self.id == boards.ITSYBITSY_U2IF @property def macropad_u2if(self) -> bool: """Check whether the current board is a MacroPad w/ u2if.""" return self.id == boards.MACROPAD_U2IF @property def qtpy_u2if(self) -> bool: """Check whether the current board is a QT Py w/ u2if.""" return self.id == boards.QTPY_U2IF @property def qt2040_trinkey_u2if(self) -> bool: """Check whether the current board is a QT Py w/ u2if.""" return self.id == boards.QT2040_TRINKEY_U2IF @property def kb2040_u2if(self) -> bool: """Check whether the current board is a KB2040 w/ u2if.""" return self.id == boards.KB2040_U2IF @property def rp2040_one_u2if(self) -> bool: """Check whether the current board is an RP2040 One w/ u2if.""" return self.id == boards.RP2040_ONE_U2IF @property def radxa_x4_u2if(self) -> bool: """Check whether the current board is an RP2040 One w/ u2if.""" return self.id == boards.RADXA_X4_U2IF @property def binho_nova(self) -> bool: """Check whether the current board is an BINHO NOVA.""" return self.id == boards.BINHO_NOVA @property def greatfet_one(self) -> bool: """Check whether the current board is a GreatFET One.""" return self.id == boards.GREATFET_ONE def __getattr__(self, attr: str) -> bool: """ Detect whether the given attribute is the currently-detected board. See list of constants at the top of this module for available options. """ if self.id == attr: return True return False adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/chip.py000066400000000000000000000451671514737240100302310ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `adafruit_platformdetect.chip` ================================================================================ Attempt detection of current chip / CPU * Author(s): Melissa LeBlanc-Williams Implementation Notes -------------------- **Software and Dependencies:** * Linux and Python 3.7 or Higher """ import os import sys try: from typing import Optional except ImportError: pass from adafruit_platformdetect.constants import chips __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git" class Chip: """Attempt detection of current chip / CPU.""" def __init__(self, detector) -> None: self.detector = detector self._chip_id = None # pylint: disable=invalid-name,too-many-branches,too-many-return-statements @property def id( self, ) -> Optional[str]: """Return a unique id for the detected chip, if any.""" # There are some times we want to trick the platform detection # say if a raspberry pi doesn't have the right ID, or for testing # Caching if self._chip_id: return self._chip_id if getattr(os, "environ", None) is not None: try: return os.environ["BLINKA_FORCECHIP"] except KeyError: # no forced chip, continue with testing! pass # Special cases controlled by environment var if os.environ.get("BLINKA_FT232H"): from pyftdi.usbtools import UsbTools # look for it based on PID/VID count = len(UsbTools.find_all([(0x0403, 0x6014)])) if count == 0: raise RuntimeError( "BLINKA_FT232H environment variable " + "set, but no FT232H device found" ) self._chip_id = chips.FT232H return self._chip_id if os.environ.get("BLINKA_FT2232H"): from pyftdi.usbtools import UsbTools # look for it based on PID/VID count = len(UsbTools.find_all([(0x0403, 0x6010)])) if count == 0: raise RuntimeError( "BLINKA_FT2232H environment variable " + "set, but no FT2232H device found" ) self._chip_id = chips.FT2232H return self._chip_id if os.environ.get("BLINKA_FT4232H"): from pyftdi.usbtools import UsbTools # look for it based on PID/VID count = len(UsbTools.find_all([(0x0403, 0x6011)])) if count == 0: raise RuntimeError( "BLINKA_FT4232H environment variable " + "set, but no FT4232H device found" ) self._chip_id = chips.FT4232H return self._chip_id if os.environ.get("BLINKA_MCP2221"): import hid # look for it based on PID/VID for dev in hid.enumerate(): if dev["vendor_id"] == 0x04D8 and dev["product_id"] == 0x00DD: self._chip_id = chips.MCP2221 return self._chip_id raise RuntimeError( "BLINKA_MCP2221 environment variable " + "set, but no MCP2221 device found" ) if os.environ.get("BLINKA_SPIDRIVER"): self._chip_id = chips.SPIDRIVER return self._chip_id if os.environ.get("BLINKA_OS_AGNOSTIC"): # we don't need to look for this chip, it's just a flag self._chip_id = chips.OS_AGNOSTIC return self._chip_id if os.environ.get("BLINKA_U2IF"): import hid # look for it based on PID/VID for dev in hid.enumerate(): vendor = dev["vendor_id"] product = dev["product_id"] # NOTE: If any products are added here, they need added # to _rp2040_u2if_id() in board.py as well. # pylint: disable=too-many-boolean-expressions if ( ( # Raspberry Pi Pico # Radxa X4 vendor in (0xCAFE, 0xCAFF) and product == 0x4005 ) or ( # Waveshare RP2040 One vendor == 0x2E8A and product == 0x103A ) or ( # Feather RP2040 # Itsy Bitsy RP2040 # QT Py RP2040 # QT2040 Trinkey # MacroPad RP2040 # Feather RP2040 ThinkInk # Feather RP2040 RFM # Feather RP2040 CAN Bus vendor == 0x239A and product in ( 0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107, 0x812C, 0x812E, 0x8130, 0x0105, ) ) ): self._chip_id = chips.RP2040_U2IF return self._chip_id raise RuntimeError( "BLINKA_U2IF environment variable " + "set, but no compatible device found" ) if os.environ.get("BLINKA_GREATFET"): import usb if usb.core.find(idVendor=0x1D50, idProduct=0x60E6) is not None: self._chip_id = chips.LPC4330 return self._chip_id raise RuntimeError( "BLINKA_GREATFET environment variable " + "set, but no GreatFET device found" ) if os.environ.get("BLINKA_NOVA"): self._chip_id = chips.BINHO return self._chip_id platform = sys.platform if platform in ("linux", "linux2"): self._chip_id = self._linux_id() return self._chip_id if platform == "esp8266": self._chip_id = chips.ESP8266 return self._chip_id if platform == "samd21": self._chip_id = chips.SAMD21 return self._chip_id if platform == "pyboard": self._chip_id = chips.STM32F405 return self._chip_id if platform == "rp2" and "RP2350" in os.uname().machine: self._chip_id = chips.RP2350 return self._chip_id if platform == "rp2" and "RP2040" in os.uname().machine: self._chip_id = chips.RP2040 return self._chip_id # nothing found! return None # pylint: enable=invalid-name def _linux_id(self) -> Optional[str]: # 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("beagle,am67a-beagley-ai"): return chips.AM67A if self.detector.check_dt_compatible_value("ti,am625"): return chips.AM625X if self.detector.check_dt_compatible_value("ti,am654"): return chips.AM65XX if self.detector.check_dt_compatible_value("ti,am652"): return chips.AM65XX if self.detector.check_dt_compatible_value("sun4i-a10"): return chips.A10 if self.detector.check_dt_compatible_value("sun7i-a20"): return chips.A20 if self.detector.check_dt_compatible_value("amlogic,g12a"): return chips.S905Y2 if self.detector.check_dt_compatible_value("amlogic, g12a"): return chips.S905X3 if self.detector.check_dt_compatible_value("sun8i-h3"): return chips.H3 if self.detector.check_dt_compatible_value("qcom,apq8016"): return chips.APQ8016 if self.detector.check_dt_compatible_value("fu500"): return chips.HFU540 if self.detector.check_dt_compatible_value("sun20iw1p1"): return chips.C906 # Older Builds if self.detector.check_dt_compatible_value("sifive"): return chips.JH71X0 # Newer Builds if self.detector.check_dt_compatible_value("jh7100"): return chips.JH71X0 if self.detector.check_dt_compatible_value("jh7110"): return chips.JH7110 if self.detector.check_dt_compatible_value("sun8i-a33"): return chips.A33 if self.detector.check_dt_compatible_value("rockchip,rk3308"): return chips.RK3308 if self.detector.check_dt_compatible_value("radxa,rock-4c-plus"): return chips.RK3399_T if self.detector.check_dt_compatible_value("rockchip,rk3399pro"): return chips.RK3399PRO if self.detector.check_dt_compatible_value("rockchip,rk3399"): return chips.RK3399 if self.detector.check_dt_compatible_value("rockchip,rk3288"): return chips.RK3288 if self.detector.check_dt_compatible_value("rockchip,rk3328"): return chips.RK3328 if self.detector.check_dt_compatible_value("rockchip,rk3566"): return chips.RK3566 if self.detector.check_dt_compatible_value("rockchip,rk3568"): return chips.RK3568 if self.detector.check_dt_compatible_value("rockchip,rk3588s"): return chips.RK3588S if self.detector.check_dt_compatible_value("rockchip,rk3588"): return chips.RK3588 if self.detector.check_dt_compatible_value("rockchip,rv1106"): return chips.RV1106 if self.detector.check_dt_compatible_value("rockchip,rv1103"): return chips.RV1103 if self.detector.check_dt_compatible_value("amlogic,a311d"): return chips.A311D if self.detector.check_dt_compatible_value("st,stm32mp157"): return chips.STM32MP157 if self.detector.check_dt_compatible_value("st,stm32mp153"): return chips.STM32MP157DAA1 if self.detector.check_dt_compatible_value("sun50i-a64"): return chips.A64 if self.detector.check_dt_compatible_value("sun50i-h5"): return chips.H5 if self.detector.check_dt_compatible_value("sun50i-h618"): return chips.H618 if self.detector.check_dt_compatible_value("sun50i-h616"): return chips.H616 if self.detector.check_dt_compatible_value("sun50iw9"): return chips.H616 if self.detector.check_dt_compatible_value("sun50i-h6"): return chips.H6 if self.detector.check_dt_compatible_value("sun55iw3"): return chips.T527 if self.detector.check_dt_compatible_value("spacemit,k1-x"): return chips.K1 if self.detector.check_dt_compatible_value("renesas,r9a09g056"): return chips.RZV2N if self.detector.check_dt_compatible_value("renesas,r9a09g057"): return chips.RZV2H if self.detector.check_dt_compatible_value("mediatek,mt8167"): return chips.MT8167 if self.detector.check_dt_compatible_value("imx6ull"): return chips.IMX6ULL if self.detector.check_dt_compatible_value("ti,j721e"): return chips.TDA4VM if self.detector.check_dt_compatible_value("sun20i-d1"): return chips.D1_RISCV if self.detector.check_dt_compatible_value("imx8mp"): return chips.IMX8MP if self.detector.check_dt_compatible_value("libretech,aml-s905x-cc"): return chips.S905X if self.detector.check_dt_compatible_value("light-lpi4a"): return chips.TH1520 if self.detector.check_dt_compatible_value("hobot,x3"): return chips.SUNRISE_X3 if self.detector.check_dt_compatible_value("Horizon, x5"): return chips.SUNRISE_X5 if self.detector.check_dt_compatible_value("particle,tachyon"): return chips.QCM6490 linux_id = None hardware = self.detector.get_cpuinfo_field("Hardware") if hardware is None: vendor_id = self.detector.get_cpuinfo_field("vendor_id") if vendor_id == "AuthenticAMD": model_name = self.detector.get_cpuinfo_field("model name").upper() if "RYZEN EMBEDDED V1202B" in model_name: linux_id = chips.RYZEN_V1202B if "RYZEN EMBEDDED V1605B" in model_name: linux_id = chips.RYZEN_V1605B else: linux_id = chips.GENERIC_X86 ## print("linux_id = ", linux_id) elif vendor_id == "GenuineIntel": model_name = self.detector.get_cpuinfo_field("model name").upper() ## print('model_name =', model_name) if "N3710" in model_name: linux_id = chips.PENTIUM_N3710 if "N5105" in model_name: linux_id = chips.CELERON_N5105 elif "X5-Z8350" in model_name: linux_id = chips.ATOM_X5_Z8350 elif "J4105" in model_name: linux_id = chips.ATOM_J4105 else: linux_id = chips.GENERIC_X86 ## print("linux_id = ", linux_id) compatible = self.detector.get_device_compatible() if compatible and "tegra" in compatible: compats = compatible.split("\x00") if "nvidia,tegra210" in compats: linux_id = chips.T210 elif "nvidia,tegra186" in compats: linux_id = chips.T186 elif "nvidia,tegra194" in compats: linux_id = chips.T194 elif "nvidia,tegra234" in compats: linux_id = chips.T234 elif "nvidia,tegra264" in compats: linux_id = chips.T264 if compatible and "imx8m" in compatible: linux_id = chips.IMX8MX if compatible and "odroid-c2" in compatible: linux_id = chips.S905 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 "vim3amlogic" in compatible_list: return chips.A311D if compatible and "sun50i-a64" in compatible: linux_id = chips.A64 if compatible and "sun50i-h6" in compatible: linux_id = chips.H6 if compatible and "sun50i-h5" in compatible: linux_id = chips.H5 if compatible and "odroid-xu4" in compatible: linux_id = chips.EXYNOS5422 if compatible and "cvitek,cv180x" in compatible: linux_id = chips.CV1800B if compatible and "xlnx,zynqmp" in compatible: linux_id = chips.ZYNQMP cpu_model = self.detector.get_cpuinfo_field("cpu model") if cpu_model is not None: if "MIPS 24Kc" in cpu_model: linux_id = chips.MIPS24KC elif "MIPS 24KEc" in cpu_model: linux_id = chips.MIPS24KEC # we still haven't identified the hardware, so # convert it to a list and let the remaining # conditions attempt. if not linux_id: hardware = [ entry.replace("\x00", "") for entry in compatible.split(",") ] if not linux_id: if "AM33XX" in hardware: linux_id = chips.AM33XX elif "DRA74X" in hardware: linux_id = chips.DRA74X elif "sun4i" in hardware: linux_id = chips.A10 elif "sun7i" in hardware: linux_id = chips.A20 elif "sun8i" in hardware: linux_id = chips.SUN8I elif "ODROIDC" in hardware: linux_id = chips.S805 elif "ODROID-C2" in hardware: linux_id = chips.S905 elif "ODROID-N2" in hardware: linux_id = chips.S922X elif "ODROID-C4" in hardware: linux_id = chips.S905X3 elif "ODROID-XU4" in hardware: linux_id = chips.EXYNOS5422 elif "KHADAS-VIM3" in hardware: linux_id = chips.A311D elif "SAMA5" in hardware: linux_id = chips.SAMA5 elif "Pinebook" in hardware: linux_id = chips.A64 elif "ASUS_TINKER_BOARD" in hardware: linux_id = chips.RK3288 elif "Xilinx Zynq" in hardware: compatible = self.detector.get_device_compatible() if compatible and "xlnx,zynq-7000" in compatible: linux_id = chips.ZYNQ7000 else: if isinstance(hardware, str): if hardware.upper() in chips.BCM_RANGE: linux_id = chips.BCM2XXX elif isinstance(hardware, list): if {model.upper() for model in hardware} & chips.BCM_RANGE: linux_id = chips.BCM2XXX return linux_id def __getattr__(self, attr: str) -> bool: """ Detect whether the given attribute is the currently-detected chip. See list of constants at the top of this module for available options. """ if attr == "id": raise AttributeError() # Avoid infinite recursion if self.id == attr: return True return False adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/constants/000077500000000000000000000000001514737240100307335ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/constants/__init__.py000066400000000000000000000002431514737240100330430ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """Common constants used all over the module.""" adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/constants/boards.py000066400000000000000000000436301514737240100325650ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """Definition of boards and/or ids""" # Allow for aligned constant definitions: VISIONFIVE2 = "VISIONFIVE2" BEAGLE_PLAY = "BEAGLE_PLAY" BEAGLEBONE_AI64 = "BEAGLEBONE_AI64" BEAGLEBONE = "BEAGLEBONE" BEAGLEBONE_BLACK = "BEAGLEBONE_BLACK" BEAGLEBONE_BLUE = "BEAGLEBONE_BLUE" BEAGLEBONE_BLACK_WIRELESS = "BEAGLEBONE_BLACK_WIRELESS" BEAGLEBONE_POCKETBEAGLE = "BEAGLEBONE_POCKETBEAGLE" BEAGLEBONE_GREEN = "BEAGLEBONE_GREEN" BEAGLEBONE_GREEN_WIRELESS = "BEAGLEBONE_GREEN_WIRELESS" BEAGLEBONE_GREEN_GATEWAY = "BEAGLEBONE_GREEN_GATEWAY" BEAGLEBONE_BLACK_INDUSTRIAL = "BEAGLEBONE_BLACK_INDUSTRIAL" BEAGLEBONE_ENHANCED = "BEAGLEBONE_ENHANCED" BEAGLEBONE_USOMIQ = "BEAGLEBONE_USOMIQ" BEAGLEBONE_AIR = "BEAGLEBONE_AIR" BEAGLEBONE_AI = "BEAGLEBONE_AI" BEAGLEBONE_POCKETBONE = "BEAGLEBONE_POCKETBONE" BEAGLEV_STARLIGHT = "BEAGLEV_STARLIGHT" BEAGLEY_AI = "BEAGLEY_AI" BEAGLELOGIC_STANDALONE = "BEAGLELOGIC_STANDALONE" OSD3358_DEV_BOARD = "OSD3358_DEV_BOARD" OSD3358_SM_RED = "OSD3358_SM_RED" OLIMEX_LIME2 = "OLIMEX_LIME2" FEATHER_HUZZAH = "FEATHER_HUZZAH" FEATHER_M0_EXPRESS = "FEATHER_M0_EXPRESS" GENERIC_LINUX_PC = "GENERIC_LINUX_PC" PYBOARD = "PYBOARD" NODEMCU = "NODEMCU" RASPBERRY_PI_PICO = "RASPBERRY_PI_PICO" RASPBERRY_PI_PICO_W = "RASPBERRY_PI_PICO_W" RASPBERRY_PI_PICO_2 = "RASPBERRY_PI_PICO_2" RASPBERRY_PI_PICO_2_W = "RASPBERRY_PI_PICO_2_W" GIANT_BOARD = "GIANT_BOARD" # ASUS Tinker Boards ASUS_TINKER_BOARD = "ASUS_TINKER_BOARD" ASUS_TINKER_BOARD_2 = "ASUS_TINKER_BOARD_2" ASUS_TINKER_EDGE_R = "ASUS_TINKER_EDGE_R" # Walnut Pi boards WALNUT_PI_1B = "WALNUT_PI_1B" WALNUT_PI_1B_EMMC = "WALNUT_PI_1B_EMMC" # Clockwork Pi boards CLOCKWORK_CPI3 = "CLOCKWORK_CPI3" # Orange Pi boards ORANGE_PI_PC = "ORANGE_PI_PC" ORANGE_PI_R1 = "ORANGE_PI_R1" ORANGE_PI_ZERO = "ORANGE_PI_ZERO" ORANGE_PI_ONE = "ORANGE_PI_ONE" ORANGE_PI_LITE = "ORANGE_PI_LITE" ORANGE_PI_PC_PLUS = "ORANGE_PI_PC_PLUS" ORANGE_PI_PLUS_2E = "ORANGE_PI_PLUS_2E" ORANGE_PI_2 = "ORANGE_PI_2" ORANGE_PI_PC2 = "ORANGE_PI_PC2" ORANGE_PI_ZERO_PLUS_2H5 = "ORANGE_PI_ZERO_PLUS_2H5" ORANGE_PI_ZERO_PLUS = "ORANGE_PI_ZERO_PLUS" ORANGE_PI_ZERO_2 = "ORANGE_PI_ZERO_2" ORANGE_PI_ZERO_2W = "ORANGE_PI_ZERO_2W" ORANGE_PI_ZERO_3 = "ORANGE_PI_ZERO_3" ORANGE_PI_3 = "ORANGE_PI_3" ORANGE_PI_3B = "ORANGE_PI_3B" ORANGE_PI_3_LTS = "ORANGE_PI_3_LTS" ORANGE_PI_4 = "ORANGE_PI_4" ORANGE_PI_4_LTS = "ORANGE_PI_4_LTS" ORANGE_PI_5 = "ORANGE_PI_5" ORANGE_PI_5_MAX = "ORANGE_PI_5_MAX" ORANGE_PI_5_ULTRA = "ORANGE_PI_5_ULTRA" ORANGE_PI_5_PLUS = "ORANGE_PI_5_PLUS" ORANGE_PI_5_PRO = "ORANGE_PI_5_PRO" # Nano Pi boards NANOPI_NEO_AIR = "NANOPI_NEO_AIR" NANOPI_DUO2 = "NANOPI_DUO2" NANOPI_NEO = "NANOPI_NEO" NANOPI_NEO_2 = "NANOPI_NEO_2" # Banana Pi boards BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO" BANANA_PI_M2_PLUS = "BANANA_PI_M2_PLUS" BANANA_PI_M2_BERRY = "BANANA_PI_M2_BERRY" BANANA_PI_M4_BERRY = "BANANA_PI_M4_BERRY" BANANA_PI_M4_ZERO = "BANANA_PI_M4_ZERO" BANANA_PI_M5 = "BANANA_PI_M5" BANANA_PI_F3 = "BANANA_PI_F3" BANANA_PI_F5 = "BANANA_PI_F5" BANANA_PI_AI2N = "BANANA_PI_AI2N" BANANA_PI_AI2H = "BANANA_PI_AI2H" BANANA_PI_P2_PRO = "BANANA_PI_P2_PRO" # LeMaker boards LEMAKER_BANANA_PRO = "LEMAKER_BANANA_PRO" # NVIDIA Jetson boards JETSON_TX1 = "JETSON_TX1" JETSON_TX2 = "JETSON_TX2" JETSON_TX2_NX = "JETSON_TX2_NX" CLARA_AGX_XAVIER = "CLARA_AGX_XAVIER" JETSON_XAVIER = "JETSON_XAVIER" JETSON_AGX_ORIN = "JETSON_ORIN" JETSON_NANO = "JETSON_NANO" JETSON_NX = "JETSON_NX" JETSON_ORIN_NANO = "JETSON_ORIN_NANO" JETSON_ORIN_NX = "JETSON_ORIN_NX" JETSON_THOR = "JETSON_THOR" # Texas Instruments SK boards TI_J721E_SK = "TI_J721E_SK" # Google Coral dev board CORAL_EDGE_TPU_DEV = "CORAL_EDGE_TPU_DEV" CORAL_EDGE_TPU_DEV_MINI = "CORAL_EDGE_TPU_DEV_MINI" # Xilinx PYNQ FPGA dev boards PYNQ_Z1 = "PYNQ_Z1" PYNQ_Z2 = "PYNQ_Z2" # STM32 MPU boards STM32MP157C_DK2 = "STM32MP157C_DK2" OSD32MP1_BRK = "OSD32MP1_BRK" OSD32MP1_RED = "OSD32MP1_RED" STMP157_OLINUXINO_LIME2 = "STMP157_OLINUXINO_LIME2" # Embedfire LubanCat board LUBANCAT_IMX6ULL = "LUBANCAT_IMX6ULL" LUBANCAT_STM32MP157 = "LUBANCAT_STM32MP157" LUBANCAT_ZERO = "LUBANCAT_ZERO" LUBANCAT1 = "LUBANCAT1" LUBANCAT2 = "LUBANCAT2" LUBANCAT4 = "LUBANCAT4" LUBANCAT5 = "LUBANCAT5" # Various Raspberry Pi models RASPBERRY_PI_B_REV1 = "RASPBERRY_PI_B_REV1" RASPBERRY_PI_B_REV2 = "RASPBERRY_PI_B_REV2" RASPBERRY_PI_B_PLUS = "RASPBERRY_PI_B_PLUS" RASPBERRY_PI_A = "RASPBERRY_PI_A" RASPBERRY_PI_A_PLUS = "RASPBERRY_PI_A_PLUS" RASPBERRY_PI_CM1 = "RASPBERRY_PI_CM1" RASPBERRY_PI_ZERO = "RASPBERRY_PI_ZERO" RASPBERRY_PI_ZERO_W = "RASPBERRY_PI_ZERO_W" RASPBERRY_PI_ZERO_2_W = "RASPBERRY_PI_ZERO_2_W" RASPBERRY_PI_2B = "RASPBERRY_PI_2B" RASPBERRY_PI_3B = "RASPBERRY_PI_3B" RASPBERRY_PI_3B_PLUS = "RASPBERRY_PI_3B_PLUS" RASPBERRY_PI_CM3 = "RASPBERRY_PI_CM3" RASPBERRY_PI_3A_PLUS = "RASPBERRY_PI_3A_PLUS" RASPBERRY_PI_CM3_PLUS = "RASPBERRY_PI_CM3_PLUS" RASPBERRY_PI_4B = "RASPBERRY_PI_4B" RASPBERRY_PI_AVNET_IIOT_GW = "RASPBERY_PI_AVNET_IIOT_GW" RASPBERRY_PI_400 = "RASPBERRY_PI_400" RASPBERRY_PI_CM4 = "RASPBERRY_PI_CM4" RASPBERRY_PI_CM4S = "RASPBERRY_PI_CM4S" RASPBERRY_PI_5 = "RASPBERRY_PI_5" RASPBERRY_PI_CM5 = "RASPBERRY_PI_CM5" RASPBERRY_PI_500 = "RASPBERRY_PI_500" RASPBERRY_PI_CM5_LITE = "RASPBERRY_PI_CM5_LITE" ODROID_C1 = "ODROID_C1" ODROID_C1_PLUS = "ODROID_C1_PLUS" ODROID_C2 = "ODROID_C2" ODROID_C4 = "ODROID_C4" ODROID_H3 = "ODROID_H3" ODROID_N2 = "ODROID_N2" ODROID_XU4 = "ODROID_XU4" ODROID_M1 = "ODROID_M1" ODROID_M1S = "ODROID_M1S" FTDI_FT232H = "FTDI_FT232H" FTDI_FT2232H = "FTDI_FT2232H" FTDI_FT4232H = "FTDI_FT4232H" DRAGONBOARD_410C = "DRAGONBOARD_410C" EXCAMERA_SPIDRIVER = "EXCAMERA_SPIDRIVER" EXCAMERA_I2CDRIVER = "EXCAMERA_I2CDRIVER" SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED" ALLWINER_D1 = "ALLWINER_D1" LICHEE_RV = "LICHEE_RV" LICHEEPI_4A = "LICHEEPI_4A" MICROCHIP_MCP2221 = "MICROCHIP_MCP2221" # Linkspirte Pcduino based boards PCDUINO2 = "PCDUINO2" PCDUINO3 = "PCDUINO3" # Boards with u2if firmware # https://github.com/execuc/u2if PICO_U2IF = "PICO_U2IF" FEATHER_U2IF = "FEATHER_U2IF" FEATHER_CAN_U2IF = "FEATHER_CAN_U2IF" FEATHER_EPD_U2IF = "FEATHER_EPD_U2IF" FEATHER_RFM_U2IF = "FEATHER_RFM_U2IF" ITSYBITSY_U2IF = "ITSYBITSY_U2IF" MACROPAD_U2IF = "MACROPAD_U2IF" QTPY_U2IF = "QTPY_U2IF" QT2040_TRINKEY_U2IF = "QT2040_TRINKEY_U2IF" KB2040_U2IF = "KB2040_U2IF" RP2040_ONE_U2IF = "RP2040_ONE_U2IF" RADXA_X4_U2IF = "RADXA_X4_U2IF" BINHO_NOVA = "BINHO_NOVA" ONION_OMEGA = "ONION_OMEGA" ONION_OMEGA2 = "ONION_OMEGA2" PINE64 = "PINE64" PINEH64 = "PINEH64" PINEBOOK = "PINEBOOK" PINEPHONE = "PINEPHONE" SOPINE = "SOPINE" QUARTZ64_A = "QUARTZ64_A" RADXA_ZERO = "RADXA_ZERO" RADXA_ZERO3 = "RADXA_ZERO3" RADXA_CM3 = "RADXA_CM3" ROCK_PI_3A = "ROCK_PI_3A" ROCK_3B = "ROCK_3B" ROCK_PI_3C = "ROCK_PI_3C" ROCK_PI_S = "ROCK_PI_S" ROCK_PI_4 = "ROCK_PI_4" ROCK_PI_4_C_PLUS = "ROCK_PI_4C+" ROCK_PI_4_SE = "ROCK_PI_4_SE" ROCK_PI_X = "ROCK_PI_X" ROCK_PI_E = "ROCK_PI_E" ROCK_PI_5 = "ROCK_PI_5" ROCK_PI_5C = "ROCK_PI_5C" # Vicharak Boards VAAMAN = "VAAMAN" AXON = "AXON" GREATFET_ONE = "GREATFET_ONE" # SeeedStudio boards ODYSSEY_X86J41X5 = "ODYSSEY_X86J41X5" # Udoo boards UDOO_BOLT_V3 = "UDOO_BOLT_V3" UDOO_BOLT_V8 = "UDOO_BOLT_V8" UDOO_X86 = "UDOO_X86" # MaaXBoard MAAXBOARD = "MAAXBOARD" MAAXBOARD_MINI = "MAAXBOARD_MINI" # Shenzhen MilkV Technology boards ids MILKV_DUO = "MILKV_DUO" # Khadas VIM3 KHADAS_VIM3 = "KHADAS_VIM3" _KHADAS_40_PIN_IDS = (KHADAS_VIM3,) # Vivid Unit VIVID_UNIT = "VIVID_UNIT" _VIVID_UNIT_IDS = (VIVID_UNIT,) # Luckfox Pico boards LUCKFOX_PICO = "LUCKFOX_PICO" LUCKFOX_PICO_MAX = "LUCKFOX_PICO_MAX" LUCKFOX_PICO_ULTRA = "LUCKFOX_PICO_ULTRA" LUCKFOX_PICO_MINI = "LUCKFOX_PICO_MINI" LUCKFOX_PICO_PLUS = "LUCKFOX_PICO_PLUS" # Ameridroid boards INDIEDROID_NOVA = "INDIEDROID_NOVA" # Horizon RDK_X3 = "RDK_X3" RDK_X5 = "RDK_X5" # Particle PARTICLE_TACHYON = "PARTICLE_TACHYON" # StarFive boards _STARFIVE_BOARD_IDS = (VISIONFIVE2,) # Asus Tinkerboard _ASUS_TINKER_BOARD_IDS = ( ASUS_TINKER_BOARD, ASUS_TINKER_BOARD_2, ASUS_TINKER_EDGE_R, ) # WalnutPi _WALNUT_PI_IDS = ( WALNUT_PI_1B, WALNUT_PI_1B_EMMC, ) # STM32MP1 _STM32MP1_IDS = ( STM32MP157C_DK2, LUBANCAT_STM32MP157, OSD32MP1_BRK, OSD32MP1_RED, STMP157_OLINUXINO_LIME2, ) # OrangePI _ORANGE_PI_IDS = ( ORANGE_PI_PC, ORANGE_PI_R1, ORANGE_PI_ZERO, ORANGE_PI_ONE, ORANGE_PI_LITE, ORANGE_PI_PC_PLUS, ORANGE_PI_PLUS_2E, ORANGE_PI_2, ORANGE_PI_PC2, ORANGE_PI_ZERO_PLUS_2H5, ORANGE_PI_ZERO_PLUS, ORANGE_PI_ZERO_2, ORANGE_PI_ZERO_2W, ORANGE_PI_3, ORANGE_PI_3B, ORANGE_PI_3_LTS, ORANGE_PI_4, ORANGE_PI_4_LTS, ORANGE_PI_5, ORANGE_PI_5_MAX, ORANGE_PI_5_PLUS, ORANGE_PI_5_PRO, ) # NanoPi _NANOPI_IDS = ( NANOPI_NEO_AIR, NANOPI_DUO2, NANOPI_NEO, NANOPI_NEO_2, ) # BananaPI _BANANA_PI_IDS = ( BANANA_PI_M2_ZERO, BANANA_PI_M2_PLUS, BANANA_PI_M2_BERRY, BANANA_PI_M4_BERRY, BANANA_PI_M4_ZERO, BANANA_PI_M5, BANANA_PI_F3, BANANA_PI_F5, BANANA_PI_AI2N, BANANA_PI_AI2H, BANANA_PI_P2_PRO, ) # LeMaker _LEMAKER_IDS = (LEMAKER_BANANA_PRO,) # LubanCat _LUBANCAT_IDS = ( LUBANCAT_IMX6ULL, LUBANCAT_STM32MP157, LUBANCAT_ZERO, LUBANCAT1, LUBANCAT2, LUBANCAT4, LUBANCAT5, ) # Coral boards _CORAL_IDS = (CORAL_EDGE_TPU_DEV, CORAL_EDGE_TPU_DEV_MINI) _PYNQ_IDS = (PYNQ_Z1, PYNQ_Z2) _JETSON_IDS = ( (JETSON_TX1, ("nvidia,p2371-2180", "nvidia,jetson-cv")), ( JETSON_TX2, ( "nvidia,p2771-0000", "nvidia,p2771-0888", "nvidia,p3489-0000", "nvidia,lightning", "nvidia,quill", "nvidia,storm", ), ), (JETSON_TX2_NX, ("nvidia,p3509-0000+p3636-0001",)), (CLARA_AGX_XAVIER, ("nvidia,e3900-0000+p2888-0004",)), ( JETSON_XAVIER, ( "nvidia,p2972-0000", "nvidia,p2972-0006", "nvidia,jetson-xavier", "nvidia,jetson-xavier-industrial", "nvidia,galen-industrial", ), ), (JETSON_NANO, ("nvidia,p3450-0000", "nvidia,p3450-0002", "nvidia,jetson-nano")), ( JETSON_NX, ( "nvidia,p3509-0000+p3668-0000", "nvidia,p3509-0000+p3668-0001", "nvidia,p3509-0000-a00+p3668-0000-a01", "nvidia,p3509-0000-a00+p3668-0001-a01", "nvidia,p3449-0000+p3668-0000", "nvidia,p3449-0000+p3668-0001", "nvidia,p3449-0000+p3668-0003", ), ), ( JETSON_AGX_ORIN, ( "nvidia,p3737-0000+p3701-0000", "nvidia,p3737-0000+p3701-0004", "nvidia,p3737-0000+p3701-0008", "nvidia,p3737-0000+p3701-0005", "nvidia,p3737-0000+p3701-0001", ), ), ( JETSON_ORIN_NX, ( "nvidia,p3509-0000+p3767-0000", "nvidia,p3768-0000+p3767-0000", "nvidia,p3509-0000+p3767-0001", "nvidia,p3768-0000+p3767-0001", "nvidia,p3768-0000+p3767-0000-super", "nvidia,p3768-0000+p3767-0001-super", ), ), ( JETSON_ORIN_NANO, ( "nvidia,p3509-0000+p3767-0003", "nvidia,p3768-0000+p3767-0003", "nvidia,p3768-0000+p3767-0003-super", "nvidia,p3509-0000+p3767-0004", "nvidia,p3768-0000+p3767-0004", "nvidia,p3509-0000+p3767-0005", "nvidia,p3768-0000+p3767-0005", "nvidia,p3768-0000+p3767-0005-super", "nvidia,p3768-0000+p3767-0003-super", "nvidia,p3768-0000+p3767-0004-super", ), ), ( JETSON_THOR, ( "nvidia,p3971-0050+p3834-0005", "nvidia,p3971-0080+p3834-0008", "nvidia,p3971-0089+p3834-0008", "nvidia,p4071-0000+p3834-0008", ), ), ) _TI_SK_BOARD_IDS = ((TI_J721E_SK, ("ti,j721e-sk", "ti,j721e")),) # Raspberry Pi boards _RASPBERRY_PI_40_PIN_IDS = ( RASPBERRY_PI_B_PLUS, RASPBERRY_PI_A_PLUS, RASPBERRY_PI_ZERO, RASPBERRY_PI_ZERO_W, RASPBERRY_PI_ZERO_2_W, RASPBERRY_PI_2B, RASPBERRY_PI_3B, RASPBERRY_PI_3B_PLUS, RASPBERRY_PI_3A_PLUS, RASPBERRY_PI_4B, RASPBERRY_PI_AVNET_IIOT_GW, RASPBERRY_PI_400, RASPBERRY_PI_5, RASPBERRY_PI_500, ) _RASPBERRY_PI_CM_IDS = ( RASPBERRY_PI_CM1, RASPBERRY_PI_CM3, RASPBERRY_PI_CM3_PLUS, RASPBERRY_PI_CM4, RASPBERRY_PI_CM4S, RASPBERRY_PI_CM5, RASPBERRY_PI_CM5_LITE, ) # Pi 4 boards have additional peripherals _RASPBERRY_PI_4_IDS = ( RASPBERRY_PI_4B, RASPBERRY_PI_CM4, RASPBERRY_PI_CM4S, RASPBERRY_PI_400, ) # Pi 5 boards work differently _RASPBERRY_PI_5_IDS = ( RASPBERRY_PI_5, RASPBERRY_PI_CM5, RASPBERRY_PI_500, RASPBERRY_PI_CM5_LITE, ) _PI_MODELS = { 0x00: RASPBERRY_PI_A, 0x01: { 1.0: RASPBERRY_PI_B_REV1, 2.0: RASPBERRY_PI_B_REV2, }, 0x02: RASPBERRY_PI_A_PLUS, 0x03: RASPBERRY_PI_B_PLUS, 0x04: RASPBERRY_PI_2B, 0x06: RASPBERRY_PI_CM1, 0x08: RASPBERRY_PI_3B, 0x09: RASPBERRY_PI_ZERO, 0x0A: RASPBERRY_PI_CM3, 0x0B: RASPBERRY_PI_AVNET_IIOT_GW, 0x0C: RASPBERRY_PI_ZERO_W, 0x0D: RASPBERRY_PI_3B_PLUS, 0x0E: RASPBERRY_PI_3A_PLUS, 0x10: RASPBERRY_PI_CM3_PLUS, 0x11: RASPBERRY_PI_4B, 0x12: RASPBERRY_PI_ZERO_2_W, 0x13: RASPBERRY_PI_400, 0x14: RASPBERRY_PI_CM4, 0x15: RASPBERRY_PI_CM4S, 0x17: RASPBERRY_PI_5, 0x18: RASPBERRY_PI_CM5, 0x19: RASPBERRY_PI_500, 0x1A: RASPBERRY_PI_CM5_LITE, } # ODROID boards _ODROID_40_PIN_IDS = ( ODROID_C1, ODROID_C1_PLUS, ODROID_C2, ODROID_C4, ODROID_N2, ODROID_XU4, ODROID_M1, ODROID_M1S, ) _ODROID_MINI_PC_IDS = (ODROID_H3,) _BEAGLEBONE_IDS = ( BEAGLEY_AI, BEAGLE_PLAY, BEAGLEBONE_AI64, BEAGLEBONE, BEAGLEBONE_BLACK, BEAGLEBONE_BLUE, BEAGLEBONE_BLACK_WIRELESS, BEAGLEBONE_POCKETBEAGLE, BEAGLEBONE_GREEN, BEAGLEBONE_GREEN_WIRELESS, BEAGLEBONE_GREEN_GATEWAY, BEAGLEBONE_BLACK_INDUSTRIAL, BEAGLEBONE_ENHANCED, BEAGLEBONE_USOMIQ, BEAGLEBONE_AIR, BEAGLEBONE_AI, BEAGLEBONE_POCKETBONE, BEAGLELOGIC_STANDALONE, BEAGLEV_STARLIGHT, OSD3358_DEV_BOARD, OSD3358_SM_RED, ) _LINARO_96BOARDS_IDS = (DRAGONBOARD_410C,) _SIFIVE_IDS = (SIFIVE_UNLEASHED,) _OLIMEX_IDS = (OLIMEX_LIME2,) # BeagleBone eeprom board ids from: # https://github.com/beagleboard/image-builder # Thanks to zmatt on freenode #beagle for pointers. _BEAGLEBONE_BOARD_IDS = { BEAGLE_PLAY: ("A0", "7.BEAGLE"), BEAGLEBONE_AI64: ("B0", "7.BBONEA"), # Original bone/white: BEAGLEBONE: ( ("A3", "A335BONE00A3"), ("A4", "A335BONE00A4"), ("A5", "A335BONE00A5"), ("A6", "A335BONE00A6"), ("A6A", "A335BONE0A6A"), ("A6B", "A335BONE0A6B"), ("B", "A335BONE000B"), ), BEAGLEBONE_BLACK: ( ("A5", "A335BNLT00A5"), ("A5A", "A335BNLT0A5A"), ("A5B", "A335BNLT0A5B"), ("A5C", "A335BNLT0A5C"), ("A6", "A335BNLT00A6"), ("A6A", "A335BNLT0A6A"), ("B", "A335BNLT000B"), ("C", "A335BNLT000C"), ("C", "A335BNLT00C0"), ("D", "A335BNLT00D0"), ), BEAGLEBONE_BLUE: (("A2", "A335BNLTBLA2"),), BEAGLEBONE_BLACK_WIRELESS: (("A5", "A335BNLTBWA5"),), BEAGLEBONE_POCKETBEAGLE: (("A2", "A335PBGL00A2"),), BEAGLEBONE_GREEN: (("1A", "A335BNLT...."), ("UNKNOWN", "A335BNLTBBG1")), BEAGLEBONE_GREEN_WIRELESS: (("W1A", "A335BNLTGW1A"),), BEAGLEBONE_GREEN_GATEWAY: (("GA1", "A335BNLTGG1A"),), BEAGLEBONE_BLACK_INDUSTRIAL: ( ("A0", "A335BNLTAIA0"), # Arrow ("A0", "A335BNLTEIA0"), # Element14 ), BEAGLEBONE_ENHANCED: (("A", "A335BNLTSE0A"),), BEAGLEBONE_USOMIQ: (("6", "A335BNLTME06"),), BEAGLEBONE_AIR: (("A0", "A335BNLTNAD0"),), BEAGLEBONE_POCKETBONE: (("0", "A335BNLTBP00"),), OSD3358_DEV_BOARD: (("0.1", "A335BNLTGH01"),), OSD3358_SM_RED: (("0", "A335BNLTOS00"),), BEAGLELOGIC_STANDALONE: (("A", "A335BLGC000A"),), } # Onion omega boards _ONION_OMEGA_BOARD_IDS = (ONION_OMEGA, ONION_OMEGA2) # Pine64 boards and devices _PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE, SOPINE, QUARTZ64_A) # Pcduino boards _PCDUINO_DEV_IDS = (PCDUINO2, PCDUINO3) # RockPi boards and devices _ROCK_PI_IDS = ( ROCK_PI_S, ROCK_PI_4, ROCK_PI_4_C_PLUS, ROCK_PI_4_SE, ROCK_PI_X, ROCK_PI_E, RADXA_ZERO, RADXA_ZERO3, ROCK_PI_5, ROCK_PI_5C, RADXA_CM3, ROCK_PI_3A, ROCK_3B, ROCK_PI_3C, ) # Vicharak Boards _VICHARAK_BOARD_IDS = (VAAMAN, AXON) # UDOO _UDOO_BOARD_IDS = {UDOO_BOLT_V8: ("SC40-2000-0000-C0|C",), UDOO_X86: ("dummy",)} # SeeedStudio boards _SEEED_BOARD_IDS = (ODYSSEY_X86J41X5,) # MaaXBoard boards _MAAXBOARD_IDS = ("MAAXBOARD", "MAAXBOARD_MINI") # Lichee RISC-V boards _LICHEE_RISCV_IDS = (LICHEE_RV, LICHEEPI_4A) # Siemens Simatic IOT2000 Gateways SIEMENS_SIMATIC_IOT2050_ADV = "SIEMENS_SIMATIC_IOT2050_ADVANCED" SIEMENS_SIMATIC_IOT2050_BASIC = "SIEMENS_SIMATIC_IOT2050_BASIC" # Siemens Simatic IOT2000 Gateways _SIEMENS_SIMATIC_IOT2000_IDS = ( SIEMENS_SIMATIC_IOT2050_ADV, SIEMENS_SIMATIC_IOT2050_BASIC, ) # Libre Computer Boards AML_S905X_CC = "AML-S905X-CC" ROC_RK3328_CC = "ROC-RK3328-CC" # Libre Computer Boards _LIBRE_COMPUTER_IDS = ( AML_S905X_CC, ROC_RK3328_CC, ) # NXP System on Module Computer boards NXP_IMX8MPLUS_SOM = "NXP_IMX8MPLUS_SOM" _NXP_SOM_IDS = (NXP_IMX8MPLUS_SOM,) # Repka-Pi boards REPKA_PI_3_H5 = "REPKA_PI_3_H5" REPKA_PI_4_H6 = "REPKA_PI_4_H6" # Repka-Pi _REPKA_PI_IDS = ( REPKA_PI_3_H5, REPKA_PI_4_H6, ) _MILKV_IDS_ = (MILKV_DUO,) # Luckfox _LUCKFOX_IDS = ( LUCKFOX_PICO, LUCKFOX_PICO_MAX, LUCKFOX_PICO_ULTRA, LUCKFOX_PICO_MINI, LUCKFOX_PICO_PLUS, ) _RASPBERRY_PI_PICO_IDS = ( RASPBERRY_PI_PICO, RASPBERRY_PI_PICO_W, RASPBERRY_PI_PICO_2, RASPBERRY_PI_PICO_2_W, ) # Horizon _HORIZON_IDS = (RDK_X3, RDK_X5) _AMERIDROID_IDS = (INDIEDROID_NOVA,) # Particle _PARTICLE_IDS = (PARTICLE_TACHYON,) # Agnostic board OS_AGNOSTIC_BOARD = "OS_AGNOSTIC_BOARD" adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/constants/chips.py000066400000000000000000000037101514737240100324140ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """Definition of chips.""" A311D = "A311D" OS_AGNOSTIC = "OS_AGNOSTIC" AM33XX = "AM33XX" AM625X = "AM625X" AM65XX = "AM65XX" AM67A = "AM67A" DRA74X = "DRA74X" TDA4VM = "TDA4VM" IMX6ULL = "IMX6ULL" IMX8MX = "IMX8MX" IMX8MP = "IMX8MP" BCM2XXX = "BCM2XXX" ESP8266 = "ESP8266" EXYNOS5422 = "EXYNOS5422" RYZEN_V1202B = "RYZEN_V1202B" RYZEN_V1605B = "RYZEN_V1605B" SAMD21 = "SAMD21" SUN4I = "SUN4I" SUN7I = "SUN7I" SUN8I = "SUN8I" S805 = "S805" S905 = "S905" S905X = "S905X" S905X3 = "S905X3" S905Y2 = "S905Y2" S922X = "S922X" SAMA5 = "SAMA5" T210 = "T210" T186 = "T186" T194 = "T194" T234 = "T234" T264 = "T264" APQ8016 = "APQ8016" GENERIC_X86 = "GENERIC_X86" FT232H = "FT232H" FT2232H = "FT2232H" FT4232H = "FT4232H" SPIDRIVER = "SPIDRIVER" I2CDRIVER = "I2CDRIVER" HFU540 = "HFU540" C906 = "C906" JH71X0 = "JH71X0" JH7110 = "JH7110" MCP2221 = "MCP2221" BINHO = "BINHO" MIPS24KC = "MIPS24KC" MIPS24KEC = "MIPS24KEC" ZYNQ7000 = "ZYNQ7000" A10 = "A10" A20 = "A20" A64 = "A64" H6 = "H6" A33 = "A33" H5 = "H5" H3 = "H3" H616 = "H616" H618 = "H618" T527 = "T527" RK3308 = "RK3308" RK3399 = "RK3399" RK3399_T = "RK3399_T" RK3399PRO = "RK3399PRO" RK3328 = "RK3328" LPC4330 = "LPC4330" RK3288 = "RK3288" RK3566 = "RK3566" RK3568 = "RK3568" RK3588 = "RK3588" RK3588S = "RK3588S" RV1103 = "RV1103" RV1106 = "RV1106" PENTIUM_N3710 = "PENTIUM_N3710" # SOC Braswell core CELERON_N5105 = "CELERON_N5105" STM32F405 = "STM32F405" RP2040 = "RP2040" RP2350 = "RP2350" STM32MP157 = "STM32MP157" STM32MP157DAA1 = "STM32MP157DAA1" MT8167 = "MT8167" ATOM_X5_Z8350 = "X5-Z8350" RP2040_U2IF = "RP2040_U2IF" D1_RISCV = "D1_RISCV" ATOM_J4105 = "ATOM_J4105" TH1520 = "TH1520" K1 = "K1" RZV2N = "RZV2N" RZV2H = "RZV2H" SUNRISE_X3 = "SUNRISE_X3" SUNRISE_X5 = "SUNRISE_X5" QCM6490 = "QCM6490" ZYNQMP = "ZYNQMP" BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2712", "BCM2835", "BCM2837"} CV1800B = "CV1800B" adafruit-Adafruit_Python_PlatformDetect-5fe11b6/adafruit_platformdetect/revcodes.py000066400000000000000000000201711514737240100311040ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `adafruit_platformdetect.revcodes` ================================================================================ Class to help with Raspberry Pi Rev Codes * Author(s): Melissa LeBlanc-Williams Implementation Notes -------------------- **Software and Dependencies:** * Linux and Python 3.7 or Higher Data values from https://github.com/raspberrypi/documentation/blob/develop/ documentation/asciidoc/computers/raspberry-pi/revision-codes.adoc#new-style-revision-codes """ NEW_OVERVOLTAGE = ( "Overvoltage allowed", "Overvoltage disallowed", ) NEW_OTP_PROGRAM = ( "OTP programming is allowed", "OTP programming is disallowed", ) NEW_OTP_READ = ( "OTP reading is allowed", "OTP reading is disallowed", ) NEW_WARRANTY_BIT = ( "Warranty is intact", "Warranty has been voided by overclocking", ) NEW_REV_STYLE = ( "Old-style revision", "New-style revision", ) NEW_MEMORY_SIZE = ( "256MB", "512MB", "1GB", "2GB", "4GB", "8GB", ) NEW_MANUFACTURER = ( "Sony UK", "Egoman", "Embest", "Sony Japan", "Embest", "Stadium", ) NEW_PROCESSOR = ( "BCM2835", "BCM2836", "BCM2837", "BCM2711", "BCM2712", ) PI_TYPE = { 0x00: "A", 0x01: "B", 0x02: "A+", 0x03: "B+", 0x04: "2B", 0x05: "Alpha (early prototype)", 0x06: "CM1", 0x08: "3B", 0x09: "Zero", 0x0A: "CM3", 0x0B: "Custom", 0x0C: "Zero W", 0x0D: "3B+", 0x0E: "3A+", 0x0F: "Internal use only", 0x10: "CM3+", 0x11: "4B", 0x12: "Zero 2 W", 0x13: "400", 0x14: "CM4", 0x15: "CM4S", 0x17: "5", 0x18: "CM5", 0x19: "500", 0x1A: "CM5 Lite", } OLD_MANUFACTURER = ( "Sony UK", "Egoman", "Embest", "Qisda", ) OLD_MEMORY_SIZE = ("256MB", "512MB", "256MB/512MB") NEW_REV_STRUCTURE = { "overvoltage": (31, 1, NEW_OVERVOLTAGE), "otp_program": (30, 1, NEW_OTP_PROGRAM), "otp_read": (29, 1, NEW_OTP_READ), "warranty": (25, 1, NEW_WARRANTY_BIT), "rev_style": (23, 1, NEW_REV_STYLE), "memory_size": (20, 3, NEW_MEMORY_SIZE), "manufacturer": (16, 4, NEW_MANUFACTURER), "processor": (12, 4, NEW_PROCESSOR), "type": (4, 8, PI_TYPE), "revision": (0, 4, int), } OLD_REV_STRUCTURE = { "type": (0, PI_TYPE), "revision": (1, float), "memory_size": (2, OLD_MEMORY_SIZE), "manufacturer": (3, OLD_MANUFACTURER), } OLD_REV_EXTRA_PROPS = { "warranty": (24, 1, NEW_WARRANTY_BIT), } OLD_REV_LUT = { 0x02: (1, 1.0, 0, 1), 0x03: (1, 1.0, 0, 1), 0x04: (1, 2.0, 0, 0), 0x05: (1, 2.0, 0, 3), 0x06: (1, 2.0, 0, 1), 0x07: (0, 2.0, 0, 1), 0x08: (0, 2.0, 0, 0), 0x09: (0, 2.0, 0, 3), 0x0D: (1, 2.0, 1, 1), 0x0E: (1, 2.0, 1, 0), 0x0F: (1, 2.0, 1, 1), 0x10: (3, 1.2, 1, 0), 0x11: (6, 1.0, 1, 0), 0x12: (2, 1.1, 0, 0), 0x13: (3, 1.2, 1, 2), 0x14: (6, 1.0, 1, 2), 0x15: (2, 1.1, 2, 2), } class PiDecoder: """Raspberry Pi Revision Code Decoder""" def __init__(self, rev_code): try: self.rev_code = int(rev_code, 16) & 0xFFFFFFFF except ValueError: print("Invalid revision code. It should be a hexadecimal value.") def is_valid_code(self): """Quickly check the validity of a code""" if self.is_new_format(): for code_format in NEW_REV_STRUCTURE.values(): lower_bit, bit_size, values = code_format prop_value = (self.rev_code >> lower_bit) & ((1 << bit_size) - 1) if not self._valid_value(prop_value, values): return False else: if ( self.rev_code & 0xFFFF ) not in OLD_REV_LUT.keys(): # pylint: disable=consider-iterating-dictionary return False for code_format in OLD_REV_STRUCTURE.values(): index, values = code_format code_format = OLD_REV_LUT[self.rev_code & 0xFFFF] if index >= len(code_format): return False if not self._valid_value(code_format[index], values): return False return True def _get_rev_prop_value(self, name, structure=None, raw=False): if structure is None: structure = NEW_REV_STRUCTURE if name not in structure.keys(): raise ValueError(f"Unknown property {name}") lower_bit, bit_size, values = structure[name] prop_value = self._get_bits_value(lower_bit, bit_size) if not self._valid_value(prop_value, values): raise ValueError(f"Invalid value {prop_value} for property {name}") if raw: return prop_value return self._format_value(prop_value, values) def _get_bits_value(self, lower_bit, bit_size): return (self.rev_code >> lower_bit) & ((1 << bit_size) - 1) def _get_old_rev_prop_value(self, name, raw=False): if ( name not in OLD_REV_STRUCTURE.keys() # pylint: disable=consider-iterating-dictionary ): raise ValueError(f"Unknown property {name}") index, values = OLD_REV_STRUCTURE[name] data = OLD_REV_LUT[self.rev_code & 0xFFFF] if index >= len(data): raise IndexError(f"Index {index} out of range for property {name}") if not self._valid_value(data[index], values): raise ValueError(f"Invalid value {data[index]} for property {name}") if raw: return data[index] return self._format_value(data[index], values) @staticmethod def _format_value(value, valid_values): if valid_values is float or valid_values is int: return valid_values(value) return valid_values[value] @staticmethod def _valid_value(value, valid_values): if valid_values is float or valid_values is int: return isinstance(value, valid_values) if isinstance(valid_values, (tuple, list)) and 0 <= value < len(valid_values): return True if isinstance(valid_values, dict) and value in valid_values.keys(): return True return False def _get_property(self, name, raw=False): if name not in NEW_REV_STRUCTURE: raise ValueError(f"Unknown property {name}") if self.is_new_format(): return self._get_rev_prop_value(name, raw=raw) if name in OLD_REV_EXTRA_PROPS: return self._get_rev_prop_value( name, structure=OLD_REV_EXTRA_PROPS, raw=raw ) return self._get_old_rev_prop_value(name, raw=raw) def is_new_format(self): """Check if the code is in the new format""" return self._get_rev_prop_value("rev_style", raw=True) == 1 @property def overvoltage(self): """Overvoltage allowed/disallowed""" return self._get_property("overvoltage") @property def warranty_bit(self): """Warranty bit""" return self._get_property("warranty") @property def otp_program(self): """OTP programming allowed/disallowed""" return self._get_property("otp_program") @property def otp_read(self): """OTP reading allowed/disallowed""" return self._get_property("otp_read") @property def rev_style(self): """Revision Code style""" # Force new style for Rev Style return self._get_rev_prop_value("rev_style") @property def memory_size(self): """Memory size""" return self._get_property("memory_size") @property def manufacturer(self): """Manufacturer""" return self._get_property("manufacturer") @property def processor(self): """Processor""" return self._get_property("processor") @property def type(self): """Specific Model""" return self._get_property("type") @property def type_raw(self): """Raw Value of Specific Model""" return self._get_property("type", raw=True) @property def revision(self): """Revision Number""" return self._get_property("revision") adafruit-Adafruit_Python_PlatformDetect-5fe11b6/bin/000077500000000000000000000000001514737240100225735ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/bin/detect.py000077500000000000000000000100771514737240100244250ustar00rootroot00000000000000#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `bin.detect` ================================================================================ Board detection and determination script * Author(s): Melissa LeBlanc-Williams Implementation Notes -------------------- **Software and Dependencies:** * Linux and Python 3.7 or Higher """ import adafruit_platformdetect detector = adafruit_platformdetect.Detector() print("Board Detection Test") print() print("Check that the Chip and Board IDs match your board and that this it is") print("correctly detecting whether or not it is a Linux board.") print() print("Chip id: ", detector.chip.id) print("Board id: ", detector.board.id) print() print("Linux Detection") print("---------------") print("Is this an embedded Linux system?", detector.board.any_embedded_linux) print() print("Raspberry Pi Boards") print("-------------------") if detector.board.any_raspberry_pi: print("Raspberry Pi detected.") print("Is this a Pi 3B+?", detector.board.RASPBERRY_PI_3B_PLUS) print("Is this a Pi 4B?", detector.board.RASPBERRY_PI_4B) print("Is this a 40-pin Raspberry Pi?", detector.board.any_raspberry_pi_40_pin) print("Is this a Raspberry Pi Compute Module?", detector.board.any_raspberry_pi_cm) print() print("Other Boards") print("-------------------") print( "Is this a Siemens Simatic IOT2000 Gateway?", detector.board.any_siemens_simatic_iot2000, ) print("Is this a 96boards board?", detector.board.any_96boards) print("Is this a BeagleBone board?", detector.board.any_beaglebone) print("Is this a Giant board?", detector.board.any_giant_board) print("Is this a Coral Dev board?", detector.board.any_coral_board) print("Is this a MaaXBoard?", detector.board.any_maaxboard) print("Is this a SiFive board? ", detector.board.any_sifive_board) print("Is this a PYNQ board?", detector.board.any_pynq_board) print("Is this a Rock Pi board?", detector.board.any_rock_pi_board) print("Is this a NanoPi board?", detector.board.any_nanopi) print("Is this a Khadas VIM3 board?", detector.board.khadas_vim3_40_pin) print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board) print("Is this a Seeed Board?", detector.board.any_seeed_board) print("Is this a UDOO board?", detector.board.any_udoo_board) print("Is this an ASUS Tinker board?", detector.board.any_asus_tinker_board) print("Is this an STM32MP1 board?", detector.board.any_stm32mp1) print("Is this a MilkV board?", detector.board.any_milkv_board) print("Is this a Luckfox Pico board?", detector.board.any_luckfox_pico_board) print("Is this a generic Linux PC?", detector.board.generic_linux) print( "Is this an OS environment variable special case?", detector.board.os_environ_board ) if detector.board.any_bananapi: print("Bananapi board detected.") if detector.board.any_jetson_board: print("Jetson platform detected.") if detector.board.any_tisk_board: print("TI platform detected.") if detector.board.any_pynq_board: print("PYNQ platform detected.") if detector.board.any_orange_pi: print("Orange Pi detected.") if detector.board.any_lemaker: print("LeMaker board detected.") if detector.board.any_odroid_40_pin: print("Odroid detected.") if detector.board.any_onion_omega_board: print("Onion Omega detected.") 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_board: print("Clockwork Pi device detected.") if detector.board.any_asus_tinker_board: print("ASUS Tinker Board device detected.") if detector.board.any_coral_board: print("Coral device detected.") if detector.board.any_lubancat: print("LubanCat detected.") if detector.board.any_siemens_simatic_iot2000: print("Siemens Simatic IOT2000 Gateway detected.") if detector.board.any_nxp_navq_board: print("NXP NavQ board detected.") if detector.board.any_walnutpi: print("Walnut Pi detected.") if detector.board.any_horizon_board: print("Horizon detected.") adafruit-Adafruit_Python_PlatformDetect-5fe11b6/bin/rpi_info.py000066400000000000000000000051761514737240100247630ustar00rootroot00000000000000#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2023 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `bin.rpi_info` ================================================================================ Interactive mode will prompt for the revision code Otherwise it will be detected automatically * Author(s): Melissa LeBlanc-Williams Implementation Notes -------------------- **Software and Dependencies:** * Linux and Python 3.7 or Higher """ import sys import argparse import adafruit_platformdetect from adafruit_platformdetect.revcodes import PiDecoder detector = adafruit_platformdetect.Detector() parser = argparse.ArgumentParser() def print_property(label, value): """Format and print a property""" print(f"{label}: {value}") def main(interactive): """Run the program""" pi_rev_code = detector.board._pi_rev_code() # pylint: disable=protected-access if pi_rev_code is None: print("Raspberry Pi not detected. Using interactive mode") if pi_rev_code is None or interactive: pi_rev_code = input( "Enter a Raspberry Pi revision code (e.g. d03114 or 000f): " ) print_property("Revision Code", pi_rev_code) try: decoder = PiDecoder(pi_rev_code) except ValueError: print("Invalid revision code. It should be a hexadecimal value.") sys.exit(1) if not decoder.is_valid_code(): print( "Code is invalid. This rev code includes at least one " "value that is outside of the expected range." ) sys.exit(1) if decoder.is_new_format(): print_property("Overvoltage", decoder.overvoltage) print_property("OTP Program", decoder.otp_program) print_property("OTP Read", decoder.otp_read) print_property("Warranty bit", decoder.warranty_bit) print_property("New flag", decoder.rev_style) print_property("Memory size", decoder.memory_size) print_property("Manufacturer", decoder.manufacturer) print_property("Processor", decoder.processor) print_property("Type", decoder.type) print_property("Revision", decoder.revision) else: print_property("Warranty bit", decoder.warranty_bit) print_property("Model", decoder.type) print_property("Revision", decoder.revision) print_property("RAM", decoder.memory_size) print_property("Manufacturer", decoder.manufacturer) # Main function if __name__ == "__main__": parser.add_argument( "-i", "--interactive", help="Interactive Mode", action="store_true" ) args = parser.parse_args() main(args.interactive) adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/000077500000000000000000000000001514737240100227535ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/_static/000077500000000000000000000000001514737240100244015ustar00rootroot00000000000000adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/_static/favicon.ico000066400000000000000000000104761514737240100265320ustar00rootroot00000000000000  (( @ 'w",h&PƆ(ׄ)hP8  ":60/M1S*( a$4 0  UzX̓[:fۏ/e/e,_) +_.IYYr A6"Lŵ[f S ȋ%ӏ/e/e-a! {U%ɂJΉP݋\8KK_(BɂM+ 5 '̏/e/e/e8'*[/e/e/e/e/e/e/e1d/e.mvOЫF= W*M$7/f/e0-?Σ9re0d/e/d)/e/e/e/e/e/e/e/e/e/e/e/e/ewI$2!/e/e,B/e/ez(V2E=6-E+ :674 B5.H3Ã+]/e/e/e/e/e(},B e"H/%# &XRp^/e/ei#K^ ΍_FˋFˁEs.#o%N׏/e/e/e/e2 Y+H-/e/eo%NZS2qگ\UŎ+y?jӧOcĎ#˺j`1cIxU;Ə/e/e-_  3yJ6( ŏ/e/e~*Z9(s%Rl$Mu&R݁+Z/d/e/e/e0deVF+&~*Xm%Mzu'TH3`+UX́[>]/e/e VhS c-V?k/M<19-*Z/e/eA_TVQf!)(>+r/e/e8Yq̈Nǎ߻g}IPB3/e/eH8'" 8+~ =/e/eB0+^/e/e/e2dXZċbHx6',^+  >1E̹bz/e/ey)V 1"g"Iҏ/e/e/e/eeNCl5 ,m/e/e L :(e"Hk#L<* j"FNTvR/e/e6&GQǏ/e/e|(Wj1Izċ+u/e/e Z~M/e/eH3&GT /e/e-_,o/e/e/e#  p,^/e/e/eQ:/ aNq%Pڏ/e/e/e-_v M3^.c/e/e/e/e$IHz'& $p%O܏/e/e/e/e/e/e' Gb E݂+\-_r%P,]/e/e/e/e/e2#P96'/e/e/ez=A_C͇-_/e/e/e6' r%P.c/e/e}+YiU!۱f(~*Z/e &! w'Sj#KԿٹw'Sߏ/e+\ q&Pu(Sd5Om$Nҏ/e+^y0"[@U<0!   3,adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/_static/favicon.ico.license000066400000000000000000000001511514737240100301400ustar00rootroot00000000000000SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries SPDX-License-Identifier: CC-BY-4.0 adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/api.rst000066400000000000000000000005211514737240100242540ustar00rootroot00000000000000 .. If you created a package, create one automodule per module in the package. .. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py) .. use this format as the module name: "adafruit_foo.foo" .. automodule:: adafruit_platformdetect.board :members: .. automodule:: adafruit_platformdetect.chip :members: adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/api.rst.license000066400000000000000000000001401514737240100256720ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries # # SPDX-License-Identifier: MIT adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/beaglebone_eeprom.txt000066400000000000000000000101761514737240100271530ustar00rootroot00000000000000SPDX-FileCopyrightText: 2009-2014 Robert Nelson SPDX-License-Identifier: MIT From https://github.com/beagleboard/image-builder The MIT License (MIT) Copyright (c) 2009-2014 Robert Nelson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. BeagleBoard.org BeagleBone (original bone/white): A4: [aa 55 33 ee 41 33 33 35 42 4f 4e 45 30 30 41 34 |.U3.A335BONE00A4|] A5: [aa 55 33 ee 41 33 33 35 42 4f 4e 45 30 30 41 35 |.U3.A335BONE00A5|] A6: [aa 55 33 ee 41 33 33 35 42 4f 4e 45 30 30 41 36 |.U3.A335BONE00A6|] A6A: [aa 55 33 ee 41 33 33 35 42 4f 4e 45 30 41 36 41 |.U3.A335BONE0A6A|] A6B: [aa 55 33 ee 41 33 33 35 42 4f 4e 45 30 41 36 42 |.U3.A335BONE0A6B|] B: [aa 55 33 ee 41 33 33 35 42 4f 4e 45 30 30 30 42 |.U3.A335BONE000B|] BeagleBoard.org or Element14 BeagleBone Black: A5: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 30 41 35 |.U3.A335BNLT00A5|] A5A: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 41 35 41 |.U3.A335BNLT0A5A|] A5B: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 41 35 42 |.U3.A335BNLT0A5B|] A5C: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 41 35 43 |.U3.A335BNLT0A5C|] A6: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 30 41 36 |.U3.A335BNLT00A6|] C: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 30 30 43 |.U3.A335BNLT000C|] C: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 30 30 43 30 |.U3.A335BNLT00C0|] BeagleBoard.org BeagleBone Blue: A2: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 42 4c 41 30 |.U3.A335BNLTBLA2|] BeagleBoard.org BeagleBone Black Wireless: A5: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 42 57 41 35 |.U3.A335BNLTBWA5|] BeagleBoard.org PocketBeagle: A2: [aa 55 33 ee 41 33 33 35 50 42 47 4c 30 30 41 32 |.U3.A335PBGL00A2|] SeeedStudio BeagleBone Green: 1A: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 1a 00 00 00 |.U3.A335BNLT....|] ?: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 42 42 47 31 |.U3.A335BNLTBBG1|] SeeedStudio BeagleBone Green Wireless: W1A: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 47 57 31 41 |.U3.A335BNLTGW1A|] Arrow BeagleBone Black Industrial: A0: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 41 49 41 30 |.U3.A335BNLTAIA0|] Element14 BeagleBone Black Industrial: A0: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 45 49 41 30 |.U3.A335BNLTEIA0|] SanCloud BeagleBone Enhanced: A: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 53 45 30 41 |.U3.A335BNLTSE0A|] MENTOREL BeagleBone uSomIQ: 6: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 4d 45 30 36 |.U3.A335BNLTME06|] Neuromeka BeagleBone Air: A0: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 4e 41 44 30 |.U3.A335BNLTNAD0|] Embest replica?: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 74 0a 75 65 |.U3.A335BNLTt.ue|] GHI OSD3358 Dev Board: 0.1: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 47 48 30 31 |.U3.A335BNLTGH01|] PocketBone: 0: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 42 50 30 30 |.U3.A335BNLTBP00|] Octavo Systems OSD3358-SM-RED: 0: [aa 55 33 ee 41 33 33 35 42 4e 4c 54 4F 53 30 30 |.U3.A335BNLTOS00|] BeagleLogic Standalone: A: [aa 55 33 ee 41 33 33 35 42 4c 47 43 30 30 30 41 |.U3.A335BLGC000A|] adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/conf.py000066400000000000000000000125471514737240100242630ustar00rootroot00000000000000# -*- coding: utf-8 -*- # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # # SPDX-License-Identifier: MIT import os import sys sys.path.insert(0, os.path.abspath("..")) # -- General configuration ------------------------------------------------ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx.ext.napoleon", "sphinx.ext.todo", ] # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. autodoc_mock_imports = ["machine"] intersphinx_mapping = { "python": ("https://docs.python.org/3.7", None), "CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None), } # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] source_suffix = ".rst" # The master toctree document. master_doc = "index" # General information about the project. project = "Adafruit PlatformDetect Library" copyright = "2017 Adafruit Industries" author = "Brennen Bearnes" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = "1.0.0" # The full version, including alpha/beta/rc tags. release = "1.0.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = [ "_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md", ] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = "any" # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # If this is True, todo emits a warning for each TODO entries. The default is False. todo_emit_warnings = True napoleon_numpy_docstring = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # on_rtd = os.environ.get("READTHEDOCS", None) == "True" if not on_rtd: # only import and set the theme if we're building docs locally try: import sphinx_rtd_theme html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."] except: html_theme = "default" html_theme_path = ["."] else: html_theme_path = ["."] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # The name of an image file (relative to this directory) to use as a favicon of # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = "_static/favicon.ico" # Output file base name for HTML help builder. htmlhelp_basename = "AdafruitPlatformDetectLibrarydoc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', # Latex figure (float) alignment # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ( master_doc, "AdafruitPlatformDetectLibrary.tex", "AdafruitPlatformDetect Library Documentation", author, "manual", ), ] # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ( master_doc, "AdafruitPlatformDetectlibrary", "Adafruit PlatformDetect Library Documentation", [author], 1, ) ] # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( master_doc, "AdafruitPlatformDetectLibrary", "Adafruit PlatformDetect Library Documentation", author, "AdafruitPlatformDetectLibrary", "One line description of project.", "Miscellaneous", ), ] adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/index.rst000066400000000000000000000017531514737240100246220ustar00rootroot00000000000000.. include:: ../README.rst Table of Contents ================= .. toctree:: :maxdepth: 4 :hidden: self .. toctree:: :caption: API Reference :maxdepth: 3 api .. toctree:: :caption: Tutorials Adding a Single Board Computer to PlatformDetect for Blinka .. toctree:: :caption: Related Products .. toctree:: :caption: Other Links Download CircuitPython Reference Documentation CircuitPython Support Forum Discord Chat Adafruit Learning System Adafruit Blog Adafruit Store Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/index.rst.license000066400000000000000000000001401514737240100262300ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries # # SPDX-License-Identifier: MIT adafruit-Adafruit_Python_PlatformDetect-5fe11b6/docs/requirements.txt000066400000000000000000000001731514737240100262400ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries # # SPDX-License-Identifier: Unlicense sphinx>=4.0.0 adafruit-Adafruit_Python_PlatformDetect-5fe11b6/pyproject.toml000066400000000000000000000020521514737240100247360ustar00rootroot00000000000000# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries # # SPDX-License-Identifier: MIT [build-system] requires = [ "setuptools", "wheel", "setuptools-scm", ] [project] name = "Adafruit-PlatformDetect" description = "Platform detection for use by libraries like Adafruit-Blinka." version = "0.0.0+auto.0" readme = "README.rst" authors = [ {name = "Adafruit Industries", email = "circuitpython@adafruit.com"} ] urls = {Homepage = "https://github.com/adafruit/Adafruit_Python_PlatformDetect"} license = {text = "MIT"} classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries", "Topic :: System :: Hardware", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", ] dynamic = ["dependencies"] [tool.setuptools] packages = ["adafruit_platformdetect", "adafruit_platformdetect.constants"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} adafruit-Adafruit_Python_PlatformDetect-5fe11b6/requirements.txt000066400000000000000000000000001514737240100252750ustar00rootroot00000000000000