blob: 34f3f8b4e93f929d5ceda31f60f6eab4a7fcfc5f [file] [log] [blame] [edit]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.developer.ffx;
// Covers the FFX Daemon Fastboot protocol. For information about how the fastboot
// protocol works, see:
// https://android.googlesource.com/platform/system/core/+/HEAD/fastboot/
// for the most up-to-date information.
/// The maximum size of a fastboot response is 256 bytes, minus
/// four bytes for the header defining the type of message.
const MAX_FASTBOOT_MESSAGE_SIZE uint32 = 252;
type FastbootError = strict enum {
PROTOCOL_ERROR = 1;
COMMUNICATION_ERROR = 2;
REDISCOVERED_ERROR = 3;
@deprecated
TARGET_ERROR = 4;
@deprecated
NON_FASTBOOT_DEVICE = 5;
REBOOT_FAILED = 6;
};
/// Adding more specific reboot errors. These are not necessarily
/// Fastboot errors because the target can be in Fuchsia state or
/// Zedboot. Therefore, there is a separate error type for these.
type RebootError = strict enum {
// Timed out waiting for the target to reboot
TIMED_OUT = 1;
// Failed sending the reboot signal.
FAILED_TO_SEND_TARGET_REBOOT = 2;
// Did not receive event that the reboot signal was sent.
FAILED_TO_SEND_ON_REBOOT = 3;
// Failed when sending zedboot reboot signal.
ZEDBOOT_COMMUNICATION_ERROR = 4;
// No Zedboot address found. Fatal internal error.
NO_ZEDBOOT_ADDRESS = 5;
// Overnet target communication error.
TARGET_COMMUNICATION = 6;
// Error sending the Fastboot reboot signal.
FASTBOOT_ERROR = 7;
};
/// Callback event listener for upload progress.
closed protocol UploadProgressListener {
strict OnError(struct {
error string:MAX;
});
strict OnStarted(struct {
size uint64;
});
strict OnProgress(struct {
bytes_written uint64;
});
strict OnFinished();
};
/// Callback event listener for when the device reboots to the
/// bootloader.
closed protocol RebootListener {
strict OnReboot();
};
/// Callback event listener for listing all variables.
closed protocol VariableListener {
strict OnVariable(struct {
name string:64;
value string:64;
});
};
@discoverable
closed protocol Fastboot {
strict Prepare(resource struct {
listener client_end:RebootListener;
}) -> () error RebootError;
strict GetVar(struct {
name string:64;
}) -> (struct {
value string:64;
}) error FastbootError;
strict GetAllVars(resource struct {
listener client_end:VariableListener;
}) -> () error FastbootError;
strict Flash(resource struct {
partition_name string:64;
path string:256;
listener client_end:UploadProgressListener;
}) -> () error FastbootError;
strict Erase(struct {
partition_name string:64;
}) -> () error FastbootError;
strict Boot() -> () error FastbootError;
strict Reboot() -> () error FastbootError;
strict RebootBootloader(resource struct {
listener client_end:RebootListener;
}) -> () error RebootError;
strict ContinueBoot() -> () error FastbootError;
strict GetStaged(resource struct {
path string:256;
}) -> () error FastbootError;
strict Stage(resource struct {
path string:256;
listener client_end:UploadProgressListener;
}) -> () error FastbootError;
strict SetActive(struct {
slot string:64;
}) -> () error FastbootError;
strict Oem(struct {
command string:64;
}) -> () error FastbootError;
};
type FastbootTarget = table {
/// The fastboot serial number of the target.
1: serial string:MAX_FASTBOOT_MESSAGE_SIZE;
};
@discoverable
closed protocol FastbootTargetStream {
/// Gets the next target from the protocol. Intended to be used as a hanging get
/// on the client side.
strict GetNext() -> (struct {
target FastbootTarget;
});
};