Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 663720b2 authored by Jim Kaye's avatar Jim Kaye
Browse files

Fix enforcement of sensor's slowest rate

This code calculates a sensor's maximum sample
period in nanoseconds. This is stored as a 64-bit
value, as required for periods greater than ~2.1
seconds.

The calculation was done with 32-bit arithmetic,
sometimes resulting in overflow. This caused the
sensor to run at its maximum rate.

(The requested period is first clipped to the maximum
period. When the maximum period appears negative, it
is always used. The now-negative period is then clipped
to the minimum period, resulting in the sensor's maximum
supported rate.)

Bug: 37465457

Test: Verified correct operation with Goldfish accelerometer,
which has a 60-second maximum period.

Change-Id: Ic75a9dc7c4e7c9ca690eafbfa51ee50540ca5aaf
parent 584bc3ce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment