Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: omaha_request_params.cc

Issue 3007020: Add a hardware_class attribute (for HWID, HWQual ID) to the Omaha request. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix typo Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « omaha_request_params.h ('k') | omaha_request_params_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: omaha_request_params.cc
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index 0789fbb06426485ae2d2f79e7d6c68741b63eb42..9f6e82b7ff5140dc05de2a03ba85e0774e68bac1 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -11,6 +11,7 @@
#include <map>
#include <string>
+#include "base/file_util.h"
#include "base/string_util.h"
#include "update_engine/simple_key_value_store.h"
#include "update_engine/utils.h"
@@ -27,6 +28,8 @@ const char* const OmahaRequestParams::kOsVersion("Indy");
const char* const OmahaRequestParams::kUpdateUrl(
"https://tools.google.com/service/update2");
+static const char kHWIDPath[] = "/sys/devices/platform/chromeos_acpi/HWID";
+
bool OmahaRequestDeviceParams::Init(const std::string& in_app_version,
const std::string& in_update_url) {
os_platform = OmahaRequestParams::kOsPlatform;
@@ -38,6 +41,7 @@ bool OmahaRequestDeviceParams::Init(const std::string& in_app_version,
app_id = OmahaRequestParams::kAppId;
app_lang = "en-US";
app_track = GetLsbValue("CHROMEOS_RELEASE_TRACK", "");
+ hardware_class = GetHardwareClass();
struct stat stbuf;
// Deltas are only okay if the /.nodelta file does not exist.
@@ -79,4 +83,14 @@ string OmahaRequestDeviceParams::GetMachineType() const {
return ret;
}
+string OmahaRequestDeviceParams::GetHardwareClass() const {
+ string hwid;
+ if (!file_util::ReadFileToString(FilePath(root_ + kHWIDPath), &hwid)) {
+ LOG(ERROR) << "Unable to determine the system hardware qualification ID.";
+ return "";
+ }
+ TrimWhitespaceASCII(hwid, TRIM_ALL, &hwid);
+ return hwid;
+}
+
} // namespace chromeos_update_engine
« no previous file with comments | « omaha_request_params.h ('k') | omaha_request_params_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698