Пример #1
0
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")
import os

shell = Shell()
shell.group="Blinka"
default_python = 3
blinka_minimum_python_version = 3.6

def default_python_version(numeric=True):
    version = shell.run_command("python -c 'import platform; print(platform.python_version())'", suppress_message=True, return_output=True)
    if numeric:
        return float(version[0:version.rfind(".")])
    return version

def get_python3_version(numeric=True):
    version = shell.run_command("python3 -c 'import platform; print(platform.python_version())'", suppress_message=True, return_output=True)
    if numeric:
        return float(version[0:version.rfind(".")])
    return version

def check_blinka_python_version():
    """
    Check the Python 3 version for Blinka (which may be a later version than we're running this script with)
    """
    print("Making sure the required version of Python is installed")
    if get_python3_version() < blinka_minimum_python_version:
        shell.bail("Blinka requires a minimum of Python version {} to install. Please update your OS!".format(blinka_minimum_python_version))
    
Пример #2
0
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError(
        "The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell"
    )

shell = Shell()


def main():
    shell.clear()
    print("""This script downloads and installs
I2S microphone support.
""")
    if not shell.is_raspberry_pi():
        shell.bail("Non-Raspberry Pi board detected.")
    pi_model = shell.get_board_model()
    print("{} detected.\n".format(pi_model))
    if pi_model in ("RASPBERRY_PI_ZERO", "RASPBERRY_PI_ZERO_W"):
        pimodel_select = 0
    elif pi_model in ("RASPBERRY_PI_2B", "RASPBERRY_PI_3B",
                      "RASPBERRY_PI_3B_PLUS", "RASPBERRY_PI_3A_PLUS",
                      "RASPBERRY_PI_ZERO_2_W"):
        pimodel_select = 1
    elif pi_model in ("RASPBERRY_PI_4B", "RASPBERRY_PI_CM4",
                      "RASPBERRY_PI_400"):
        pimodel_select = 2
    else:
        shell.bail("Unsupported Pi board detected.")
# sudo python3 libgpiod.py

try:
    import click
except ImportError:
    raise RuntimeError(
        "The library 'Click' was not found. To install, try typing: sudo pip3 install Click==7.0"
    )
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError(
        "The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell"
    )

shell = Shell()
shell.group = 'LIBGPIOD'


@click.command()
@click.option(
    '-l',
    '--legacy',
    is_flag=True,
    help="Install a legacy version of libgpiod for systems with older libraries"
)
def main(legacy):
    print("""Installing build requirements - this may take a few minutes!
""")

    # install generic linux packages required
import os

try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError(
        "The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell"
    )

shell = Shell()
shell.group = 'ADAFRUIT'


def main():
    shell.clear()
    if shell.is_raspberry_pi():
        print("""This script will enable the Raspberry Pi
fan service, which will turn on an
external fan controlled by a given pin

Operations performed include:
- Enable Fan Service

Run time < 1 minute. Reboot required.""")
    else:
        print("""This script will install Adafruit
fan service, which will turn on an
external fan controlled by a given pin

Operations performed include:
- Create a Fan Service File
Adafruit PiTFT Installer Script
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
"""

import time
import os
try:
    import click
except ImportError:
    raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install Click")
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")

shell = Shell()
shell.group = 'PITFT'

__version__ = "3.1.1"

"""
This is the main configuration. Displays should be placed in the order
they are to appear in the menu.
"""
config = [
    {
        "type": "28r",
        "menulabel": "PiTFT 2.4\", 2.8\" or 3.2\" resistive (240x320)",
        "product": "2.8\" resistive, PID 1601",
        "kernel_upgrade": False,
        "touchscreen": {
Adafruit PiTFT Installer Script
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
"""

import time
import os
try:
    import click
except ImportError:
    raise RuntimeError("The library 'Click' was not found. To install, try typing: sudo pip3 install Click")
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")

shell = Shell()
shell.group = 'PITFT'

__version__ = "3.3.0"

"""
This is the main configuration. Displays should be placed in the order
they are to appear in the menu.
"""
config = [
    {
        "type": "28r",
        "menulabel": "PiTFT 2.4\", 2.8\" or 3.2\" resistive (240x320)",
        "product": "2.8\" resistive, PID 1601",
        "kernel_upgrade": False,
        "touchscreen": {
"""
Adafruit Raspberry Pi Script to Pin a specific version of the rpi kernel and firmware
(C) Adafruit Industries, Creative Commons 3.0 - Attribution Share Alike
"""

try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError("The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell")
import os

shell = Shell()
shell.group = 'PINNING'

def main():
    shell.clear()
    # Check Raspberry Pi and Bail
    pi_model = shell.get_board_model()
    print("{} detected.\n".format(pi_model))
    if not shell.is_raspberry_pi():
        shell.bail("Non-Raspberry Pi board detected. This must be run on a Raspberry Pi")
    if shell.get_os() != "Raspbian":
        print("OS Detected:" + shell.get_os())
        shell.bail("Sorry. This script currently only runs on Raspberry Pi OS.")
    if len(shell.args) == 1:
        print("Usage: sudo python3 {} kernel-version\n".format(shell.script()))
        print("e.g., {} 1.20201126-1".format(shell.script()))
        shell.exit(1)
    version = shell.args[1]
    base = "http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/"
    packagelist = [
Пример #8
0
try:
    import click
except ImportError:
    raise RuntimeError(
        "The library 'Click' was not found. To install, try typing: sudo pip3 install Click"
    )
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError(
        "The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell"
    )
import os

shell = Shell()
shell.group = "SPI Reassign"

allowed_gpios = (4, 5, 6, 7, 8, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
                 24, 25, 26, 27)
spi0_default_pins = (8, 7)
"""
For now this will only ask about SPI0, but we can later add SPI1
"""


def valid_pins(ce0_pin, ce1_pin):
    if ce0_pin is None or ce1_pin is None:
        return False
    if ce0_pin == ce1_pin:
        return False
Пример #9
0
try:
    from adafruit_shell import Shell
except ImportError:
    raise RuntimeError(
        "The library 'adafruit_shell' was not found. To install, try typing: sudo pip3 install adafruit-python-shell"
    )

shell = Shell()
shell.group = "JOY"


def main():
    shell.clear()
    print("""This script installs software for the Adafruit
Joy Bonnet for Raspberry Pi. Steps include:
- Update package index files (apt-get update).
- Install Python libraries: smbus, evdev.
- Install joyBonnet.py in /boot and
  configure /etc/rc.local to auto-start script.
- Enable I2C bus.
- OPTIONAL: disable overscan.
Run time ~10 minutes. Reboot required.
EXISTING INSTALLATION, IF ANY, WILL BE OVERWRITTEN.
""")
    if not shell.prompt("CONTINUE?", default='n'):
        print("Canceled.")
        shell.exit()
    print("Continuing...")
    disable_overscan = shell.prompt("Disable overscan?", default='n')
    install_halt = shell.prompt("Install GPIO-halt utility?", default='n')
    if install_halt: