summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2014-10-30 15:02:37 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-18 05:19:08 +0000
commit4b154c6f956d0d30e78d7f1d2c5b6867dbfbf8f0 (patch)
treefe1f0e3aea34410b8b5fdfde5cbc907eee27f132 /test
parent89442037be2ebd83be57b68bfabeaf2ad0367171 (diff)
downloadchrome-ec-4b154c6f956d0d30e78d7f1d2c5b6867dbfbf8f0.tar.gz
motion: Add decoding for MOTION_CMD_DUMP v1 command
MOTIONSENSE_CMD_DUMP is deprecated, replaced with MOTIONSENSE_CMD_GET_DATA Also use vector_3_t instead of x,y,z ectool motionsense commands only work with newer firmware, to handle a dynamic number of sensors. - The host sends the number of sensor it has allocated space for. - If 0, the EC just sends the number of sensors available - Otherwise returns sensor information up to the limit imposed by the host. Remove MOTIONSENSE_GET_STATUS: not needed. It is only useful for LPC, to guarantee atomicity of the data. Remove MOTIONSENSE_GET_DATA: not needed since we increase the version number of MOTIONSENSE command. BUG=chrome-os-partner:31071,chromium:430792 BRANCH=ToT TEST=Compile. On a firmware that support the new command: /usr/sbin/ectool --name=cros_sh motionsense Motion sensing active Sensor 0: 92 15 1030 Sensor 1: -94 -63 718 /usr/sbin/ectool --name=cros_sh motionsense active 0 On a machine with older firmware (samus), check these functions are not working anymore. Change-Id: I64b62afff96670fb93457760d43d4e64e26e029f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226880 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/motion_lid.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/motion_lid.c b/test/motion_lid.c
index e8880e85a8..e0f1e68e7c 100644
--- a/test/motion_lid.c
+++ b/test/motion_lid.c
@@ -30,12 +30,11 @@ static int accel_init(const struct motion_sensor_t *s)
return EC_SUCCESS;
}
-static int accel_read(const struct motion_sensor_t *s,
- int *x_acc, int *y_acc, int *z_acc)
+static int accel_read(const struct motion_sensor_t *s, vector_3_t v)
{
- *x_acc = s->xyz[X];
- *y_acc = s->xyz[Y];
- *z_acc = s->xyz[Z];
+ v[X] = s->xyz[X];
+ v[Y] = s->xyz[Y];
+ v[Z] = s->xyz[Z];
return EC_SUCCESS;
}
@@ -102,12 +101,12 @@ const matrix_3x3_t lid_standard_ref = {
};
struct motion_sensor_t motion_sensors[] = {
- {SENSOR_ACTIVE_S0_S3_S5, "base", SENSOR_CHIP_LSM6DS0,
- SENSOR_ACCELEROMETER, LOCATION_BASE,
+ {SENSOR_ACTIVE_S0_S3_S5, "base", MOTIONSENSE_CHIP_LSM6DS0,
+ MOTIONSENSE_TYPE_ACCEL, MOTIONSENSE_LOC_BASE,
&test_motion_sense, NULL, NULL,
0, &base_standard_ref, 119000, 2},
- {SENSOR_ACTIVE_S0, "lid", SENSOR_CHIP_KXCJ9,
- SENSOR_ACCELEROMETER, LOCATION_LID,
+ {SENSOR_ACTIVE_S0, "lid", MOTIONSENSE_CHIP_KXCJ9,
+ MOTIONSENSE_TYPE_ACCEL, MOTIONSENSE_LOC_LID,
&test_motion_sense, NULL, NULL,
0, &lid_standard_ref, 100000, 2},
};