Hey,
TLDR:
# first bad commit: [50ba22479c324c0d9dc8134d519dcba92d83a8a7] Merge
back earlier ACPI PM material for v4.3.
hid-sensor-hub devices only start sending events through the IIO
trigger after a suspend/resume cycle.
Other IIO drivers don't seem to exhibit those problems.
The long version:
As some of you know, I maintain iio-sensor-proxy[1], which tries to
read sensor values for a number of sensor types (accelerometer, ambient
light, compass) for a number of drivers (IIO, input, hwmon).
I've had a lot of bug reports some time after creating the project[2],
with HID sensor hub devices, which are the most common type of compound
sensor device types in laptops and more expensive tablets.
The problem seems to be that IIO devices don't send any events about
new data, even though there is new data available. A suspend/resume
cycle corrects this. (Some people have also had some luck making sure
the iio-sensor-proxy didn't try to poke at the device this early after
the kernel loaded the driver, I cannot easily test this).
The problem wasn't there when I started the project (July 2014) and has
appeared since. I finally got access to a type of device which I can
use to replicate the problem. I used the ColorHugALS[3] as a test
device (which uses hid-sensor-hub and is a USB device).
Testing:
Tested on a Lenovo X1 Carbon from 2014 (the one with the horrible touch
function keys).
1) Apply the attached patch to iio-sensor-proxy, compile and install it
in place of the OS-provided one. Running "monitor-sensor" will just
wait for ALS events for 10 seconds, and can be used for "git bisect
run".
2) I used Fedora kernels to pin down which "dot-o" version of the
kernel first showed the problem. The problems started occurring between
4.2 and 4.3. I also verified this with "linus" kernel trees to make
sure a Fedora patch didn't cause the problem.
3) The kernel configuration is Fedora's "4.2.0-1" kernel config, with
"make localmodconfig" run on it, to cut down on compile time
4) For every commit that bisect told me to inspect, I compiled a new
kernel with "make rpm", installed it, warm rebooted, and ran "monitor-
sensor".
I ran the bisection 3 times, and always ended up on a merge commit.
I've attached the bisect logs for 2 of those runs.
I'd happily provide iio-sensor-proxy patches if someone only has access
to a hid-sensor-hub accelerometer.
Cheers
[1]: https://github.com/hadess/iio-sensor-proxy
[2]: https://github.com/hadess/iio-sensor-proxy/issues?utf8=%E2%9C%93&q=is:issue%20label:"driver%20bug"%20
[3]: http://www.hughski.com/colorhugals.html
From fb595ab43f1e24a2f65298f8e9f7cd49a2d7dd29 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@xxxxxxxxxx>
Date: Thu, 19 Jan 2017 22:20:25 +0100
Subject: [PATCH] Test ALS for events coming in
---
src/monitor-sensor.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/monitor-sensor.c b/src/monitor-sensor.c
index 8d1e997..730ed4d 100644
--- a/src/monitor-sensor.c
+++ b/src/monitor-sensor.c
@@ -12,6 +12,8 @@
static GMainLoop *loop;
static guint watch_id;
static GDBusProxy *iio_proxy, *iio_proxy_compass;
+static int retval = 1;
+static double last_als = 0.0;
static void
properties_changed (GDBusProxy *proxy,
@@ -49,6 +51,7 @@ properties_changed (GDBusProxy *proxy,
GVariant *unit;
v = g_dbus_proxy_get_cached_property (iio_proxy, "LightLevel");
+ last_als = g_variant_get_double (v);
unit = g_dbus_proxy_get_cached_property (iio_proxy, "LightLevelUnit");
g_print (" Light changed: %lf (%s)\n", g_variant_get_double (v), g_variant_get_string (unit, NULL));
g_variant_unref (v);
@@ -194,6 +197,19 @@ vanished_cb (GDBusConnection *connection,
}
}
+static gboolean
+check_als (gpointer data)
+{
+ if (last_als == 0.0)
+ retval = 1;
+ else
+ retval = 0;
+ g_main_loop_quit (loop);
+ g_message ("%s", retval == 1 ? "FAILED" : "SUCCESS");
+
+ return TRUE;
+}
+
int main (int argc, char **argv)
{
watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
@@ -205,7 +221,8 @@ int main (int argc, char **argv)
g_print (" Waiting for iio-sensor-proxy to appear\n");
loop = g_main_loop_new (NULL, TRUE);
+ g_timeout_add_seconds (10, check_als, NULL);
g_main_loop_run (loop);
- return 0;
+ return retval;
}
--
2.9.3
git bisect start
# bad: [7e84b3035592b58872f476cdeff61d4bbcbb3452] Merge tag 'mmc-v4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
git bisect bad 7e84b3035592b58872f476cdeff61d4bbcbb3452
# good: [1860e379875dfe7271c649058aeddffe5afd9d0d] Linux 3.15
git bisect good 1860e379875dfe7271c649058aeddffe5afd9d0d
# good: [19583ca584d6f574384e17fe7613dfaeadcdc4a6] Linux 3.16
git bisect good 19583ca584d6f574384e17fe7613dfaeadcdc4a6
# good: [bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9] Linux 3.17
git bisect good bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9
# good: [b2776bf7149bddd1f4161f14f79520f17fc1d71d] Linux 3.18
git bisect good b2776bf7149bddd1f4161f14f79520f17fc1d71d
# good: [bfa76d49576599a4b9f9b7a71f23d73d6dcff735] Linux 3.19
git bisect good bfa76d49576599a4b9f9b7a71f23d73d6dcff735
# good: [39a8804455fb23f09157341d3ba7db6d7ae6ee76] Linux 4.0
git bisect good 39a8804455fb23f09157341d3ba7db6d7ae6ee76
# good: [b953c0d234bc72e8489d3bf51a276c5c4ec85345] Linux 4.1
git bisect good b953c0d234bc72e8489d3bf51a276c5c4ec85345
# good: [64291f7db5bd8150a74ad2036f1037e6a0428df2] Linux 4.2
git bisect good 64291f7db5bd8150a74ad2036f1037e6a0428df2
# bad: [6a13feb9c82803e2b815eca72fa7a9f5561d7861] Linux 4.3
git bisect bad 6a13feb9c82803e2b815eca72fa7a9f5561d7861
# bad: [807249d3ada1ff28a47c4054ca4edd479421b671] Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
git bisect bad 807249d3ada1ff28a47c4054ca4edd479421b671
# good: [102178108e2246cb4b329d3fb7872cd3d7120205] Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
git bisect good 102178108e2246cb4b329d3fb7872cd3d7120205
# good: [62da98656b62a5ca57f22263705175af8ded5aa1] netfilter: nf_conntrack: make nf_ct_zone_dflt built-in
git bisect good 62da98656b62a5ca57f22263705175af8ded5aa1
# good: [f1a3c0b933e7ff856223d6fcd7456d403e54e4e5] Merge tag 'devicetree-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
git bisect good f1a3c0b933e7ff856223d6fcd7456d403e54e4e5
# bad: [9cbf22b37ae0592dea809cb8d424990774c21786] Merge tag 'dlm-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
git bisect bad 9cbf22b37ae0592dea809cb8d424990774c21786
# bad: [8bdc69b764013a9b5ebeef7df8f314f1066c5d79] Merge branch 'for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
git bisect bad 8bdc69b764013a9b5ebeef7df8f314f1066c5d79
# bad: [498012511a060575a56551d28a10bb392aa361b5] Merge branch 'device-properties'
git bisect bad 498012511a060575a56551d28a10bb392aa361b5
# good: [c91c5b276bc1e60c0d65ff69e29b6edc5948430d] Merge branch 'acpica'
git bisect good c91c5b276bc1e60c0d65ff69e29b6edc5948430d
# good: [73990fc810bf84c5338d9596f8af8d70fe90ac72] Merge branches 'acpi-scan', 'acpi-processor' and 'acpi-assorted'
git bisect good 73990fc810bf84c5338d9596f8af8d70fe90ac72
# bad: [50ba22479c324c0d9dc8134d519dcba92d83a8a7] Merge back earlier ACPI PM material for v4.3.
git bisect bad 50ba22479c324c0d9dc8134d519dcba92d83a8a7
# good: [b9a8a271c38fcb1664fd6034fb9326cc9a0dec94] mfd: make mfd_remove_devices() iterate in reverse order
git bisect good b9a8a271c38fcb1664fd6034fb9326cc9a0dec94
# good: [4b45efe8526359a11ca60a299bef3aebf413fd77] mfd: Add support for Intel Sunrisepoint LPSS devices
git bisect good 4b45efe8526359a11ca60a299bef3aebf413fd77
# good: [5af310a8ee70dd6a588c8ee1d4487a230a7b7b65] Merge tag 'ib-mfd-base-acpi-dma-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into acpi-pm
git bisect good 5af310a8ee70dd6a588c8ee1d4487a230a7b7b65
# good: [3431e490b50356b56084305a2e93b3a980802b22] Merge branch 'acpi-scan' into acpi-pm
git bisect good 3431e490b50356b56084305a2e93b3a980802b22
# first bad commit: [50ba22479c324c0d9dc8134d519dcba92d83a8a7] Merge back earlier ACPI PM material for v4.3.
git bisect start
# bad: [50ba22479c324c0d9dc8134d519dcba92d83a8a7] Merge back earlier ACPI PM material for v4.3.
git bisect bad 50ba22479c324c0d9dc8134d519dcba92d83a8a7
# good: [64291f7db5bd8150a74ad2036f1037e6a0428df2] Linux 4.2
git bisect good 64291f7db5bd8150a74ad2036f1037e6a0428df2
# good: [71b65445f0ed04c2afe3660f829779fddb2890c1] ACPI / PM: Use target_state to set the device power state
git bisect good 71b65445f0ed04c2afe3660f829779fddb2890c1
# good: [4b45efe8526359a11ca60a299bef3aebf413fd77] mfd: Add support for Intel Sunrisepoint LPSS devices
git bisect good 4b45efe8526359a11ca60a299bef3aebf413fd77
# good: [1dcc3d3362b0c97e48290f7786be85b4cec2a147] ACPI / bus: Move ACPI bus type registration
git bisect good 1dcc3d3362b0c97e48290f7786be85b4cec2a147
# good: [5af310a8ee70dd6a588c8ee1d4487a230a7b7b65] Merge tag 'ib-mfd-base-acpi-dma-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into acpi-pm
git bisect good 5af310a8ee70dd6a588c8ee1d4487a230a7b7b65
# good: [3431e490b50356b56084305a2e93b3a980802b22] Merge branch 'acpi-scan' into acpi-pm
git bisect good 3431e490b50356b56084305a2e93b3a980802b22
# first bad commit: [50ba22479c324c0d9dc8134d519dcba92d83a8a7] Merge back earlier ACPI PM material for v4.3.