mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
accel: changed motion sense host command to be more permissive with data args
Changed the ec_rate sub-command of the motion sense command. Now it permits any value for the rate as an argument and then bounds that to within the min and max. This matches the behavior of the other sub-commands such that for any argument the command will return success, but if the arg is not valid, it finds the closest valid value. BUG=none BRANCH=rambi TEST=Tested on a glimmer by using the ectool motionsense command. Made sure if you give it a value outside of the range [5, 1000], then it simply bounds it to the closest value in that range: > ectool motionsense ec_rate 0 5 > ectool motionsense ec_rate 100 100 > ectool motionsense ec_rate 1100 1000 Change-Id: If71299e3ab27bcfac87103c672793ac61f88100e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192525 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193308
This commit is contained in:
committed by
chrome-internal-fetch
parent
529548208c
commit
e3579f43d8
@@ -378,15 +378,15 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
|
||||
* has a value.
|
||||
*/
|
||||
if (in->ec_rate.data != EC_MOTION_SENSE_NO_VALUE) {
|
||||
if (in->ec_rate.data >= MIN_POLLING_INTERVAL_MS &&
|
||||
in->ec_rate.data <= MAX_POLLING_INTERVAL_MS) {
|
||||
accel_interval_ap_on_ms = in->ec_rate.data;
|
||||
accel_interval_ms = accel_interval_ap_on_ms;
|
||||
} else {
|
||||
CPRINTF("[%T MS bad EC sampling rate %d]\n",
|
||||
in->ec_rate.data);
|
||||
return EC_RES_INVALID_PARAM;
|
||||
}
|
||||
/* Bound the new sampling rate. */
|
||||
data = in->ec_rate.data;
|
||||
if (data < MIN_POLLING_INTERVAL_MS)
|
||||
data = MIN_POLLING_INTERVAL_MS;
|
||||
if (data > MAX_POLLING_INTERVAL_MS)
|
||||
data = MAX_POLLING_INTERVAL_MS;
|
||||
|
||||
accel_interval_ap_on_ms = data;
|
||||
accel_interval_ms = data;
|
||||
}
|
||||
|
||||
out->ec_rate.ret = accel_interval_ap_on_ms;
|
||||
|
||||
Reference in New Issue
Block a user