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/accelgyro.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/accelgyro.h')
-rw-r--r-- | include/accelgyro.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h index 883516bb3e..f78af2bb90 100644 --- a/include/accelgyro.h +++ b/include/accelgyro.h @@ -108,6 +108,10 @@ struct accelgyro_drv { * - update sensor raw_xyz vector with the last information. * We put raw data in hub fifo and process data from there. * @s Pointer to sensor data. + * + * NOTE: If a new driver supports this function, be sure to add a check + * for spoof_mode in order to load the sensor stack with the spoofed + * data. See accelgyro_bmi160.c::load_fifo for an example. */ int (*load_fifo)(struct motion_sensor_t *s); #endif |