New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 613562 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug



Sign in to add a comment

BattOr agent doesn't always continue reading incomplete messages

Project Member Reported by charliea@chromium.org, May 20 2016

Issue description

When the BattOrConnectionImpl does a serial read, it can result in a couple of states:

1) A complete message is read, and that message is returned.
2) Bytes are read, but they're wrong in some way that's irrecoverable. An example of this would be if the agent is expecting an ACK and it receives a  BattOr data frame.
3) Bytes are read, and it's the start of a valid message, but more bytes are needed to complete that message. In this case, the connection should go back for more bytes until state 1) or 2) is reached.

Right now, 3) doesn't happen: instead the read just fails. This is masked by the fact that when a read fails, it retries up to three times. Because of this, we read more bytes up to three times. However, if a message is longer than 3 * MAX_READ_LENGTH, we're out of luck.

We should fix this so that we read more bytes up to MAX_MESSAGE_LENGTH when a message is incomplete.
 
Project Member

Comment 1 by bugdroid1@chromium.org, May 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f7b11a03318b4e244bb743bb506afc702d7e8f7c

commit f7b11a03318b4e244bb743bb506afc702d7e8f7c
Author: charliea <charliea@chromium.org>
Date: Fri May 20 17:52:59 2016

[battor agent] Add 'read more bytes' logic in the BattOr connection

Right now, when one read doesn't result in a complete message, the read
fails and retries up to RETRY_COUNT (3) times. However, the BattOr
connection SHOULD read more data from the serial connection until:

1) A complete message is read
2) Bytes are read that are irrecoverably erroneous in some way
or
3) More bytes are read than the maximum message length

This CL makes this the case.

BUG= 613562 

Review-Url: https://codereview.chromium.org/2000743002
Cr-Commit-Position: refs/heads/master@{#395110}

[modify] https://crrev.com/f7b11a03318b4e244bb743bb506afc702d7e8f7c/tools/battor_agent/battor_connection_impl.cc
[modify] https://crrev.com/f7b11a03318b4e244bb743bb506afc702d7e8f7c/tools/battor_agent/battor_connection_impl.h
[modify] https://crrev.com/f7b11a03318b4e244bb743bb506afc702d7e8f7c/tools/battor_agent/battor_connection_impl_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment