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>
This commit is contained in:
parent
7508a9a69a
commit
ab6c4c651d
|
@ -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;
|
||||
|
|
|
@ -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[]);
|
||||
|
|
Loading…
Reference in New Issue