mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-30 18:41:11 +00:00
When running certain ectool commands, our ioctl may succeed, yet our command may not be successful for a variety of reasons (see ec_status enum). In this case, we should return a non-success exit code so that we can easily detect such failures in scripts. BUG=chrome-os-partner:21171. TEST=Pass FAFT suite on Peppy. Pass factory tests on Peppy. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ia33b8285fb048b256f0668b709573e86c15f1162 Reviewed-on: https://gerrit.chromium.org/gerrit/64686 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* For hysterical raisins, there are several mechanisms for communicating with
|
|
* the EC. This abstracts them.
|
|
*/
|
|
|
|
#ifndef COMM_HOST_H
|
|
#define COMM_HOST_H
|
|
|
|
#include "common.h"
|
|
#include "ec_commands.h"
|
|
|
|
/* ec_command return value for non-success result from EC */
|
|
#define EECRESULT 1000
|
|
|
|
/* Maximum output and input sizes for EC command, in bytes */
|
|
extern int ec_max_outsize, ec_max_insize;
|
|
|
|
/*
|
|
* Maximum-size output and input buffers, for use by callers. This saves each
|
|
* caller needing to allocate/free its own buffers.
|
|
*/
|
|
extern void *ec_outbuf;
|
|
extern void *ec_inbuf;
|
|
|
|
/**
|
|
* Perform initializations needed for subsequent requests
|
|
*
|
|
* returns 0 in case of success or error code. */
|
|
int comm_init(void);
|
|
|
|
/**
|
|
* Send a command to the EC. Returns the length of output data returned (0 if
|
|
* none), or negative on error.
|
|
*/
|
|
extern int (*ec_command)(int command, int version,
|
|
const void *outdata, int outsize, /* to the EC */
|
|
void *indata, int insize); /* from the EC */
|
|
|
|
/**
|
|
* Return the content of the EC information area mapped as "memory".
|
|
* The offsets are defined by the EC_MEMMAP_ constants. Returns the number
|
|
* of bytes read, or negative on error. Specifying bytes=0 will read a
|
|
* string (always including the trailing '\0').
|
|
*/
|
|
extern int (*ec_readmem)(int offset, int bytes, void *dest);
|
|
|
|
#endif /* COMM_HOST_H */
|