summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorDaniel Gonzalez <daniel.d.gonzalez@intel.com>2019-01-30 15:46:06 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-06 08:32:16 -0800
commitbf892ac8eae99e57a2d2fc6698e591622fc47e96 (patch)
tree37e240d50839398080f3ef7d5a96258bce79464e /common/motion_sense.c
parent2ba385eb9e71727afa9f2fa993c97d222e606671 (diff)
downloadchrome-ec-bf892ac8eae99e57a2d2fc6698e591622fc47e96.tar.gz
common: Added motion sense info to accelinfo command
accelinfo command prints relevant motion sensor data BUG=none TEST=On Bobba board in EC console BRANCH=None Change-Id: I56e83f2c1aafa89f4950c4d6a414750c415043bf Signed-off-by: Daniel Gonzalez <daniel.d.gonzalez@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1447002 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daniel D Gonzalez <daniel.d.gonzalez@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index f5bfc8426c..ad2ac998a9 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -1728,13 +1728,34 @@ DECLARE_CONSOLE_COMMAND(accelinit, command_accel_init,
static int command_display_accel_info(int argc, char **argv)
{
char *e;
- int val;
+ int val, i, j;
if (argc > 3)
return EC_ERROR_PARAM_COUNT;
ccprintf("Motion sensors count = %d\n", motion_sensor_count);
+ /* Print motion sensor info. */
+ for (i = 0; i < motion_sensor_count; i++) {
+ ccprintf("\nsensor %d name: %s\n", i, motion_sensors[i].name);
+ ccprintf("active mask: %d\n", motion_sensors[i].active_mask);
+ ccprintf("chip: %d\n", motion_sensors[i].chip);
+ ccprintf("type: %d\n", motion_sensors[i].type);
+ ccprintf("location: %d\n", motion_sensors[i].location);
+ ccprintf("port: %d\n", motion_sensors[i].port);
+ ccprintf("addr: %d\n", motion_sensors[i].addr);
+ ccprintf("range: %d\n", motion_sensors[i].default_range);
+ ccprintf("min_freq: %d\n", motion_sensors[i].min_frequency);
+ ccprintf("max_freq: %d\n", motion_sensors[i].max_frequency);
+ ccprintf("config:\n");
+ for (j = 0; j < SENSOR_CONFIG_MAX; j++) {
+ ccprintf("%d - odr: %umHz, ec_rate: %uus\n", j,
+ motion_sensors[i].config[j].odr &
+ ~ROUND_UP_FLAG,
+ motion_sensors[i].config[j].ec_rate);
+ }
+ }
+
/* First argument is on/off whether to display accel data. */
if (argc > 1) {
if (!parse_bool(argv[1], &val))