OSDN Git Service
Adriana Reus [Tue, 16 Sep 2014 11:08:10 +0000 (14:08 +0300)]
Don't calibrate gyro if terse driver
If we get events on a on-change basis it's better not to
attempt a calibration since we may receive the same event
duplicated and may end up with a wrong bias.
Issue: GMINL-1234
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: Ieb99ee794299f3112f3149757a5a2ae0cdfc256e
Adriana Reus [Mon, 15 Sep 2014 14:22:01 +0000 (17:22 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master
git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
298c194 Fri Aug 29 13:57:07 2014 +0200 | Refine sensor property get function to filter by iio dev name (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
b1f370d Mon Sep 15 14:06:56 2014 +0300 | [Workaround] Fix event timestamp recurrency [Adriana Reus]
8b0553e Mon Sep 15 14:05:29 2014 +0300 | Limit max frequency to 1000 Hz [Adriana Reus]
05135a5 Mon Sep 15 14:03:27 2014 +0300 | Revert "STPK-1429: Always wait for at least 1 ms before repeating samples" [Adriana Reus]
git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
common.h | 1 +
control.c | 13 ++++---------
description.c | 25 ++++++++++++++++++++++++-
3 files changed, 29 insertions(+), 10 deletions(-)
Change-Id: Ic8e63f31165e0e63e41c32d745cde37dae17da9b
Patrick Porlan [Fri, 29 Aug 2014 11:57:07 +0000 (13:57 +0200)]
Refine sensor property get function to filter by iio dev name
This enables having multiple sensors of the same type.
ro.iio.anglvel.bmg160.name is picked up instead of
ro.iio.anglvel.name if the iio device name fort he sensor we
are querying is bmg160.
Change-Id: I62995ea293b765585778a2190bff31c6a75c3ef5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Mon, 15 Sep 2014 11:06:56 +0000 (14:06 +0300)]
[Workaround] Fix event timestamp recurrency
A lot of new cts test for sensors expect to have
very regular intervals for events or else they will
report event gaps. Getting the timestamp right before
reporting seems to level them.
Issue: GMINL-544
Change-Id: Ie9554ba3ff95a5fa2c5bb29083181bf23776765e
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Adriana Reus [Mon, 15 Sep 2014 11:05:29 +0000 (14:05 +0300)]
Limit max frequency to 1000 Hz
Android sets up 1000 hz for DELAY_FASTEST. This conflicts
with some cts tests for sensors that report higher frequencies
(example bmg160 gyro). Since none of the current sensors actually
report these kind of high values to userspace it also
doesn't make much sense to duplicate events in a higher rate.
Issue: GMINL-544
Change-Id: I2ded62ca7345b0f49c4b8b20ce3022055bacbdd1
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Adriana Reus [Mon, 15 Sep 2014 11:03:27 +0000 (14:03 +0300)]
Revert "STPK-1429: Always wait for at least 1 ms before repeating samples"
This adds an artificial limitation for frequency which makes
some cts tests fail. They expect to receive higher frequencies
(example 1000 hz) but this limits the frequency at aroung 850 hz.
I wasn't able to see any side effect from removing this, so revert
at least for the moment.
This reverts commit
4c189692e67bc68d520d7adf462348ea4fd54900.
Issue: GMINL-544
Adriana Reus [Tue, 9 Sep 2014 14:55:30 +0000 (17:55 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master
git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
28c665e Mon Aug 18 11:28:26 2014 +0300 | Fix build for x86_64 (origin/abt/topic/gmin/l-dev/sensors/master) [Irina Tirdea]
4acf533 Thu Sep 4 13:54:01 2014 +0300 | Populate minDelay field. [Adriana Reus]
61a5b42 Thu Aug 28 19:20:01 2014 +0200 | GMIN-2992: Prefix uncalibrated gyro name with Uncalibrated [Patrick Porlan]
7d7c4b0 Wed Aug 27 18:12:10 2014 +0200 | GMIN-3015: Initialize accuracy flag on accel and gyro samples [Patrick Porlan]
25e58ad Wed Aug 27 18:36:43 2014 +0200 | GMIN-3015: Refine a little bit the magnetometer accuracy indicator [Patrick Porlan]
git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
compass-calibration.c | 31 +++++++++++++++++++++----
control.c | 15 +++++++-----
description.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++
enumeration.c | 8 +++++++
gyro-calibration.c | 5 ++++
transform.c | 2 ++
6 files changed, 112 insertions(+), 11 deletions(-)
Change-Id: I2c9474899c85908c2c69eab675bf90b751cdca3a
Irina Tirdea [Mon, 18 Aug 2014 08:28:26 +0000 (11:28 +0300)]
Fix build for x86_64
target C: sensors.gmin <= vendor/intel/hardware/iio-sensors/./control.c
vendor/intel/hardware/iio-sensors/./control.c: In function 'acquisition_routine':
vendor/intel/hardware/iio-sensors/./control.c:337:10: error: cast from pointer
to integer of different size [-Werror=pointer-to-int-cast]
int s = (int) param;
^
vendor/intel/hardware/iio-sensors/./control.c: In function
'start_acquisition_thread':
vendor/intel/hardware/iio-sensors/./control.c:453:5: error: cast to pointer
from integer of different size [-Werror=int-to-pointer-cast]
(void*) s);
^
Change-Id: Id994ceab05378e53b38bfafa4ead9121eb4163e8
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Adriana Reus [Thu, 4 Sep 2014 10:54:01 +0000 (13:54 +0300)]
Populate minDelay field.
Populate minDelay field with what data we find in
'sampling_frequencies_available'.
For sensors in poll mode where we don't have a way to
request a frequency, artificially set up a limit per
CDD requirements.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I962e6e352a07f42b4833a83908a4b984a3f17235
Patrick Porlan [Thu, 28 Aug 2014 17:20:01 +0000 (19:20 +0200)]
GMIN-2992: Prefix uncalibrated gyro name with Uncalibrated
Otherwise it's not clear in many applications which of the two
gyroscopes is the uncalibrated one.
Issue: GMIN-2992
Change-Id: I5610e16290e0e8914efb8bf5aa3a8250bc141509
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 27 Aug 2014 16:12:10 +0000 (18:12 +0200)]
GMIN-3015: Initialize accuracy flag on accel and gyro samples
It's done already for magnetometer samples, and this flag does not
exist for sensors other than 3D (see sensors.h). This indicator is
visible in applications such as My Sensors, and may be used by the
sensors framework to decide how much it can trust incoming data.
Issue: GMIN-3015
Change-Id: I6773819396b1adc44ab0b56f7cf3b9e295706644
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 27 Aug 2014 16:36:43 +0000 (18:36 +0200)]
GMIN-3015: Refine a little bit the magnetometer accuracy indicator
We now start at the default (unreliable) level then increase as we
go through calibration stages.
Issue: GMIN-3015
Change-Id: I3432feaad3426748b991da94bc41983d0b97943d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Wed, 3 Sep 2014 09:23:22 +0000 (12:23 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master
git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
e58ac5e Tue Aug 26 11:57:01 2014 +0200 | GMIN-2992: Revisit gyroscope calibration (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
85c4211 Tue Aug 26 15:51:42 2014 +0200 | GMIN-2992: Don't be as heavy handed with gyro filtering as compass [Patrick Porlan]
86b28ca Tue Aug 26 11:00:52 2014 +0200 | GMIN-2992: Use much larger set for gyro calibration [Patrick Porlan]
aac966e Mon Aug 25 18:51:55 2014 +0200 | GMIN-2992: Start with -dev trigger before switching to -any-motion [Patrick Porlan]
50e0b4b Mon Aug 4 20:01:38 2014 +0200 | Reconciliate tree with SP version regarding uncalibrated gyro. [Patrick Porlan]
c4b7635 Wed Aug 20 19:30:30 2014 +0200 | GMIN-2992: Enable filtering on accelerometer and gyroscope [Patrick Porlan]
ac3a0ef Wed Aug 20 16:31:19 2014 +0200 | GMIN-3044: Fix a few edge cases in filtering code [Patrick Porlan]
1f3fb0e Wed Aug 20 16:24:46 2014 +0200 | GMIN-3044: Fix a problem were filtering would not reengage [Patrick Porlan]
9d9e281 Wed Aug 20 11:28:57 2014 +0200 | PLD processing readibility tweaks [Patrick Porlan]
97b100e Tue Aug 19 11:54:44 2014 +0200 | Enable .panel and .rotation specifiers in property files [Patrick Porlan]
e366844 Mon Aug 18 14:53:25 2014 +0200 | Derive sensor orientation from PLD ACPI data if available. [Patrick Porlan]
1fdd271 Mon Aug 18 14:44:52 2014 +0200 | Small changes intended at making the code more readable [Patrick Porlan]
git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
calibration.h | 8 +-
common.h | 19 ++-
control.c | 109 ++++++++++++++---
description.c | 29 +++--
description.h | 13 +-
enumeration.c | 335 ++++++++++++++++++++++++++++++++++++++--------------
gyro-calibration.c | 138 ++++++++++++----------
transform.c | 67 ++++++-----
8 files changed, 498 insertions(+), 220 deletions(-)
Change-Id: I182f02ee05a281cfb009f6d4fc42107f5d39647e
Patrick Porlan [Tue, 26 Aug 2014 09:57:01 +0000 (11:57 +0200)]
GMIN-2992: Revisit gyroscope calibration
Modify the code so it provides valid uncalibrated gyro samples
while calibrating (we simply use bias 0 until we can determine
it), and compute bias iteratively (no need for long term sample
storage).
I can now pass the Cts Verifier gyroscope measurement test
effortlessly, and the delayed calibration is also visible in
applications such as Sensor Readout.
Issue: GMIN-2992
Change-Id: I7d86c529da0167e72ab93039d370f2df1c058ab3
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 26 Aug 2014 13:51:42 +0000 (15:51 +0200)]
GMIN-2992: Don't be as heavy handed with gyro filtering as compass
The gyroscope is not so noisy, so limit ourselves to a smaller
window size in the interest of better response time.
Issue: GMIN-2992
Change-Id: Ida74cae999007eca90c708ccf35cd3f6c706f04c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 26 Aug 2014 09:00:52 +0000 (11:00 +0200)]
GMIN-2992: Use much larger set for gyro calibration
We need to be strict about the criteria for gyro calibration, as
it's a very rapid firing sensor (100 Hz is common) and the effect
of a miscalibrated gyro sensor is serious. Better err on the safe
side, as we simply don't know if the device is still or not.
Issue: GMIN-2992
Change-Id: I931b012be7771e27e81a80f5f5f9e0d64b126886
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 25 Aug 2014 16:51:55 +0000 (18:51 +0200)]
GMIN-2992: Start with -dev trigger before switching to -any-motion
Otherwise we're stuck waiting for a first sample (in order to engage
the periodic repeat-last-sample-if-nothing-arrived-for-a-while code)
which makes a variety of tests fail.
Issue: GMIN-2992
Change-Id: I13093f364455a566de80a5e185707590007d8235
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 4 Aug 2014 18:01:38 +0000 (20:01 +0200)]
Reconciliate tree with SP version regarding uncalibrated gyro.
Looks like something was lost during integrations.
Change-Id: I756b24fe7a61142cde184f589f95f3bfd950ceb0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 20 Aug 2014 17:30:30 +0000 (19:30 +0200)]
GMIN-2992: Enable filtering on accelerometer and gyroscope
Cts Verifier is frequently failing the gyro tests because it's very
sensitive to out of spec samples. Filtering the BMG160 output makes
it happy, so let's enable filtering on other sensor types than just
magnetometer. We may want to tune filter latency though.
Issue: GMIN-2992
Change-Id: I0cbea2195a616ffd922c67246d04d0af8619398c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 20 Aug 2014 14:31:19 +0000 (16:31 +0200)]
GMIN-3044: Fix a few edge cases in filtering code
- limit ourselves to a window size of 100 to limit CPU usage
- start filtering as soon as we have a few samples instead of
waiting for a full history buffer
- drop out if we're operating with window size = 1
And restructure the code a little bit for improved clarity.
Issue: GMIN-3044
Change-Id: Ia4e6208bfb86bccda8473502f3f1d16ef61771ca
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 20 Aug 2014 14:24:46 +0000 (16:24 +0200)]
GMIN-3044: Fix a problem were filtering would not reengage
We wouldn't reallocate the history buffer after a disable
enable cycle if the sampling rate was unchanged, and the
filtering code fails silently if the history buffer is nil.
This could cause filtering to simply don't work in several
scenarios.
Issue: GMIN-3044
Change-Id: I6f0d7428a6caebe903315d6f5a1141dd466e1957
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 20 Aug 2014 09:28:57 +0000 (11:28 +0200)]
PLD processing readibility tweaks
Use symbols rather than direct numeric values, as suggested by Samuel.
Change-Id: I82ad7714946d4b46e9b396b3b04edccfe415e954
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 19 Aug 2014 09:54:44 +0000 (11:54 +0200)]
Enable .panel and .rotation specifiers in property files
This is a convenient way to check or override PLD settings
during development. These are of course optional, per sensor,
and if found the BIOS values are ignored.
Change-Id: I03fadb70245476d49df5bd9167980e9fad9a662d
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 18 Aug 2014 12:53:25 +0000 (14:53 +0200)]
Derive sensor orientation from PLD ACPI data if available.
We use the panel indicator (front or back side of the board) as
well as rotation indicator to generate suitable scaling and order
directives. Note that this is a default state, so expressing
ordering or scaling needs though properties will supersede these.
Change-Id: I1eeaffb838ee53d7e7f7216c07cae9211801d88a
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 18 Aug 2014 12:44:52 +0000 (14:44 +0200)]
Small changes intended at making the code more readable
Intermediate variables are nice.
Change-Id: Ia95169c724d2b7604d8967f88ccf669c85a31152
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Thu, 14 Aug 2014 16:27:44 +0000 (19:27 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master
git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
f3307d0 Thu Aug 14 16:08:25 2014 +0300 | Add multiple calibration levels (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
f876d44 Wed Aug 13 19:03:03 2014 +0300 | Change data sample size for calibration [Adriana Reus]
git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
calibration.h | 22 +++++++++-------------
common.h | 2 +-
compass-calibration.c | 35 +++++++++++++----------------------
enumeration.c | 2 +-
gyro-calibration.c | 6 +++---
5 files changed, 27 insertions(+), 40 deletions(-)
Change-Id: Ia63d8752e62028b81289c9ed74992ada843f18ca
Adriana Reus [Thu, 14 Aug 2014 13:08:25 +0000 (16:08 +0300)]
Add multiple calibration levels
In an attempt to provide an initial estimation faster.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: Ia8e0beaf2ad5424f96ebdf700d179ec0fa31c87c
Adriana Reus [Wed, 13 Aug 2014 16:03:03 +0000 (19:03 +0300)]
Change data sample size for calibration
ECS seems to take a lot of time to calibrate because of noisy
events. A smaller data sample size seems to somewhat help and
it doesn't affect calibration in any other way.
Change-Id: I706ced6408c0915162aafbcf2cfed7f3be9c0ff9
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Adriana Reus [Wed, 13 Aug 2014 15:43:55 +0000 (18:43 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master
git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
752fe0e Tue Aug 12 20:58:58 2014 +0200 | GMIN-3044: Implement a simple filtering routine for noisy sensors (origin/abt/topic/gmin/l-dev/sensors/master) [Patrick Porlan]
4c18969 Fri Aug 8 16:45:26 2014 +0200 | STPK-1429: Always wait for at least 1 ms before repeating samples [Patrick Porlan]
06f5f6a Thu Aug 7 11:06:41 2014 +0200 | GMIN-2525: Ensure that we select a motion trigger if available [Patrick Porlan]
e135a70 Mon Aug 11 16:13:22 2014 +0300 | Fix uncalibrated gyroscope trigger name [Adriana Reus]
7cceddf Thu Aug 7 15:28:51 2014 +0300 | Populate maxDelay field [Adriana Reus]
ce90973 Mon Aug 4 21:00:16 2014 +0200 | Delete a couple of unused variables. [Patrick Porlan]
git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
common.h | 9 ++++++
control.c | 18 +++++++++---
description.c | 48 +++++++++++++++++++++++++++++++
enumeration.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
transform.c | 58 ++++++++++++++++++++++++++++++++++++++
5 files changed, 209 insertions(+), 11 deletions(-)
Change-Id: I2fe75740013ad51747cded5fc337af8905b71706
Patrick Porlan [Tue, 12 Aug 2014 18:58:58 +0000 (20:58 +0200)]
GMIN-3044: Implement a simple filtering routine for noisy sensors
Keep a window of samples worth a second, and output the moving
average of the last recorded samples in order to smooth out
readings from extremely noisy sensors such as the BMM050 magneto.
We may want to use more advanced filters in the future.
Issue: GMIN-3044
Change-Id: I10bc0ddb960ed31e89228bc69fcf17f38fa85b97
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 8 Aug 2014 14:45:26 +0000 (16:45 +0200)]
STPK-1429: Always wait for at least 1 ms before repeating samples
Auto-repetition of events at very high sample rates can make the
device unresponsive.
Issue: STPK-1429
Change-Id: Id846f7a8e313b96099e78fbb0e53a93ca6d194f2
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 7 Aug 2014 09:06:41 +0000 (11:06 +0200)]
GMIN-2525: Ensure that we select a motion trigger if available
Srinivas is adding alternate "any-motion" triggers to a variety
of iio drivers. Let's use these in priority, and engage the HAL
level event repetition machinery if we select such a trigger.
This is dependent on the trigger name being advertised through
/sys/bus/iio/devices/triggerX.
Issue: GMIN-2525
Change-Id: I5e8c717df9b2716ded175e3522ea505c70eaf8b9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Mon, 11 Aug 2014 13:13:22 +0000 (16:13 +0300)]
Fix uncalibrated gyroscope trigger name
Change-Id: I193a273ae1e729b36c237ae76ae081c06b4635c8
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Adriana Reus [Thu, 7 Aug 2014 12:28:51 +0000 (15:28 +0300)]
Populate maxDelay field
L introduces the maxDelay field. It is the delay between two sensor events
corresponding to the lowest frequency that this sensor supports.
Issue: GMINL-43
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: I9df4d2b90e29acfd6aa697a9bb23ceb5c7732000
Patrick Porlan [Mon, 4 Aug 2014 19:00:16 +0000 (21:00 +0200)]
Delete a couple of unused variables.
Change-Id: I3437a3362b6f09eff3520aa0fa78fe46098f2c43
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Mon, 11 Aug 2014 10:32:49 +0000 (13:32 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/l-dev/sensors/master' into gmin/l-dev/master
git log --pretty=format:"%h %ad | %s%d [%an]" m/abt/topic/gmin/l-dev/master..origin/abt/topic/gmin/l-dev/sensors/master:
1de822e Fri Aug 8 12:34:50 2014 +0300 | Filter invalid points for compass calibration. (origin/abt/topic/gmin/l-dev/sensors/master) [Adriana Reus]
283c4d8 Thu Jul 31 17:37:46 2014 +0300 | Add the ordering flag to the quirks array [Adriana Reus]
c609651 Thu Jul 31 16:18:20 2014 +0300 | Populate L specific sensor_t fields [Adriana Reus]
ec4ac4b Mon Aug 4 11:07:38 2014 +0200 | GMIN-2832: Accomodate high noise level on BMC150 magnetometer [Patrick Porlan]
013086e Fri Aug 1 18:01:46 2014 +0200 | GMIN-675: Add the ability to repeatedly send samples to Android [Patrick Porlan]
0d063b7 Mon Jul 28 15:53:19 2014 +0200 | STPK-1429: Fix trigger type for proximity sensor [Patrick Porlan]
fba47f8 Mon Jul 28 14:25:48 2014 +0200 | Fix a signed vs unsigned GCC warning [Patrick Porlan]
5d94de3 Wed Jul 23 11:36:24 2014 +0200 | Add support for signed 13 and 15 bits samples [Patrick Porlan]
fee5195 Thu Jul 24 16:52:38 2014 +0200 | STPK-1429 Add support for custom trigger names [Patrick Porlan]
git diff --stat m/abt/topic/gmin/l-dev/master..HEAD:
common.h | 23 ++++++----
compass-calibration.c | 19 ++++++++-
control.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++---
description.c | 105 +++++++++++++++++++++++++++++++++++++++++++--
description.h | 10 ++++-
entry.c | 4 +-
enumeration.c | 102 +++++++++++++++++++++++++++++++++++++++++++-
sens.c | 4 +-
transform.c | 34 ++++++++++-----
9 files changed, 377 insertions(+), 37 deletions(-)
Change-Id: I5d30856296ede2bd08a5b06a04584f378b446a3d
Adriana Reus [Fri, 8 Aug 2014 09:34:50 +0000 (12:34 +0300)]
Filter invalid points for compass calibration.
Apparently the magnetometer on ECS sends an invalid first event
[x,y,z]=[0,0,0]. This is confusing the calibration and makes the entire
data invalid. Therefore the first calibration attempt always fails thus
wasting a lot of time.
Change-Id: Ibad68b2d4b4740ab7da6f5400426ffee5c29d6c5
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Adriana Reus [Thu, 31 Jul 2014 14:37:46 +0000 (17:37 +0300)]
Add the ordering flag to the quirks array
L introduces a "flags" field in sensor_t to express the
reporting mode for a sensor. To avoid confusion, remove the
"flags" field from sensor_info_t, that expressed the axes reordering
and add it to the quirks array.
Change-Id: Ie42f6ef9705572b6f6bf20663268dd56907b21c2
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Adriana Reus [Thu, 31 Jul 2014 13:18:20 +0000 (16:18 +0300)]
Populate L specific sensor_t fields
Add stringType, flags, and requiredPermission fields.
Change-Id: I1df67776e55fe85dfc06984459e6a1a795489ded
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Patrick Porlan [Mon, 4 Aug 2014 09:07:38 +0000 (11:07 +0200)]
GMIN-2832: Accomodate high noise level on BMC150 magnetometer
Adriana suggested that we use a quirk to allow for higher error
margins during BMC150 magnetometer calibration. This is supported
by a few code changes in the HAL. The associated "quirks = noisy"
property has to be set in suitable configuration files.
Issue: GMIN-2832
Change-Id: Id43145aeb916cec02e2fedfe32cb7b89a01c8bbb
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 1 Aug 2014 16:01:46 +0000 (18:01 +0200)]
GMIN-675: Add the ability to repeatedly send samples to Android
This allows supporting sensors that are defined as continuously
firing by Android with underlying iio drivers that don't generate
events unless something has changed.
This will allow using Srinivas's latest gyro driver properly, as
well as fix issues with the XPS 12 sensors.
Issue: GMIN-675
Change-Id: I8c69b538646b915d3185ecef2d31939a2eb6aef4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 28 Jul 2014 13:53:19 +0000 (15:53 +0200)]
STPK-1429: Fix trigger type for proximity sensor
The proximity sensor only sends an event if its state changes.
Note the statement at the end of sensor_activate about at least
one event being sent after a sensor is enabled. This will ensure
that whatever middleware components controls the proximity sensor,
it's not going to mistakenly believe that it's stuck in near state.
Change-Id: I56a8bd1ca171cd879d69c03fafab83dde9c42e1e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Mon, 28 Jul 2014 12:25:48 +0000 (14:25 +0200)]
Fix a signed vs unsigned GCC warning
Besides, the upper boundary of the tested range was incorrect.
Change-Id: Iab087f60717c2e1ee7fee32c1178b75ca4004279
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 23 Jul 2014 09:36:24 +0000 (11:36 +0200)]
Add support for signed 13 and 15 bits samples
The BMC150 magnetometer declares its x and y samples
as le:s13/16>>3 and its z samples as le:s15/16>>1, so
generalize a little bit our handling of signed integers.
Change-Id: I308629ac84ce898da63c31b757da358391ee530c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 24 Jul 2014 14:52:38 +0000 (16:52 +0200)]
STPK-1429 Add support for custom trigger names
The Bosch BMC150 magnetometer driver exposes a different
trigger name than the usual sensor-name-devX. Add support for
this, so the enable buffer operation succeeds. There seems to
be remaining issues with channels not being enabled though,
so this change is not enough to get the magnetometer working
on the ECS board. Also, the driver does not expose a sampling
rate control knob.
Issue: STPK-1429
Change-Id: I2a145a597c0ba4f95beeb86d385d3c774889d9e8
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
suyyala [Thu, 24 Jul 2014 02:19:43 +0000 (19:19 -0700)]
Fix pthread link failure on LPDK
pthreds are supprted by libc.
Issue: GMINL-102
Change-Id: I3481115f569019a2aea5acc5a6f1ba075abdaef0
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Qiming Shi [Wed, 4 Jun 2014 08:24:45 +0000 (16:24 +0800)]
Add USE_INTEL_SENSOR_HAL flag
Change-Id: I1cfcfb0768d5538a3de571c9e5c512933aa4fbc5
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Qiming Shi [Wed, 4 Jun 2014 06:32:27 +0000 (14:32 +0800)]
Use LOCAL_MODULE_RELATIVE_PATH for multiarch build
Change-Id: I710086eb7824ed630ed4f171e6c2e4dcc92ba05b
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Adriana Reus [Fri, 25 Jul 2014 14:07:53 +0000 (17:07 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
ce139d1 Wed Jul 23 16:13:05 2014 +0300 | Remove a few unused variables (origin/abt/topic/gmin/kitkat/sensors) [Octavian Purdila]
206e7b3 Wed Jul 23 16:01:04 2014 +0300 | Fix timestamp type [Octavian Purdila]
e242e18 Wed May 21 18:38:40 2014 +0200 | STPK-1821 Work around what seems to be an ISH firmware bug [Patrick Porlan]
860fd4d Fri Jun 6 10:44:33 2014 +0200 | STPK-1429 Document usage of sensor properties [Patrick Porlan]
db9ce46 Tue Jul 22 13:48:10 2014 +0300 | Add support for Linux build [Octavian Purdila]
03fee75 Tue Jul 22 13:36:22 2014 +0300 | Add sensor HAL test program [Octavian Purdila]
git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
Android.mk | 10 +
Makefile | 18 ++
common.h | 2 +
compass-calibration.c | 2 +-
control.c | 9 +-
description.c | 67 ++++++
description.h | 3 +
entry.c | 20 ++
enumeration.c | 4 -
linux/cutils/properties.h | 16 ++
linux/log.c | 49 +++++
linux/utils/Log.h | 65 ++++++
sens.c | 536 +++++++++++++++++++++++++++++++++++++++++++++
transform.c | 2 -
14 files changed, 789 insertions(+), 14 deletions(-)
Change-Id: Iba58f1c168a18aa934e9dbf7fb9c1f6db94f24ef
Octavian Purdila [Wed, 23 Jul 2014 13:13:05 +0000 (16:13 +0300)]
Remove a few unused variables
Change-Id: I30b7acde908317e6368d1004b49ff516a9837079
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Octavian Purdila [Wed, 23 Jul 2014 13:01:04 +0000 (16:01 +0300)]
Fix timestamp type
This fixes and issue where invalid timestamps are seen in event
reports.
Change-Id: Ia55b4d5065482a8e41e0702b6eb711c67981a447
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Patrick Porlan [Wed, 21 May 2014 16:38:40 +0000 (18:38 +0200)]
STPK-1821 Work around what seems to be an ISH firmware bug
The hardware sensors controlled through the Intel Sensor Hub
sometimes do not send events before an explicit disable/enable
cycle, with a link to the initial sampling rate.
The issue does not happen if the Intel Sensor Hub firmware is
flashed with an up to date version, but let's take this opportunity
to introduce a quirk property that we'll be able to control slightly
altered behaviors on a sensor basis.
Issue STPK-1821
Change-Id: I93dc36214b0a3f545e3ff5b87d2d4e7ff7daf7f0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 6 Jun 2014 08:44:33 +0000 (10:44 +0200)]
STPK-1429 Document usage of sensor properties
Let's document the properties we support.
Issue: STPK-1429
Change-Id: I07704c2e17eacad29ea373bba96e9c78ebadd8f6
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Octavian Purdila [Tue, 22 Jul 2014 10:48:10 +0000 (13:48 +0300)]
Add support for Linux build
This patch adds support for building the sensor HAL and the test
program wihtin a Linux environment. It is usefull for faster sensor
HAL and driver development.
Change-Id: I13b6240899a4ed5351c5ae6660bb317cbcb3f793
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Octavian Purdila [Tue, 22 Jul 2014 10:36:22 +0000 (13:36 +0300)]
Add sensor HAL test program
This patch adds a HAL test program that can be used to test the sensor
HAL in a console Android environment (e.g. not framework
required). This is useful for faster development for sensor drivers
and HAL features as well as for faster enabling on new platforms.
The test program takes the following commands: start HAL, stop HAL,
list sensors, activate and deactivate sensors, and set delay.
The start command will fork, load the HAL shared object, initialize it
and keep it running in the background. One thread will be used for
polling sensor data and one for accepting commands from the
client. UNIX sockets are used for communication between the client and
server.
Change-Id: I837e1dd9cb48657d4a8fe52f67c751e619b5c244
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Adriana Reus [Thu, 24 Jul 2014 15:37:52 +0000 (18:37 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
a603a74 Sun Jun 22 11:06:26 2014 +0300 | Adding TYPE_GYROSCOPE_UNCALIBRATED (origin/abt/topic/gmin/kitkat/sensors) [Adriana Reus]
f9635be Tue Jul 15 12:14:43 2014 +0200 | STPK-1429 Reduce worker thread exit latency [Patrick Porlan]
345931b Fri Jul 18 16:00:58 2014 +0200 | STPK-1429: Add 'order' configuration property [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
common.h | 15 ++++++
control.c | 152 ++++++++++++++++++++++++++++++++++++++++++----------
description.c | 27 ++++++++++
description.h | 2 +
enumeration.c | 109 ++++++++++++++++++++++++++++++-------
gyro-calibration.c | 29 +++++++---
transform.c | 22 ++++++++
7 files changed, 302 insertions(+), 54 deletions(-)
Change-Id: I7031481550741bd06e94cca954aafd96d7a8635a
Adriana Reus [Sun, 22 Jun 2014 08:06:26 +0000 (11:06 +0300)]
Adding TYPE_GYROSCOPE_UNCALIBRATED
Add type TYPE_GYROSCOPE_UNCALIBRATED on the same device number as the base sensor.
When activated at the same time the uncalibrated will copy the data from the calibrated one.
When activated independently each will take data from the device.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: If7d8f801a418f8cb4ab561849949f65e0249f379
Patrick Porlan [Tue, 15 Jul 2014 10:14:43 +0000 (12:14 +0200)]
STPK-1429 Reduce worker thread exit latency
We use condition variables as a mean to interrupt
sleep for all worker threads so they can reevaluate
their exit condition, as well as react a bit quicker
to sampling rate updates.
Change-Id: I3f11b5b103594f0d0e4f04ec14a4cd2521804abf
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 18 Jul 2014 14:00:58 +0000 (16:00 +0200)]
STPK-1429: Add 'order' configuration property
This allows field reordering for sensors that are tilted
inside the chassis, as this appears to be the case for the
ECS Cruise 7 tablet. This field reordering is applied in
the finalization stage, thus after opt_scale has been applied.
Ex: ro.iio.accel.order = 102 would swap x and y fields for
the accelerometer. Only digits are tolerated, and we must have
as many of them as there are fields for this sensor.
Issue: STPK-1429
Change-Id: I1f5eb3de0413bfa786408c7d59235bd486d09200
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Fri, 18 Jul 2014 16:00:52 +0000 (19:00 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
eee1b23 Thu Jul 3 14:18:31 2014 +0200 | STPK-1429 Fix a problem with on change sensors being muted (origin/abt/topic/gmin/kitkat/sensors) [Patrick Porlan]
35ac9c5 Thu Jul 3 14:11:35 2014 +0200 | STPK-1429 Fix start condition for acquisition threads [Patrick Porlan]
c238ae8 Thu Jul 3 11:38:15 2014 +0200 | STPK-1429 Minor trace and comment cleanup [Patrick Porlan]
4b3009a Thu Jul 3 11:36:45 2014 +0200 | STPK-1429 Adjust types of a couple of sampling rate variables [Patrick Porlan]
0c6adc6 Thu Jul 3 11:34:29 2014 +0200 | STPK-1429 Remove unneeded variable [Patrick Porlan]
033c147 Wed Jul 2 15:43:45 2014 +0200 | STPK-1429 Remove artificial cap on sensor update rate [Patrick Porlan]
dbf1cc4 Wed Jul 2 14:18:11 2014 +0200 | STPK-1429 Minor tweak to compass calibration data save point [Patrick Porlan]
f4a2bd0 Wed Jul 2 14:13:47 2014 +0200 | STPK-1429 Source code cleanup [Patrick Porlan]
47aa36d Wed Jul 2 13:45:24 2014 +0200 | STPK-1429 Return as many available events as possible from sensor_poll [Patrick Porlan]
74e77ce Tue Jul 1 13:46:23 2014 +0200 | STPK-1429 Offload poll mode sensors data acquisition to threads [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
Android.mk | 1 +
common.h | 13 +-
control.c | 456 +++++++++++++++++++++++++++++++++------------------------
enumeration.c | 6 +
4 files changed, 283 insertions(+), 193 deletions(-)
Change-Id: I469eb57b03f18c09ba9618c8ec752619771e1afc
Patrick Porlan [Thu, 3 Jul 2014 12:18:31 +0000 (14:18 +0200)]
STPK-1429 Fix a problem with on change sensors being muted
We probably want on-change sensors to send an event following
a disable - enable cycle, even if the sensed value (such as
the ambient light level in lux) hasn't changed during this
time. That ensures that applications starting up have fresh
data to deal with.
Issue: STPK-1429
Change-Id: I58cf3baaeee8937d374fa7a087df01cbe968f898
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Jul 2014 12:11:35 +0000 (14:11 +0200)]
STPK-1429 Fix start condition for acquisition threads
It's perfectly possible that we have to open a poll mode sensor
living alongside regular sensors: hint: that's the case of the
temperature sensor on the MPU 6500, which lives on the same iio
device as the accelerometer and gyroscope.
Issue: STPK-1429
Change-Id: I5faf8d30280405bfb356a5a33f5c08646e971494
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Jul 2014 09:38:15 +0000 (11:38 +0200)]
STPK-1429 Minor trace and comment cleanup
Striving for perfection...
Issue: STPK-1429
Change-Id: Ia3ab00f4e2ce5ba659fcdeb6fb985904ffbee88e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Jul 2014 09:36:45 +0000 (11:36 +0200)]
STPK-1429 Adjust types of a couple of sampling rate variables
Those are not necessarily integers, so use a proper type.
Issue: STPK-1429
Change-Id: I66be97150afb31af0d9aa8b42f9ba8dbab35c0b4
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 3 Jul 2014 09:34:29 +0000 (11:34 +0200)]
STPK-1429 Remove unneeded variable
The requested sampling rate was kept only for traces. Those traces
are kind of redundant, so remove them and the associated variable
for the sake of clarity.
Issue: STPK-1429
Change-Id: I82b5fd19164d72e10e4411cbb6adb521224bde66
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 2 Jul 2014 13:43:45 +0000 (15:43 +0200)]
STPK-1429 Remove artificial cap on sensor update rate
The MRD 7 accelerometer advertises support for 1600 Hz.
We have no good reason to cap sampling rate to a lower value than
what the driver supports.
Issue: STPK-1429
Change-Id: I1408d4d699e133efe2016145d3c89284d3481e3c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 2 Jul 2014 12:18:11 +0000 (14:18 +0200)]
STPK-1429 Minor tweak to compass calibration data save point
Was being saved each time the magnetometer reference count was
decremented. Doing it when it reaches zero is probably enough.
Issue: STPK-1429
Change-Id: Ia465821cbf1ec22c5645753b6289e368d7ef2bd8
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 2 Jul 2014 12:13:47 +0000 (14:13 +0200)]
STPK-1429 Source code cleanup
Factorize a little, remove unused variables, etc.
Issue: STPK-1429
Change-Id: I531991ac04d5c7d3887773d9542124b08bd98fbc
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 2 Jul 2014 11:45:24 +0000 (13:45 +0200)]
STPK-1429 Return as many available events as possible from sensor_poll
No longer return a single event when returning from sensor_poll. This
should minimize the trips between the Android sensor framework layers
and the HAL module itself. We can actually return up to one event per
sensor type, which should fit nicely with the buffer size that we get.
Issue: STPK-1429
Change-Id: Ie5f9974bee92380de4b121e005ace8261b77801e
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 1 Jul 2014 11:46:23 +0000 (13:46 +0200)]
STPK-1429 Offload poll mode sensors data acquisition to threads
I have seen sysfs reads blocking for 200 ms on the MRD 7 ALS,
with proximity, temperature and combined magnetometer x,y,z
in the 100 ms ballpark. This ended up blocking the main sensor
poll loop for large windows, with the effect that high frequency
sensors events were not delivered for extended amounts of time.
This offloads these sysfs reads to dedicated threads: there is
is one of these per enabled poll-mode sensor, and they communicate
their data through a pollable fd (something we can't have directly
on sysfs files). As a result we get much smoother and timely
event delivery overall, while simplifying the code somewhat: the
poll call can always use an infinite timeout, thereby voiding
the need for a wakeup fd, as well as complex timeout calculations.
Issue: STPK-1429
Change-Id: I4a45ede2369bcca03b9da78e98abb83ff5879c73
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Thu, 10 Jul 2014 12:44:10 +0000 (15:44 +0300)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
af3f64a Fri Jun 27 17:00:20 2014 +0200 | STPK-1429 Minor stylistic changes (origin/abt/topic/gmin/kitkat/sensors) [Patrick Porlan]
81f81d5 Thu Jun 26 17:26:49 2014 +0200 | Enable proximity sensor detection [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..HEAD:
control.c | 11 +++++++----
enumeration.c | 1 +
2 files changed, 8 insertions(+), 4 deletions(-)
Change-Id: I4c6ba4a9aba4752a15b37cdfbd79c4460de03c4f
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Patrick Porlan [Fri, 27 Jun 2014 15:00:20 +0000 (17:00 +0200)]
STPK-1429 Minor stylistic changes
I feel the code is a little more readable this way...
Issue: STPK-1429
Change-Id: If4671b243f2ff2d3ee2a80b6c6a71ac4340ec525
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 26 Jun 2014 15:26:49 +0000 (17:26 +0200)]
Enable proximity sensor detection
Note that the proximity permission file is not set at this point.
I don't expect Android to use the proximity sensor, but as the
MRD 7 exposes one - which consistenly reports 255 cm -, let's
enable it for use by sensor testing applications.
Change-Id: I9483189e1c9a6e048d88a73b60b5f006889794f9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
suyyala [Sat, 28 Jun 2014 02:12:41 +0000 (19:12 -0700)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
86ec10d Thu Jun 26 15:17:09 2014 +0200 | STPK-1429 Add a trace warning of unusually high sysfs read times (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [Patrick Porlan]
0d868f7 Thu Jun 26 10:28:55 2014 +0200 | STPK-1429 Clean up a few traces and obscure pieces of code [Patrick Porlan]
dece0ae Wed Jun 25 14:34:43 2014 +0200 | STPK-1429 Support "on change" event firing [Patrick Porlan]
5e58419 Thu Jun 19 15:08:12 2014 +0200 | STPK-1429 Support floating point sampling rates [Patrick Porlan]
fe7a4ab Thu Jun 19 11:19:28 2014 +0200 | STPK-1429 Fix single channel opt_scale specifier [Patrick Porlan]
5380d64 Tue Jun 17 15:01:15 2014 -0700 | Reset channel sampling on enumeration [suyyala]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
common.h | 7 ++--
control.c | 101 +++++++++++++++++++++++++++++++++++-----------------------
enumeration.c | 2 +-
transform.c | 21 +++++++++---
utils.c | 36 ++++++++++++++++++++-
utils.h | 11 ++++---
6 files changed, 126 insertions(+), 52 deletions(-)
Change-Id: I3c13ce408c0e80cdd98efc368e2daf9ce71590a9
Signed-off-by: sridhar.uyyala <sridhar.uyyala@intel.com>
Patrick Porlan [Thu, 26 Jun 2014 13:17:09 +0000 (15:17 +0200)]
STPK-1429 Add a trace warning of unusually high sysfs read times
It looks like some sensors (proximity on MRD 7 perhaps) have
acquisition times in the order of several hundred ms. Help
flag those with a trace warning of combined (all channels)
acquisition times larger than 100 ms. None of the T100 sensors
(magnetometer, temperature, ALS) have this problem though.
Issue: STPK-1429
Change-Id: I04ee59f63184c89eae26e46460f4dcb675b91131
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 26 Jun 2014 08:28:55 +0000 (10:28 +0200)]
STPK-1429 Clean up a few traces and obscure pieces of code
We're not supposed to get data for sensor types we don't
recognize, but we can get there while adding support for
new sensors (type added to enumeration table, but not yet
to sample reporting routines), so handle this case a little
bit better.
Issue: STPK-1429
Change-Id: I256374e6b661a28a19db9f7791c226543766c4ad
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 25 Jun 2014 12:34:43 +0000 (14:34 +0200)]
STPK-1429 Support "on change" event firing
The Android documentation states that ALS and temperature
sensors are "on change" rather than continuously firing
sensors. So, for these types, make note of the last returned
lux or temperature reading, and drop the event that we're
about to generate if it is identical to the last returned one.
Issue: STPK-1429
Change-Id: I4c07da6555727f905e25e2e3bb7cef975af4e4c7
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 19 Jun 2014 13:08:12 +0000 (15:08 +0200)]
STPK-1429 Support floating point sampling rates
The Kionix accelerometer found on the MRD 7 advertises
support for 6.25 and 12.5 Hz, so open up a little the
scope of what we consider a valid sampling rate.
Some %f specifications were replaced by %g because %f
shows zero digits in the style of 3.140000, and some
sysfs writes would not be accepted because of this format.
Issue: STPK-1429
Change-Id: I35379aec4d3f03bfdf27a17d192ebc0dfbef3441
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Thu, 19 Jun 2014 09:19:28 +0000 (11:19 +0200)]
STPK-1429 Fix single channel opt_scale specifier
This (unused as of today) line was forgotten when the
optional scaling specified was renamed from scale to
opt_scale. It's intended for single channel sensors,
such as the temperature or ALS.
Issue: STPK-1429
Change-Id: Idcc69f8113636ff95e84140bbf4ec21d45ad811c
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
suyyala [Tue, 17 Jun 2014 22:01:15 +0000 (15:01 -0700)]
Reset channel sampling on enumeration
If HAL is restarted due to service crash or adb stop
command the sensor device may be left in enable state.
Make sure to trun off iio buffer/enable and trigger channels
in next enumeration during re-intialization of HAL.
Change-Id: I6cac99ebc3cda4ff629864c09132fa062127f470
Signed-off-by: sridhar.uyyala <sridhar.uyyala@intel.com>
suyyala [Tue, 17 Jun 2014 15:16:37 +0000 (08:16 -0700)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
eccfac9 Mon Jun 16 16:33:32 2014 -0700 | Consolidate Axis inversion operations (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [suyyala]
64c8e6b Mon Jun 2 11:13:23 2014 +0300 | Change Magnetometer calibration to support multiple sensors [Adriana Reus]
37c99cb Thu Jun 12 19:56:29 2014 -0700 | Fix sampling frequency cap [suyyala]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
calibration.h | 13 +--
common.h | 1 +
compass-calibration.c | 213 +++++++++++++++++++++++++++-----------------------
control.c | 23 +++---
enumeration.c | 6 ++
transform.c | 32 +-------
6 files changed, 140 insertions(+), 148 deletions(-)
Change-Id: I46164c9651d4ee3163e8a5a79cfc52fbcc57c220
Signed-off-by: sridhar.uyyala <sridhar.uyyala@intel.com>
suyyala [Mon, 16 Jun 2014 23:33:32 +0000 (16:33 -0700)]
Consolidate Axis inversion operations
Axis inversions are applied in transform using opt_scale.
This fix removes the axis inverse operations from
finalize operation
Issue: GMIN-1493
Change-Id: I8c15712c576dd0c1002c88168e95a98aff1c1375
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Adriana Reus [Mon, 2 Jun 2014 08:13:23 +0000 (11:13 +0300)]
Change Magnetometer calibration to support multiple sensors
Added calibration information in sensor_info_t.
Also keeping in sync with the gyro calibration interface.
Change-Id: I5fbd6dd18480d2ed8b1b22f28a4070c9bb2a66ed
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
suyyala [Fri, 13 Jun 2014 02:56:29 +0000 (19:56 -0700)]
Fix sampling frequency cap
With intent of capping sampling frequency to 1000, code
incorrectly lowers requested frequency to 1000 even
when sensor doesn't support 1000 value in available
sampling frequency.
Fix is to impose cap and use lower available sampling
frequency
Issue: GMIN-1178
Change-Id: Ibf5001d1c5afc26fa3198d54585917281e639039
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Thu, 12 Jun 2014 21:45:04 +0000 (14:45 -0700)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
088195d Thu Jun 12 13:12:52 2014 -0700 | Rename opt_scale property name (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [suyyala]
96575ae Thu May 29 14:29:51 2014 -0700 | Do not update calibsense if prop read fails [arun]
05610d9 Thu May 29 16:29:16 2014 +0300 | Gyro Calibration [Adriana Reus]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
Android.mk | 1 +
calibration.h | 16 ++++++++++
common.h | 2 ++
control.c | 3 ++
enumeration.c | 32 ++++++++++++++++---
gyro-calibration.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
transform.c | 6 ++--
7 files changed, 141 insertions(+), 9 deletions(-)
Change-Id: I3f544c65cf85fab54b5df233cf3b85ebd568309d
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Thu, 12 Jun 2014 20:12:52 +0000 (13:12 -0700)]
Rename opt_scale property name
rename optional scale property to reflect
the options use and not to confus with scale.
old: iio.accel.y.scale
new: iio.accel.y.opt_scale
Change-Id: I2fdf792b1d7db86e7273cbd473cf724c3a91cfda
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
arun [Thu, 29 May 2014 21:29:51 +0000 (14:29 -0700)]
Do not update calibsense if prop read fails
It was observed that in case the android prop read fails,
we write a 0 value(typically happens in case the property variable
not present)into the sysfs variable. This caused the resulting ALS
output to be 0, added a check to filter that condition. Now in case
the read from the android property fails, we just keep the default
value for the calibsense variable.
Issue:GMIN-671
Change-Id: Ifd65f0268dfa345ecf8cd6d40255c1a1fd52a03c
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Adriana Reus [Thu, 29 May 2014 13:29:16 +0000 (16:29 +0300)]
Gyro Calibration
Tries to detect steady state and computes bias based
on that detection.
Steadyness is detected by monitoring the gyro data for a fixed
number of events. If the data is extremely close it gathers the bias.
Theoretically, applying a constant rotation on all axes could also
provide very close data and that would provide a wrong bias but this is
not possible by human interaction with a mobile device (perhaps only
with an automated robotic solution).
Issue: GMIN-1185
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Change-Id: If1db69dcbda9c9c3b4434ac27ab500a199023f73
Conflicts:
enumeration.c
suyyala [Wed, 11 Jun 2014 02:24:48 +0000 (19:24 -0700)]
Merge remote-tracking branch 'origin/abt/topic/gmin/kitkat/sensors' into gmin/kitkat/master
git log --pretty=format:"%h %ad | %s%d [%an]" origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
20482a9 Sat Jun 7 09:44:55 2014 -0700 | merge sp/private/topic/sp/sp-autodetect to gmin/kitkat/sensors (origin/abt/topic/gmin/kitkat/sensors, m/abt/topic/gmin/kitkat/master) [suyyala]
71c0448 Wed Jun 4 11:55:27 2014 +0200 | STPK-1429 Add copyright headers to a few files [Patrick Porlan]
3ee3f20 Wed Jun 4 11:00:06 2014 +0200 | STPK-1429 Remove superfluous initialization [Patrick Porlan]
635a483 Mon May 26 14:54:54 2014 +0300 | Tweaked parameters for faster magnetometer calibration [Adriana Reus]
e32477b Tue Jun 3 11:16:26 2014 +0200 | STPK-1677 Fix Klocwork issue #94943 [Patrick Porlan]
eb4a8cf Fri May 30 11:34:43 2014 -0400 | iio_sensors: Add Light sensor sysfs interface and transformation [Archana Patni]
2c628fe Fri May 30 11:29:42 2014 -0400 | iio_sensors: Remove hard coded exponent and data bytes [Archana Patni]
54d3349 Fri May 30 14:46:35 2014 +0200 | STPK-1429 Fix erroneous buffer size [Patrick Porlan]
f052d7d Fri May 30 11:57:11 2014 +0200 | STPK-1429 Slight improvement to timestamp accuracy [Patrick Porlan]
d93e8b6 Wed May 28 10:29:44 2014 +0200 | STPK-1429 Enable known channels once at boot time [Patrick Porlan]
65c4798 Tue May 27 17:17:52 2014 +0200 | STPK-1429 Revisit sensor enabling code [Patrick Porlan]
0545bfb Tue May 27 17:14:17 2014 +0200 | STPK-1429 Ignore _en status when building report maps [Patrick Porlan]
6f2016f Tue May 27 17:09:19 2014 +0200 | STPK-1429 Move channel analysis to enumeration stage [Patrick Porlan]
dedb01b Tue May 27 17:01:11 2014 +0200 | STPK-1429 Don't add trailing zero to sysfs write buffer [Patrick Porlan]
a2e82c2 Mon May 26 15:59:04 2014 +0200 | STPK-1429 Cosmetic changes in code dealing with scales [Patrick Porlan]
0332aa6 Mon May 26 10:39:07 2014 +0200 | STPK-1429 Remove articifial delay between poll exits [Patrick Porlan]
ffff8c1 Fri May 23 17:07:24 2014 +0200 | STPK-1429 Remove a compilation warning [Patrick Porlan]
0357b87 Fri May 23 15:26:01 2014 +0200 | STPK-1429 Add optional per-channel scaling factor [Patrick Porlan]
git diff --stat origin/abt/topic/gmin/kitkat/master..origin/abt/topic/gmin/kitkat/sensors:
calibration.h | 8 ++--
common.h | 15 +++++++
compass-calibration.c | 4 ++
control.c | 114 ++++++++++++++++----------------------------------
control.h | 2 +
description.c | 3 +-
description.h | 2 +
enumeration.c | 59 ++++++++++++++++++++++----
enumeration.h | 1 +
matrix-ops.c | 4 ++
matrix-ops.h | 4 ++
transform.c | 83 ++++++++++++++++++++++--------------
utils.c | 7 ++--
13 files changed, 181 insertions(+), 125 deletions(-)
Change-Id: I3b3428cc4de05035c24d20e52963dbf7c8c4a507
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
suyyala [Sat, 7 Jun 2014 16:44:55 +0000 (09:44 -0700)]
merge sp/private/topic/sp/sp-autodetect to gmin/kitkat/sensors
9390b29 Wed Jun 4 11:55:27 2014 +0200 | STPK-1429 Add copyright headers to a few files [Patrick Porlan]
bcfe0bd Wed Jun 4 11:00:06 2014 +0200 | STPK-1429 Remove superfluous initialization [Patrick Porlan]
2d74046 Mon May 26 14:54:54 2014 +0300 | Tweaked parameters for faster magnetometer calibration [Adriana Reus]
41511bf Tue Jun 3 11:16:26 2014 +0200 | STPK-1677 Fix Klocwork issue #94943 [Patrick Porlan]
e674776 Fri May 30 11:34:43 2014 -0400 | iio_sensors: Add Light sensor sysfs interface and transformation [Archana Patni]
43a3504 Fri May 30 11:29:42 2014 -0400 | iio_sensors: Remove hard coded exponent and data bytes [Archana Patni]
29df85f Fri May 30 14:46:35 2014 +0200 | STPK-1429 Fix erroneous buffer size [Patrick Porlan]
d252a28 Fri May 30 11:57:11 2014 +0200 | STPK-1429 Slight improvement to timestamp accuracy [Patrick Porlan]
e5742f8 Wed May 28 16:12:43 2014 +0200 | Merge remote-tracking branch 'sp/private/topic/sp/sp-autodetect' into merge-sp-autodetect-to-mas
db990b1 Wed May 28 10:29:44 2014 +0200 | STPK-1429 Enable known channels once at boot time [Patrick Porlan]
9707c1f Tue May 27 17:17:52 2014 +0200 | STPK-1429 Revisit sensor enabling code [Patrick Porlan]
e674576 Tue May 27 17:14:17 2014 +0200 | STPK-1429 Ignore _en status when building report maps [Patrick Porlan]
2a372db Tue May 27 17:09:19 2014 +0200 | STPK-1429 Move channel analysis to enumeration stage [Patrick Porlan]
4df30de Tue May 27 17:01:11 2014 +0200 | STPK-1429 Don't add trailing zero to sysfs write buffer [Patrick Porlan]
450e414 Mon May 26 15:59:04 2014 +0200 | STPK-1429 Cosmetic changes in code dealing with scales [Patrick Porlan]
8e43961 Mon May 26 10:39:07 2014 +0200 | STPK-1429 Remove articifial delay between poll exits [Patrick Porlan]
13b78ec Fri May 23 17:07:24 2014 +0200 | STPK-1429 Remove a compilation warning [Patrick Porlan]
7a933b3 Fri May 23 15:26:01 2014 +0200 | STPK-1429 Add optional per-channel scaling factor [Patrick Porlan]
Issue: GMIN-1370
Change-Id: I8309e2246c2c0966e80a72cc834e3cbe3de34849
Signed-off-by: suyyala <sridhar.uyyala@intel.com>
Patrick Porlan [Wed, 4 Jun 2014 09:55:27 +0000 (11:55 +0200)]
STPK-1429 Add copyright headers to a few files
This code is still Intel proprietary.
Issue: STPK-1429
Change-Id: I29a17b66b38a403a275d5e7003c11fa8c8b35a50
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 4 Jun 2014 09:00:06 +0000 (11:00 +0200)]
STPK-1429 Remove superfluous initialization
I thought that snprintf does not guarantees a final NUL,
but it turns out that my mind was polluted by the semantics
of the MS _snprintf. Remove the forced NUL write.
Issue: STPK-1429
Change-Id: Ib16870a2f0ec0f0c8dd22a4b91a51055172ed406
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Adriana Reus [Mon, 26 May 2014 11:54:54 +0000 (14:54 +0300)]
Tweaked parameters for faster magnetometer calibration
These parameters are taken into consideration when
collecting the data samples (the points that we are
going to fit on an ellipsoid).
MIN_DIFF
Minimum difference between collected points (there
is no point in collecting events that are similar
or very close because we won't get a sphere or an
ellipsoid that way, however a big value doesn't make
much sense either because the time of collecting a
certain number of "good" events would increase,
many would be rejected)
MAX_SQR_ERR
Maximum allowed error for a calibration, if a
calibration has an error bigger than this we won't
allow it.
LOOKBACK_COUNT
The number of previous events that we consider that
should be different enough from the current event
(tightly coupled to the MIN_DIFF parameter).
The smaller the MIN_DIFF and the LOOPBACK_COUNT the faster
a collection is gathered.
The bigger the MAX_SQR_ERR the faster a calibration is accepted.
Testing shows that this new set of parameters leads to a faster
first calibration with no visible user impact on its quality.
Change-Id: Ibe09c02c00975321459d599039d7e4767a880e96
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 3 Jun 2014 09:16:26 +0000 (11:16 +0200)]
STPK-1677 Fix Klocwork issue #94943
The issue was with sprintf possibly returning a negative
value, which would really be unexpected, but handle it
anyway.
Issue: STPK-1677
Change-Id: I28b4251cff63c5f1704786025eab2121e8fa101b
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Archana Patni [Fri, 30 May 2014 15:34:43 +0000 (11:34 -0400)]
iio_sensors: Add Light sensor sysfs interface and transformation
The IIO/HID sensor hub driver publishes the light sensor data using the
IIO_INTENSITY defined in iio industrial-core. This patch adds this
sensor type to the sensor catalogue and adds a corresponding transformation
in transform_sample_ISH function.
This was tested on BDW Wilson Beach (running Intel FW) and on BDW RVP Y
(running STM FW).
Change-Id: Ib0629dca03f8ec645fcd4d5816ee7131e1764e39
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Archana Patni [Fri, 30 May 2014 15:29:42 +0000 (11:29 -0400)]
iio_sensors: Remove hard coded exponent and data bytes
The current implementation used hard coded exponent and
data bytes for the data transformation macros inside
transform_sample_ISH function. These values were not
correct for all implementations and were resulting in
large invalid values.
These can be calculated from the SysFs attributes exported
by the driver. This patch changes the calculation to use these
and was tested on BDW Wilson Beach (running Intel FW) and
BDW RVP Y (running STM FW).
Change-Id: Ie66ee5a5b9692cee3a48d4027f795b16c6b5e8d0
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Patrick Porlan [Fri, 30 May 2014 12:46:35 +0000 (14:46 +0200)]
STPK-1429 Fix erroneous buffer size
Not sure what I had in mind with that multiplication. Anyway, the
buffer is zero-initialized, so keep it at a reasonable size, which
is to say... 32. That's plenty enough for now, as the maximum we
encountered is 20 (accel x,y,z 16 bits + gyro x,y,z + 64 bits ts).
We don't need the expected data size calculation, because the
values are set to zero by default, and because that sum would not
be correct anyway in the case where fields such as the timestamp
are shared between sensors. Plus, we were not even verifying that
the computed sum did really fit our buffer.
Issue: STPK-1429
Change-Id: Ie001ceeb634866a1460444bb839918045b72de31
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Fri, 30 May 2014 09:57:11 +0000 (11:57 +0200)]
STPK-1429 Slight improvement to timestamp accuracy
Use date immediately before the iio device read operation instead
of sensor report propagation time as the event timestamp. That's
only an intermediate step towards higher precision timestamps
though, as some drivers expose a timestamp channel we can read at
the same time as associated sample data.
Issue: STPK-1429
Change-Id: Iad5e1dc35fcbd422d3d1390cab202e3c36de8504
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Wed, 28 May 2014 08:29:44 +0000 (10:29 +0200)]
STPK-1429 Enable known channels once at boot time
That solves the problem with gyro not working on T100 if the
accelerometer hasn't been enabled. We have a combination of
two factors at play: data for disabled channels is not
reported through the character device, but it also seems that
once a channel has been enabled, we can't disable it anymore.
As sampling is not active before a trigger is selected and
the buffer is enabled (with an additional open on the iio
character device being necessary for this data to be read)
that should not do any harm.
If we could reliably disable channels then we could go back
to dynamic maps updated when a sensor gets enabled or disabled,
but this comes with additional complexity such as synchronization
between reads and enable/disable operations... better have a
static structure for iio device reports.
Issue: STPK-1429
Change-Id: Ic3b5a0e6e39c09e9533b35b1f6dac279a41b96a5
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
Patrick Porlan [Tue, 27 May 2014 15:17:52 +0000 (17:17 +0200)]
STPK-1429 Revisit sensor enabling code
Refine trigger usage, particularly ordering vs buffer ops.
Documentation on this is somewhat scarce, so let's try to follow
the ordering described in Free Electron's "iio a new subsystem"
presentation.
Change-Id: I545ac76d96870a10fa5aedc2a57907cf5e1b45a0
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>