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

Unified Diff: tools/battor_agent/battor_agent_bin.cc

Issue 2390893002: [BattOr] Make BattOr able to return firmware version. (Closed)
Patch Set: Start Work On Getting Git Hash Created 4 years, 2 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
Index: tools/battor_agent/battor_agent_bin.cc
diff --git a/tools/battor_agent/battor_agent_bin.cc b/tools/battor_agent/battor_agent_bin.cc
index 6a70127bc47381338b85e2f3fd53cdbf3aa86186..39114f640a1c042444ac2d6d565a63162efa7fac 100644
--- a/tools/battor_agent/battor_agent_bin.cc
+++ b/tools/battor_agent/battor_agent_bin.cc
@@ -74,6 +74,7 @@ const char kUsage[] =
" StopTracing <optional file path>\n"
" SupportsExplicitClockSync\n"
" RecordClockSyncMarker <marker>\n"
+ " Version\n"
" Exit\n"
" Help\n"
"\n";
@@ -200,6 +201,9 @@ class BattOrAgentBin : public BattOrAgent::Listener {
}
RecordClockSyncMarker(tokens[1]);
+ } else if (cmd == "Version") {
+ GetVersion();
+ PostRunNextCommand();
} else if (cmd == "Exit" || std::cin.eof()) {
ui_thread_message_loop_.task_runner()->PostTask(
FROM_HERE, ui_thread_run_loop_.QuitClosure());
@@ -215,6 +219,21 @@ class BattOrAgentBin : public BattOrAgent::Listener {
base::Bind(&BattOrAgentBin::RunNextCommand, base::Unretained(this)));
}
+ void GetVersion() {
+ io_thread_.task_runner()->PostTask(
+ FROM_HERE,
+ base::Bind(&BattOrAgent::GetVersion, base::Unretained(agent_.get())));
+ }
+
+ void OnGetVersionComplete(const int version, BattOrError error) override {
+ if (error == BATTOR_ERROR_NONE)
+ std::cout << version << endl;
+ else
+ HandleError(error);
+
+ PostRunNextCommand();
+ }
+
void StartTracing() {
io_thread_.task_runner()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698