diff options
author | Aseda Aboagye <aaboagye@google.com> | 2016-12-16 18:24:08 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-01-07 13:29:52 -0800 |
commit | b3a9e1b64c25a4e35345903f5e20a841817962f6 (patch) | |
tree | 9828541d43e306b7f45b8e55be061c53a42a3448 /include/motion_sense.h | |
parent | 7db78001c2c262f332f5e00fdf6d86cf05ff897e (diff) | |
download | chrome-ec-b3a9e1b64c25a4e35345903f5e20a841817962f6.tar.gz |
motion_sense: Add "spoof" mode
This commit adds a "spoof" mode feature to the motionsense stack. It
allows the user to arbitrarily set the outputs of the sensor in order to
"spoof" the readings of the sensor. This can be useful in emulating
tablet mode or device rotations. A command is available from the EC
console named `accelspoof` and there is a corresponding motionsense
command in ectool called `spoof`.
The usage is as follows:
- EC console
> accelspoof [id] [on/off] [X Y Z]
- ectool
# ectool motionsense spoof -- [id] [0/1] [X Y Z]
If on or off(or 0/1) is not specified, the current spoof mode status of
the sensor is returned. If on is specified, but no components are
provided, the sensor will lock the current values and provide those as
the spoofed values. If the components are provided, those will be used
as the spoofed values.
BUG=chromium:675263
BRANCH=cyan,glados,gru,oak
TEST=Flash a DUT with accels. From AP console, run `ectool motionsense
lid_angle` in a loop, use 'accelspoof' EC console command to set spoofed
values. Verify that the angle is fixed regardless of the actual angle
of the DUT.
TEST=Flash a DUT with accels. From AP console, use `ectool motionsense
spoof` to spoof values and verify that `ectool motionsense` reflects the
spoofed values. Test with both provided component values and no
component values.
Change-Id: Ie30688d22f38054e7243b1af493a3092b2cdfb72
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/421280
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r-- | include/motion_sense.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h index 98c27ae04d..30384374bd 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -78,6 +78,12 @@ struct motion_sensor_t { /* i2c address or SPI slave logic GPIO. */ uint8_t addr; + /* + * When non-zero, spoof mode will allow the EC to report arbitrary + * values for any of the components. + */ + uint8_t in_spoof_mode; + const matrix_3x3_t *rot_standard_ref; /* @@ -108,6 +114,7 @@ struct motion_sensor_t { enum sensor_state state; vector_3_t raw_xyz; vector_3_t xyz; + vector_3_t spoof_xyz; /* How many flush events are pending */ uint32_t flush_pending; |