summaryrefslogtreecommitdiff
path: root/util/ectool.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-10-10 09:54:34 -0700
committerGerrit <chrome-bot@google.com>2012-11-01 14:09:34 -0700
commit4769627290a2cdfa851b76f2d1a550654b3b04fb (patch)
tree02e8255c4d1bcfab765199cc72d00aff1c9cb49a /util/ectool.h
parente9e02762dd4b09060911bda9b160502a8f36d4fd (diff)
downloadchrome-ec-4769627290a2cdfa851b76f2d1a550654b3b04fb.tar.gz
ectool: Add keyscan test features
Add a way of easily setting up keyscan tests using a simple text file format. The steps to run a test are as follows: - read the test file - read the key matrix information - translate the ascii characters from tests into keyscan codes - send the keyscan codes to the EC - tell the EC to start the test - wait for the required time, then collect what input we have received - check that the input matches the expected input BUG=chrome-os-partner:12179 BRANCH=none TEST=manual for now: On snow: ./ectool keyscan 10000 key_sequence.txt See that the test passes. Change-Id: I7de646205803a99443503a1b4bbf32f5fe89c534 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35119 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'util/ectool.h')
-rw-r--r--util/ectool.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/util/ectool.h b/util/ectool.h
new file mode 100644
index 0000000000..65eebcf6f2
--- /dev/null
+++ b/util/ectool.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2012 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.
+ */
+
+/**
+ * Test low-level key scanning
+ *
+ * ectool keyscan <beat_us> <filename>
+ *
+ * <beat_us> is the length of a beat in microseconds. This indicates the
+ * typing speed. Typically we scan at 10ms in the EC, so the beat period
+ * will typically be 1-5ms, with the scan changing only every 20-30ms at
+ * most.
+ * <filename> specifies a file containing keys that are depressed on each
+ * beat in the following format:
+ *
+ * <beat> <keys_pressed>
+ *
+ * <beat> is a beat number (0, 1, 2). The timestamp of this event will
+ * be <start_time> + <beat> * <beat_us>.
+ * <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[]);