Move simple firmware related queries into HardwareInterface.
This change moves the following functions from utils to
HardwareInterface:
GetHardwareClass()
GetFirmwareVersion()
GetECVersion()
BUG=None
TEST=unit tests
Change-Id: I20047a3fac8cca3c36730fef305751e6da3c2bb5
Reviewed-on: https://chromium-review.googlesource.com/174930
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
diff --git a/fake_hardware.h b/fake_hardware.h
index 6d3b926..5428f28 100644
--- a/fake_hardware.h
+++ b/fake_hardware.h
@@ -13,18 +13,39 @@
class FakeHardware : public HardwareInterface {
public:
FakeHardware()
- : boot_device_("/dev/sdz5") {}
+ : boot_device_("/dev/sdz5"),
+ hardware_class_("Fake HWID BLAH-1234"),
+ firmware_version_("Fake Firmware v1.0.1"),
+ ec_version_("Fake EC v1.0a") {}
// HardwareInterface methods.
virtual const std::string BootDevice() { return boot_device_; }
+ virtual std::string GetHardwareClass() { return hardware_class_; }
+ virtual std::string GetFirmwareVersion() { return firmware_version_; }
+ virtual std::string GetECVersion() { return ec_version_; }
// Setters
void SetBootDevice(const std::string boot_device) {
boot_device_ = boot_device;
}
+ void SetHardwareClass(std::string hardware_class) {
+ hardware_class_ = hardware_class;
+ }
+
+ void SetFirmwareVersion(std::string firmware_version) {
+ firmware_version_ = firmware_version;
+ }
+
+ void SetECVersion(std::string ec_version) {
+ ec_version_ = ec_version;
+ }
+
private:
std::string boot_device_;
+ std::string hardware_class_;
+ std::string firmware_version_;
+ std::string ec_version_;
DISALLOW_COPY_AND_ASSIGN(FakeHardware);
};
diff --git a/hardware.cc b/hardware.cc
index 1c0b3a6..a44edcf 100644
--- a/hardware.cc
+++ b/hardware.cc
@@ -3,12 +3,16 @@
// found in the LICENSE file.
#include "update_engine/hardware.h"
-#include "update_engine/utils.h"
#include <base/logging.h>
+#include <base/string_util.h>
#include <rootdev/rootdev.h>
+#include "update_engine/subprocess.h"
+#include "update_engine/utils.h"
+
using std::string;
+using std::vector;
namespace chromeos_update_engine {
@@ -29,4 +33,45 @@
return boot_path;
}
+static string ReadValueFromCrosSystem(const string& key) {
+ int exit_code = 0;
+ vector<string> cmd(1, "/usr/bin/crossystem");
+ cmd.push_back(key);
+
+ string return_value;
+ bool success = Subprocess::SynchronousExec(cmd, &exit_code, &return_value);
+ if (success && !exit_code) {
+ TrimWhitespaceASCII(return_value, TRIM_ALL, &return_value);
+ return return_value;
+ }
+ LOG(ERROR) << "Unable to read " << key << " (" << exit_code << ") "
+ << return_value;
+ return "";
+}
+
+string Hardware::GetHardwareClass() {
+ return ReadValueFromCrosSystem("hwid");
+}
+
+string Hardware::GetFirmwareVersion() {
+ return ReadValueFromCrosSystem("fwid");
+}
+
+string Hardware::GetECVersion() {
+ string input_line;
+ int exit_code = 0;
+ vector<string> cmd(1, "/usr/sbin/mosys");
+ cmd.push_back("-k");
+ cmd.push_back("ec");
+ cmd.push_back("info");
+
+ bool success = Subprocess::SynchronousExec(cmd, &exit_code, &input_line);
+ if (!success || exit_code) {
+ LOG(ERROR) << "Unable to read ec info from mosys (" << exit_code << ")";
+ return "";
+ }
+
+ return utils::ParseECVersion(input_line);
+}
+
} // namespace chromeos_update_engine
diff --git a/hardware.h b/hardware.h
index cbf8aee..7f895c9 100644
--- a/hardware.h
+++ b/hardware.h
@@ -18,6 +18,9 @@
// HardwareInterface methods.
virtual const std::string BootDevice();
+ virtual std::string GetHardwareClass();
+ virtual std::string GetFirmwareVersion();
+ virtual std::string GetECVersion();
private:
DISALLOW_COPY_AND_ASSIGN(Hardware);
diff --git a/hardware_interface.h b/hardware_interface.h
index 2329f64..55f19ea 100644
--- a/hardware_interface.h
+++ b/hardware_interface.h
@@ -22,9 +22,19 @@
// or something with equivalent funcionality to interpret those.
virtual const std::string BootDevice() = 0;
- // TODO(deymo): Move other hardware-dependant functions to this interface:
- // GetECVersion, GetFirmwareVersion, GetHardwareClass, IsNormalBootMode and
- // IsOfficialBuild.
+ // TODO(deymo): Move other hardware-dependent functions to this interface:
+ // IsNormalBootMode and IsOfficialBuild.
+
+ // Returns the HWID or an empty string on error.
+ virtual std::string GetHardwareClass() = 0;
+
+ // Returns the firmware version or an empty string if the system is
+ // not running chrome os firmware.
+ virtual std::string GetFirmwareVersion() = 0;
+
+ // Returns the ec version or an empty string if the system is not
+ // running a custom chrome os ec.
+ virtual std::string GetECVersion() = 0;
virtual ~HardwareInterface() {}
};
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index ea25c74..a8de28f 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -17,6 +17,7 @@
#include <policy/device_policy.h>
#include "update_engine/constants.h"
+#include "update_engine/hardware_interface.h"
#include "update_engine/simple_key_value_store.h"
#include "update_engine/system_state.h"
#include "update_engine/utils.h"
@@ -78,10 +79,10 @@
NULL,
stateful_override);
app_lang_ = "en-US";
- hwid_ = utils::GetHardwareClass();
+ hwid_ = system_state_->hardware()->GetHardwareClass();
if (CollectECFWVersions()) {
- fw_version_ = utils::GetFirmwareVersion();
- ec_version_ = utils::GetECVersion();
+ fw_version_ = system_state_->hardware()->GetFirmwareVersion();
+ ec_version_ = system_state_->hardware()->GetECVersion();
}
if (current_channel_ == target_channel_) {
diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc
index 1523270..a4dfdc9 100644
--- a/omaha_request_params_unittest.cc
+++ b/omaha_request_params_unittest.cc
@@ -21,7 +21,7 @@
class OmahaRequestParamsTest : public ::testing::Test {
public:
- OmahaRequestParamsTest() : params_(NULL) {}
+ OmahaRequestParamsTest() : params_(&mock_system_state_) {}
protected:
// Return true iff the OmahaRequestParams::Init succeeded. If
@@ -39,8 +39,7 @@
kStatefulPartition + "/etc"));
// Create a fresh copy of the params for each test, so there's no
// unintended reuse of state across tests.
- MockSystemState mock_system_state;
- OmahaRequestParams new_params(&mock_system_state);
+ OmahaRequestParams new_params(&mock_system_state_);
params_ = new_params;
params_.set_root(string("./") + test_dir_);
params_.SetLockDown(false);
@@ -51,6 +50,7 @@
}
OmahaRequestParams params_;
+ MockSystemState mock_system_state_;
static const char* kTestDirTemplate;
string test_dir_;
@@ -89,8 +89,7 @@
"CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -98,7 +97,7 @@
EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.GetAppId());
EXPECT_EQ("0.2.2.3", out.app_version());
EXPECT_EQ("en-US", out.app_lang());
- EXPECT_EQ("", out.hwid());
+ EXPECT_EQ(mock_system_state_.hardware()->GetHardwareClass(), out.hwid());
EXPECT_TRUE(out.delta_okay());
EXPECT_EQ("dev-channel", out.target_channel());
EXPECT_EQ("http://www.google.com", out.update_url());
@@ -113,8 +112,7 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_RELEASE_APPID={58c35cef-9d30-476e-9098-ce20377d535d}\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -122,7 +120,7 @@
EXPECT_EQ("{58c35cef-9d30-476e-9098-ce20377d535d}", out.GetAppId());
EXPECT_EQ("0.2.2.3", out.app_version());
EXPECT_EQ("en-US", out.app_lang());
- EXPECT_EQ("", out.hwid());
+ EXPECT_EQ(mock_system_state_.hardware()->GetHardwareClass(), out.hwid());
EXPECT_TRUE(out.delta_okay());
EXPECT_EQ("dev-channel", out.target_channel());
EXPECT_EQ("http://www.google.com", out.update_url());
@@ -134,8 +132,7 @@
"CHROMEOS_RELEASE_FOO=bar\n"
"CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
"CHROMEOS_RELEASE_TRXCK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -151,8 +148,7 @@
"CHROMEOS_RELEASE_FOO=CHROMEOS_RELEASE_VERSION=1.2.3.4\n"
"CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
"CHROMEOS_RELEASE_TRXCK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -168,8 +164,7 @@
"CHROMEOS_RELEASE_BOARD=arm-generic\n"
"CHROMEOS_RELEASE_FOO=bar\n"
"CHROMEOS_RELEASE_TRACK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("_") + GetMachineType(), out.os_sp());
@@ -187,8 +182,7 @@
"CHROMEOS_RELEASE_BOARD=arm-generic\n"
"CHROMEOS_RELEASE_FOO=bar\n"
"CHROMEOS_RELEASE_TRACK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "ForcedVersion", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("ForcedVersion_") + GetMachineType(), out.os_sp());
@@ -207,8 +201,7 @@
"CHROMEOS_RELEASE_FOO=bar\n"
"CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
"CHROMEOS_RELEASE_TRACK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", "http://forced.google.com"));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -228,8 +221,7 @@
"CHROMEOS_RELEASE_FOO=bar\n"
"CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
"CHROMEOS_RELEASE_TRACK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -249,8 +241,7 @@
"CHROMEOS_RELEASE_VERSION=0.2.2.3\n"
"CHROMEOS_RELEASE_TRXCK=dev-channel"));
ASSERT_TRUE(WriteFileString(test_dir_ + "/.nodelta", ""));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_FALSE(out.delta_okay());
}
@@ -268,8 +259,7 @@
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=beta-channel\n"
"CHROMEOS_AUSERVER=https://www.google.com"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -277,7 +267,7 @@
EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.GetAppId());
EXPECT_EQ("0.2.2.3", out.app_version());
EXPECT_EQ("en-US", out.app_lang());
- EXPECT_EQ("", out.hwid());
+ EXPECT_EQ(mock_system_state_.hardware()->GetHardwareClass(), out.hwid());
EXPECT_FALSE(out.delta_okay());
EXPECT_EQ("beta-channel", out.target_channel());
EXPECT_EQ("https://www.google.com", out.update_url());
@@ -297,13 +287,12 @@
"CHROMEOS_RELEASE_TRACK=stable-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
params_.SetLockDown(true);
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("arm-generic", out.os_board());
EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.GetAppId());
EXPECT_EQ("0.2.2.3", out.app_version());
- EXPECT_EQ("", out.hwid());
+ EXPECT_EQ(mock_system_state_.hardware()->GetHardwareClass(), out.hwid());
EXPECT_FALSE(out.delta_okay());
EXPECT_EQ("stable-channel", out.target_channel());
EXPECT_EQ("https://www.google.com", out.update_url());
@@ -321,13 +310,12 @@
test_dir_ + kStatefulPartition + "/etc/lsb-release",
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=dev-channel"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("x86-generic", out.os_board());
EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.GetAppId());
EXPECT_EQ("0.2.2.3", out.app_version());
- EXPECT_EQ("", out.hwid());
+ EXPECT_EQ(mock_system_state_.hardware()->GetHardwareClass(), out.hwid());
EXPECT_TRUE(out.delta_okay());
EXPECT_EQ("dev-channel", out.target_channel());
EXPECT_EQ("http://www.google.com", out.update_url());
@@ -342,16 +330,14 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
{
- MockSystemState mock_system_state;
- OmahaRequestParams params(&mock_system_state);
+ OmahaRequestParams params(&mock_system_state_);
params.set_root(string("./") + test_dir_);
params.SetLockDown(false);
EXPECT_TRUE(params.Init("", "", false));
params.SetTargetChannel("canary-channel", false);
EXPECT_FALSE(params.is_powerwash_allowed());
}
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("canary-channel", out.target_channel());
EXPECT_FALSE(out.is_powerwash_allowed());
@@ -366,16 +352,14 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
{
- MockSystemState mock_system_state;
- OmahaRequestParams params(&mock_system_state);
+ OmahaRequestParams params(&mock_system_state_);
params.set_root(string("./") + test_dir_);
params.SetLockDown(false);
EXPECT_TRUE(params.Init("", "", false));
params.SetTargetChannel("canary-channel", true);
EXPECT_TRUE(params.is_powerwash_allowed());
}
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("canary-channel", out.target_channel());
EXPECT_TRUE(out.is_powerwash_allowed());
@@ -390,16 +374,14 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
{
- MockSystemState mock_system_state;
- OmahaRequestParams params(&mock_system_state);
+ OmahaRequestParams params(&mock_system_state_);
params.set_root(string("./") + test_dir_);
params.SetLockDown(true);
EXPECT_TRUE(params.Init("", "", false));
params.SetTargetChannel("dogfood-channel", true);
EXPECT_FALSE(params.is_powerwash_allowed());
}
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("arm-generic", out.os_board());
EXPECT_EQ("dev-channel", out.target_channel());
@@ -427,8 +409,7 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
params_.SetLockDown(true);
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("Chrome OS", out.os_platform());
EXPECT_EQ(string("0.2.2.3_") + GetMachineType(), out.os_sp());
@@ -436,7 +417,7 @@
EXPECT_EQ("{87efface-864d-49a5-9bb3-4b050a7c227a}", out.GetAppId());
EXPECT_EQ("0.2.2.3", out.app_version());
EXPECT_EQ("en-US", out.app_lang());
- EXPECT_EQ("", out.hwid());
+ EXPECT_EQ(mock_system_state_.hardware()->GetHardwareClass(), out.hwid());
EXPECT_TRUE(out.delta_okay());
EXPECT_EQ("dev-channel", out.target_channel());
EXPECT_EQ("http://www.google.com", out.update_url());
@@ -528,8 +509,7 @@
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=stable-channel\n"
"CHROMEOS_AUSERVER=https://www.google.com"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("https://www.google.com", out.update_url());
EXPECT_FALSE(out.delta_okay());
@@ -548,8 +528,7 @@
"CHROMEOS_BOARD_APPID=b\n"
"CHROMEOS_CANARY_APPID=c\n"
"CHROMEOS_RELEASE_TRACK=stable-channel\n"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("stable-channel", out.download_channel());
EXPECT_EQ("b", out.GetAppId());
@@ -562,8 +541,7 @@
"CHROMEOS_BOARD_APPID=b\n"
"CHROMEOS_CANARY_APPID=c\n"
"CHROMEOS_RELEASE_TRACK=canary-channel\n"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("canary-channel", out.download_channel());
EXPECT_EQ("c", out.GetAppId());
@@ -575,8 +553,7 @@
"CHROMEOS_RELEASE_APPID=r\n"
"CHROMEOS_CANARY_APPID=c\n"
"CHROMEOS_RELEASE_TRACK=stable-channel\n"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("stable-channel", out.download_channel());
EXPECT_EQ("r", out.GetAppId());
@@ -588,8 +565,7 @@
"CHROMEOS_RELEASE_APPID=r\n"
"CHROMEOS_CANARY_APPID=c\n"
"CHROMEOS_RELEASE_TRACK=stable-channel\n"));
- MockSystemState mock_system_state;
- OmahaRequestParams out(&mock_system_state);
+ OmahaRequestParams out(&mock_system_state_);
out.hwid_ = string("STUMPY ALEX 12345");
EXPECT_FALSE(out.CollectECFWVersions());
diff --git a/utils.cc b/utils.cc
index f23f31f..d33a5cc 100644
--- a/utils.cc
+++ b/utils.cc
@@ -85,47 +85,6 @@
return !dev_mode;
}
-string ReadValueFromCrosSystem(const string& key){
- int exit_code = 0;
- vector<string> cmd(1, "/usr/bin/crossystem");
- cmd.push_back(key);
-
- string return_value;
- bool success = Subprocess::SynchronousExec(cmd, &exit_code, &return_value);
- if (success && !exit_code) {
- TrimWhitespaceASCII(return_value, TRIM_ALL, &return_value);
- return return_value;
- }
- LOG(ERROR) << "Unable to read " << key << " (" << exit_code << ") "
- << return_value;
- return "";
-}
-
-string GetHardwareClass() {
- return ReadValueFromCrosSystem("hwid");
-}
-
-string GetFirmwareVersion() {
- return ReadValueFromCrosSystem("fwid");
-}
-
-string GetECVersion() {
- int exit_code = 0;
- vector<string> cmd(1, "/usr/sbin/mosys");
- cmd.push_back("-k");
- cmd.push_back("ec");
- cmd.push_back("info");
-
- string input_line;
- bool success = Subprocess::SynchronousExec(cmd, &exit_code, &input_line);
- if (!success || exit_code) {
- LOG(ERROR) << "Unable to read ec info from mosys (" << exit_code << ")";
- return "";
- }
-
- return ParseECVersion(input_line);
-}
-
string ParseECVersion(string input_line) {
TrimWhitespaceASCII(input_line, TRIM_ALL, &input_line);
diff --git a/utils.h b/utils.h
index 318333e..2727831 100644
--- a/utils.h
+++ b/utils.h
@@ -54,22 +54,10 @@
std::string CalculateP2PFileId(const std::string& payload_hash,
size_t payload_size);
-// Returns the HWID or an empty string on error.
-std::string GetHardwareClass();
-
-// Returns the firmware version or an empty string if the system is not running
-// chrome os firmware.
-std::string GetFirmwareVersion();
-
// Parse the firmware version from one line of output from the
// "mosys" command.
std::string ParseECVersion(std::string input_line);
-// Reads and parses the ec version from the "mosys" command. Returns
-// the version found, or an empty string if the system is not running a
-// custom chrome os ec.
-std::string GetECVersion();
-
// Given the name of the block device of a boot partition, return the
// name of the associated kernel partition (e.g. given "/dev/sda3",
// return "/dev/sda2").