Example #1
0
def load_settings(
    label: str = None,
    use_passphrase: bool = None,
    homescreen: bytes = None,
    passphrase_source: int = None,
    display_rotation: int = None,
) -> None:
    if label is not None:
        common.set(_NAMESPACE, _LABEL, label.encode(), True)  # public
    if use_passphrase is not None:
        common.set_bool(_NAMESPACE, _USE_PASSPHRASE, use_passphrase)
    if homescreen is not None:
        if homescreen[:8] == b"TOIf\x90\x00\x90\x00":
            if len(homescreen) <= HOMESCREEN_MAXSIZE:
                common.set(_NAMESPACE, _HOMESCREEN, homescreen, True)  # public
        else:
            common.set(_NAMESPACE, _HOMESCREEN, b"", True)  # public
    if passphrase_source is not None:
        if passphrase_source in (0, 1, 2):
            common.set(_NAMESPACE, _PASSPHRASE_SOURCE,
                       bytes([passphrase_source]))
    if display_rotation is not None:
        if display_rotation not in (0, 90, 180, 270):
            raise ValueError("Unsupported display rotation degrees: %d" %
                             display_rotation)
        else:
            common.set(_NAMESPACE, _ROTATION,
                       display_rotation.to_bytes(2, "big"), True)  # public
Example #2
0
def set_unfinished_backup(state: bool) -> None:
    common.set_bool(_NAMESPACE, _UNFINISHED_BACKUP, state)
Example #3
0
def set_in_progress(val: bool) -> None:
    common.set_bool(_NAMESPACE, _IN_PROGRESS, val)
Example #4
0
def set_dry_run(val: bool) -> None:
    _require_progress()
    common.set_bool(_NAMESPACE, _DRY_RUN, val)
Example #5
0
def set_dry_run(val: bool) -> None:
    common.set_bool(_NAMESPACE, _DRY_RUN, val)