summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-09-10 15:15:56 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-12 01:49:32 +0000
commitbd9d1746c7a6cddc15d68949dc59877d52e26429 (patch)
tree5f5341223cf34e9f9bfa091aaf9d49bbdc891660 /util
parentaf12f2f58c001dfa999591c29b055b7ba95379ba (diff)
downloadchrome-ec-bd9d1746c7a6cddc15d68949dc59877d52e26429.tar.gz
Change get-set host command to be less generic
Having a per-device enum list for use by the EC_CMD_GET_SET_VALUE command won't work when the one-and-only ectool tries to talk to different devices. Any particular enum may be missing or have a completely different meaning. Instead, we can do the same thing that EC_CMD_HOST_EVENT_* does - use the same structs for a bunch of different commands. If/when we run out of command numbers (it's currently only 8 bits), we'll just switch to using EC protocol v3 (see crosbug.com/p/20820), which provides 16 bits for the command. This CL renames EC_CMD_GET_SET_VALUE to EC_CMD_GSV_PAUSE_IN_S5 (since that's the one-and-only use of it at present), and renames the params/response structs as well. Since only the names are changing, the implementation remains backwards-compatible (assuming the flags value usage is preserved by ectool for the EC_CMD_GSV_PAUSE_IN_S5 command, which it is). If I can cherry-pick this change into the one place where it's being used, I will. BUG=chromium:287969 BRANCH=ToT TEST=manual Although this is primarily an internal name change, it also means that the commands to invoke the previous usage of this feature have changed. To test: On Haswell systems only. To enable the pause in S5 at shutdown, do either of these: EC console: pause_in_s5 on root shell: ectool pause_in_s5 on Shut the AP down politely, and it should pause in S5 for 10 seconds before continuing to G3. You can see this by watching the EC console. To disable the pause in S5 at shutdown, do any of these: EC console: pause_in_s5 off root shell: ectool pause_in_s5 off or press Refresh + POWER Boot the system, then politely shut down. This time it should go directly to G3 without pausing in S5. Change-Id: Ic614fed37ad89db794c2bbcca2b83d1603030ab2 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168816
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/util/ectool.c b/util/ectool.c
index ddf1295baf..9d83d67c31 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -17,7 +17,6 @@
#include "compile_time_macros.h"
#include "ec_flash.h"
#include "ectool.h"
-#include "getset.h"
#include "lightbar.h"
#include "lock/gec_lock.h"
#include "misc_util.h"
@@ -319,23 +318,24 @@ int cmd_test(int argc, char *argv[])
int cmd_s5(int argc, char *argv[])
{
- struct ec_cmd_get_set_value s;
+ struct ec_params_get_set_value p;
+ struct ec_params_get_set_value r;
int rv;
- s.flags = GSV_PARAM_s5;
+ p.flags = 0;
if (argc > 1) {
- s.flags |= EC_GSV_SET;
- if (!parse_bool(argv[1], &s.value)) {
+ p.flags |= EC_GSV_SET;
+ if (!parse_bool(argv[1], &p.value)) {
fprintf(stderr, "invalid arg \"%s\"\n", argv[1]);
return -1;
}
}
- rv = ec_command(EC_CMD_GET_SET_VALUE, 0,
- &s, sizeof(s), &s, sizeof(s));
+ rv = ec_command(EC_CMD_GSV_PAUSE_IN_S5, 0,
+ &p, sizeof(p), &r, sizeof(r));
if (rv > 0)
- printf("%s\n", s.value ? "on" : "off");
+ printf("%s\n", r.value ? "on" : "off");
return rv < 0;
}