summaryrefslogtreecommitdiff
path: root/util/comm-host.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-03-27 10:06:01 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-28 00:58:06 +0000
commitfe293908edbac37396d1c205dde7ba1a9adff011 (patch)
tree45844875c136fa6d18109a1009f992ed81f05f06 /util/comm-host.c
parentbf931b2cced0fac2f2810999ac672a3344b0849b (diff)
downloadchrome-ec-fe293908edbac37396d1c205dde7ba1a9adff011.tar.gz
ectool: Revert: Do not increase buffer size after probe max size from ec
Not needed with kernel fix: Commands are currenly limited to 252 bytes. Even if EC support protocol v3, ectool would only limit the command sizes, never go beyond 252 bytes. This reverts commit be0bd9b83538427cc350ad38d64b821dfcad82a0. It also remove a TODO. CQ-DEPEND=CL:262870 TEST=With proper kernel, and firmware supporting commands > 252 bytes, check that ectool console does not crash anymore. /usr/sbin/ectool --name cros_sh console returns more character than before. Check ectool version as well. /usr/sbin/ectool --name cros_sh version BUG=chromium:399057,chromium:454324,chrome-os-partner:31989,chrome-os-partner:23823 BRANCH=none Change-Id: I058ab0e6df96196a0fae186d1ffedcfa16e5dc3b Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/262885 Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
Diffstat (limited to 'util/comm-host.c')
-rw-r--r--util/comm-host.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/util/comm-host.c b/util/comm-host.c
index b5cd51adfe..7da86316fb 100644
--- a/util/comm-host.c
+++ b/util/comm-host.c
@@ -78,7 +78,6 @@ int ec_command(int command, int version,
int comm_init(int interfaces, const char *device_name)
{
struct ec_response_get_protocol_info info;
- int new_size;
/* Default memmap access */
ec_readmem = fake_readmem;
@@ -109,25 +108,16 @@ int comm_init(int interfaces, const char *device_name)
return 1;
}
- /*
- * read max request / response size from ec and reduce buffer size
- * if the size supported by ec is less than the default value.
- */
+ /* read max request / response size from ec for protocol v3+ */
if (ec_command(EC_CMD_GET_PROTOCOL_INFO, 0, NULL, 0, &info,
sizeof(info)) == sizeof(info)) {
- new_size = info.max_request_packet_size -
- sizeof(struct ec_host_request);
- if (ec_max_outsize > new_size) {
- ec_max_outsize = new_size;
- ec_outbuf = realloc(ec_outbuf, ec_max_outsize);
- }
- new_size = info.max_response_packet_size -
+ ec_max_outsize = info.max_request_packet_size -
+ sizeof(struct ec_host_request);
+ ec_max_insize = info.max_response_packet_size -
sizeof(struct ec_host_response);
- if (ec_max_insize > new_size) {
- ec_max_insize = new_size;
- ec_inbuf = realloc(ec_inbuf, ec_max_insize);
- }
+ ec_outbuf = realloc(ec_outbuf, ec_max_outsize);
+ ec_inbuf = realloc(ec_inbuf, ec_max_insize);
if (!ec_outbuf || !ec_inbuf) {
fprintf(stderr, "Unable to reallocate buffers\n");