From 9813a9b4470bd1609c853a2381f050faebd4902e Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 19 Jan 2023 23:27:57 +0800 Subject: futility: updater: refactor DUT system info retrieval When developers (or the lab) runs 'futility update' on a Chromebox to update a remote DUT connected via servo, the updater will incorrectly recognize the Chromebox as the 'host' = 'system' = 'DUT', selecting wrong config and setting wrong cookies. To fix that, we want to isolate and refactor how we identify and access 'host' and 'DUT'. The first step is to rename and move the 'system property' related functions to 'dut properties' in the `updater_dut.c`. No functional changes in this patch. Only renamed functions and moved the implementation to different places. BUG=b:247428499,b:255617349 TEST=make; run test BRANCH=None Change-Id: I5c1f9bb67a14fbcdd80958597290a2789f4c2dac Signed-off-by: Hung-Te Lin Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4181581 Reviewed-by: Yu-Ping Wu --- futility/updater_manifest.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'futility/updater_manifest.c') diff --git a/futility/updater_manifest.c b/futility/updater_manifest.c index ca338c40..6d7d9d41 100644 --- a/futility/updater_manifest.c +++ b/futility/updater_manifest.c @@ -10,10 +10,6 @@ #include #endif -#ifdef HAVE_CROSID -#include -#endif - #include "updater.h" #include "util_misc.h" @@ -619,30 +615,6 @@ static int manifest_from_simple_folder(struct manifest *manifest) return 0; } -/** - * get_manifest_key() - Wrapper to get the firmware manifest key from crosid - * - * @manifest_key_out - Output parameter of the firmware manifest key. - * - * Returns: - * - <0 if libcrosid is unavailable or there was an error reading - * device data - * - >=0 (the matched device index) success - */ -static int get_manifest_key(char **manifest_key_out) -{ -#ifdef HAVE_CROSID - return crosid_get_firmware_manifest_key(manifest_key_out); -#else - ERROR("This version of futility was compiled without libcrosid " - "(perhaps compiled outside of the Chrome OS build system?) and " - "the update command is not fully supported. Either compile " - "from the Chrome OS build, or pass --model to manually specify " - "the machine model.\n"); - return -1; -#endif -} - /* * Finds the existing model_config from manifest that best matches current * system (as defined by model_name). @@ -665,7 +637,7 @@ const struct model_config *manifest_find_model(const struct manifest *manifest, return &manifest->models[0]; if (!model_name) { - matched_index = get_manifest_key(&manifest_key); + matched_index = dut_get_manifest_key(&manifest_key); if (matched_index < 0) { ERROR("Failed to get device identity. " "Run \"crosid -v\" for explanation.\n"); -- cgit v1.2.1