summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Cutts <hcutts@chromium.org>2019-10-14 16:55:27 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-16 05:01:35 +0000
commitab6c4c651d3c8fb1f522ea97818f460583c5cbc8 (patch)
tree3bad28025eaba50e5f75cf6811ef07a8cd8c7680
parent7508a9a69a061dd74fb0d9d83c8ebf17335a5c38 (diff)
downloadchrome-ec-ab6c4c651d3c8fb1f522ea97818f460583c5cbc8.tar.gz
util/ectool: move `struct command` into `ectool.h`
This allows it to be used by private host binaries (such as the one in https://crrev.com/i/1914158), which may wish to follow the same pattern as `ectool`. While we're at it, add some documentation comments. BRANCH=none BUG=chromium:1008568 TEST=Check `ectool` builds and runs. Change-Id: I94b02f9b734f65b1344a79d6ac8752c40ecf1f04 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1861075 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--util/ectool.c5
-rw-r--r--util/ectool.h20
2 files changed, 16 insertions, 9 deletions
diff --git a/util/ectool.c b/util/ectool.c
index c7cac69a7c..5c6689d398 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -8432,11 +8432,6 @@ int cmd_port80_read(int argc, char *argv[])
return 0;
}
-struct command {
- const char *name;
- int (*handler)(int argc, char *argv[]);
-};
-
int cmd_force_lid_open(int argc, char *argv[])
{
struct ec_params_force_lid_open p;
diff --git a/util/ectool.h b/util/ectool.h
index 65687f292f..c47edbf27c 100644
--- a/util/ectool.h
+++ b/util/ectool.h
@@ -3,6 +3,22 @@
* found in the LICENSE file.
*/
+/** @brief A handler for an `ectool` command. */
+struct command {
+ /** The name of the command. */
+ const char *name;
+
+ /**
+ * The function to handle the command.
+ *
+ * @param argc The length of `argv`
+ * @param argv The arguments passed, including the command itself but
+ * not 'ectool'.
+ * @return 0 if successful, or a negative `enum ec_status` value.
+ */
+ int (*handler)(int argc, char *argv[]);
+};
+
/**
* Test low-level key scanning
*
@@ -22,9 +38,5 @@
* <keys_pressed> is a (possibly empty) list of ASCII keys
*
* The key matrix is read from the fdt.
- *
- * @param argc Number of arguments (excluding 'ectool')
- * @param argv List of arguments
- * @return 0 if ok, -1 on error
*/
int cmd_keyscan(int argc, char *argv[]);