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

Unified Diff: tools/battor_agent/battor_agent.cc

Issue 2622003005: [BattOr] Initialize BattOr before getting firmware git hash. (Closed)
Patch Set: fix spelling Created 3 years, 11 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 | « no previous file | tools/battor_agent/battor_agent_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/battor_agent/battor_agent.cc
diff --git a/tools/battor_agent/battor_agent.cc b/tools/battor_agent/battor_agent.cc
index 2a1d7d7aa02bc67ab93cc6333410c3e9d0f46f5c..dc5a521a6f6abf591ac728d47be537568fc9e649 100644
--- a/tools/battor_agent/battor_agent.cc
+++ b/tools/battor_agent/battor_agent.cc
@@ -198,7 +198,8 @@ void BattOrAgent::OnConnectionOpened(bool success) {
PerformAction(Action::SEND_CURRENT_SAMPLE_REQUEST);
return;
case Command::GET_FIRMWARE_GIT_HASH:
- PerformAction(Action::SEND_GIT_HASH_REQUEST);
+ num_init_attempts_ = 1;
+ PerformAction(Action::SEND_INIT);
return;
case Command::INVALID:
NOTREACHED();
@@ -317,8 +318,17 @@ void BattOrAgent::OnMessageRead(bool success,
return;
}
- PerformAction(Action::SEND_SET_GAIN);
- return;
+ switch (command_) {
+ case Command::START_TRACING:
+ PerformAction(Action::SEND_SET_GAIN);
+ return;
+ case Command::GET_FIRMWARE_GIT_HASH:
+ PerformAction(Action::SEND_GIT_HASH_REQUEST);
+ return;
+ default:
+ CompleteCommand(BATTOR_ERROR_UNEXPECTED_MESSAGE);
+ return;
+ }
case Action::READ_SET_GAIN_ACK:
if (!IsAckOfControlCommand(type, BATTOR_CONTROL_MESSAGE_TYPE_SET_GAIN,
« no previous file with comments | « no previous file | tools/battor_agent/battor_agent_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698