samus: Fixed a bug in host_sensor_id_to_motion_sensor

BUG=chrome-os-partner:32368
BRANCH=ToT
TEST=Verified on Samus.

cd /sys/bus/iio/devices/iio:device0
cat *peak_scale

Change-Id: I2b0606e55bfa5e498255c6c42240ee3f9236e4f1
Signed-off-by: Sheng-Liang Song <ssl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220991
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Sheng-Liang Song
2014-10-01 18:07:06 -07:00
committed by chrome-internal-fetch
parent 91cfdd0dac
commit ac1c82a35b

View File

@@ -432,29 +432,28 @@ static struct motion_sensor_t
for (i = 0; i < motion_sensor_count; ++i) {
sensor = &motion_sensors[i];
if ((LOCATION_BASE == sensor->location)
&& (SENSOR_ACCELEROMETER == sensor->type)
&& (host_id == EC_MOTION_SENSOR_ACCEL_BASE)) {
sensor = &motion_sensors[i];
break;
}
if ((LOCATION_LID == sensor->location)
&& (SENSOR_ACCELEROMETER == sensor->type)
&& (host_id == EC_MOTION_SENSOR_ACCEL_LID)) {
sensor = &motion_sensors[i];
break;
}
if ((LOCATION_BASE == sensor->location)
&& (SENSOR_GYRO == sensor->type)
&& (host_id == EC_MOTION_SENSOR_GYRO)) {
sensor = &motion_sensors[i];
break;
}
}
if (!sensor)
if (i == motion_sensor_count)
return NULL;
if ((sensor->power == SENSOR_POWER_ON)