diff options
-rw-r--r-- | futility/updater.c | 5 | ||||
-rw-r--r-- | futility/updater.h | 1 | ||||
-rw-r--r-- | futility/updater_dut.c | 22 | ||||
-rw-r--r-- | futility/updater_quirks.c | 9 |
4 files changed, 34 insertions, 3 deletions
diff --git a/futility/updater.c b/futility/updater.c index d4d44f9d..b08e70ad 100644 --- a/futility/updater.c +++ b/futility/updater.c @@ -1437,6 +1437,11 @@ int updater_setup_config(struct updater_config *cfg, if (arg->force_update) cfg->force_update = 1; + /* Identify DUT type. Currently only local/remote (via servo). */ + cfg->dut_is_remote = arg->use_flash; + if (cfg->dut_is_remote) + INFO("Configured to update a remote DUT via Servo.\n"); + /* Check incompatible options and return early. */ if (arg->do_manifest) { if (!!arg->archive == !!arg->image) { diff --git a/futility/updater.h b/futility/updater.h index 4382217d..788bf65f 100644 --- a/futility/updater.h +++ b/futility/updater.h @@ -90,6 +90,7 @@ struct updater_config { int override_gbb_flags; uint32_t gbb_flags; bool detect_model; + bool dut_is_remote; }; struct updater_config_arguments { diff --git a/futility/updater_dut.c b/futility/updater_dut.c index 7062a614..102859ae 100644 --- a/futility/updater_dut.c +++ b/futility/updater_dut.c @@ -24,6 +24,11 @@ */ int dut_get_manifest_key(char **manifest_key_out, struct updater_config *cfg) { + if (cfg->dut_is_remote) { + WARN("Cannot retrieve the remote DUT manifest info. " + "Please specify the DUT type by --model.\n"); + return -1; + } #ifdef HAVE_CROSID return crosid_get_firmware_manifest_key(manifest_key_out); #else @@ -38,25 +43,40 @@ int dut_get_manifest_key(char **manifest_key_out, struct updater_config *cfg) int dut_set_property_string(const char *key, const char *value, struct updater_config *cfg) - { + if (cfg->dut_is_remote) { + WARN("Ignored setting property %s on a remote DUT.\n", key); + return -1; + } return VbSetSystemPropertyString(key, value); } const char *dut_get_property_string(const char *key, char *dest, size_t size, struct updater_config *cfg) { + if (cfg->dut_is_remote) { + WARN("Ignored getting property %s on a remote DUT.\n", key); + return NULL; + } return VbGetSystemPropertyString(key, dest, size); } int dut_set_property_int(const char *key, const int value, struct updater_config *cfg) { + if (cfg->dut_is_remote) { + WARN("Ignored setting property %s on a remote DUT.\n", key); + return -1; + } return VbSetSystemPropertyInt(key, value); } int dut_get_property_int(const char *key, struct updater_config *cfg) { + if (cfg->dut_is_remote) { + WARN("Ignored getting property %s on a remote DUT.\n", key); + return -1; + } return VbGetSystemPropertyInt(key); } diff --git a/futility/updater_quirks.c b/futility/updater_quirks.c index 31b376c5..aadb9e72 100644 --- a/futility/updater_quirks.c +++ b/futility/updater_quirks.c @@ -76,9 +76,14 @@ static int is_ec_software_sync_enabled(struct updater_config *cfg) { const struct vb2_gbb_header *gbb; + int vdat_flags = dut_get_property_int("vdat_flags", cfg); + if (vdat_flags < 0) { + WARN("Failed to identify DUT vdat_flags.\n"); + return 0; + } + /* Check if current system has disabled software sync or no support. */ - if (!(dut_get_property_int("vdat_flags", cfg) & VBSD_EC_SOFTWARE_SYNC)) - { + if (!(vdat_flags & VBSD_EC_SOFTWARE_SYNC)) { INFO("EC Software Sync is not available.\n"); return 0; } |