502 Commits

Author SHA1 Message Date
Bastien Nocera
83162f1db4 main: Add debug to uevents 2017-02-15 15:37:40 +01:00
Bastien Nocera
2ef060185f main: Fix possible crash on start due to race
We used to look for sensor devices at the same time as we were setting
up D-Bus. If D-Bus was ready when we finished probing for devices, then
we'd send a D-Bus event. But we would also try to send a D-Bus event
when we got our first event from the sensors, at which point D-Bus might
not be ready.

We really shouldn't be trying to probe and setup the sensors before we
know we can own the D-Bus name, as that might mean that another service
is already running, and we might just break the existing daemon.

Closes #147
2017-02-15 13:53:01 +01:00
Bastien Nocera
d36eedeca7 README: Add Asus ZenBook UX303L to the tested list
Closes: #148
2017-02-15 10:53:47 +01:00
Bastien Nocera
33fc9ee0d3 README: Add version req for systemd
systemd 232 does not include the necessary rules to apply the quirks to
accelerometers. This requires this commit:
1f886b50f6
which can easily be backported to earlier systemd versions as
appropriate.

See https://github.com/systemd/systemd/pull/5280
2017-02-11 15:47:17 +01:00
Bastien Nocera
8941370d08 2.1 2017-02-02 16:22:01 +01:00
Simon McVittie
e2d81f2141 security: Make D-Bus policy rules only affect SensorProxy itself
D-Bus policy XML files are generic configuration for the bus daemon:
they are conventionally named like a bus name, but there is nothing
that inherently limits their application to that bus name.

In particular this means that a rule like

  <policy context="default">
    <allow send_interface="org.freedesktop.DBus.Properties"/>

allows any process on the system bus to send an
org.freedesktop.DBus.Properties.Set() call to any other process on the
system bus, even if the destination process expected to be only
accessible by root.

Closes: #41
2017-02-02 16:12:52 +01:00
Bastien Nocera
f31e0bbaa9 README: Add details on how to test the fake compass
For debugging purposes.
2017-02-02 16:08:41 +01:00
Bastien Nocera
5c4f2ae0d2 monitor-sensor: Fix run-time warning monitoring the compass
The fake compass' CompassHeading property is unset when we start up.
2017-02-02 16:06:28 +01:00
Bastien Nocera
6c5cb2e586 compass: Change the device to which we should latch
Instead of using the real "Lid Switch" device to attach our fake compass
to, use "Power Button". "Lid Switch" will only be present on laptops,
but "Power Button" is in both laptops and desktops, making it easier to
test.
2017-02-02 16:04:43 +01:00
Bastien Nocera
6a115c5e9c README: Add devices to the tested list
Closes: #143
2017-02-02 11:41:37 +01:00
Bastien Nocera
815427fbad README: Sort tested devices alphabetically 2017-02-02 11:41:01 +01:00
Gianluca Boiano
bddb77c371 README: Add Asus Transformer Book TP500LB to the tested list
Closes #138
2017-01-22 00:42:12 +01:00
Bastien Nocera
45f9a63885 data: Lockdown systemd service
As detailed in systemd.exec(5).
2017-01-05 13:06:37 +01:00
Bastien Nocera
b474bf0943 README: Add reference to HP Spectre x360 laptop
See #118
2017-01-02 16:09:27 +01:00
Bastien Nocera
19ec07affa data: Fix compass property name
In commit 924dd58, we changed from matching the device names to a more
generic property match. But we matched on the "iio-buffer-compass"
property instead of the one actually set in the udev rules
("iio-compass").

Change the udev rules property name to "iio-buffer-compass" so that
rules and code match.

This fixes iio-sensor-proxy startup on HP Pavilion x360.

Spotted by Ted Ying <yingted@gmail.com>

Closes: #128
2016-12-28 11:23:10 +01:00
Bastien Nocera
e803bb44f7 2.0 2016-12-12 13:30:49 +01:00
Bastien Nocera
67e3d38ea5 README: Add section about Accelerometer Orientation
And point to the quirks hwdb in systemd.
2016-12-10 16:52:07 +01:00
Bastien Nocera
3946ac8d34 test: Add orientation test for the Winbook TW100 2016-12-10 16:52:07 +01:00
Bastien Nocera
297bce8cba data: Also apply property when the device changes
This means that "udevadm trigger ..." won't lose that data, making
it easier to test device properties like the mount-matrix.
2016-12-10 16:52:07 +01:00
Bastien Nocera
daf40b6d25 accel: Actually apply the mount-matrix
We did set up ourselves to do this, but never went to the point
where we applied the mount-matrix.

Spotted by Carlos Garnacho.
2016-12-03 13:07:18 +01:00
Bastien Nocera
93b80fb624 accel: Fix debug output in poll driver
Can you guess whether this was tested:
Accel read from IIO on '(null)': 0, 0, 0 (scale 1.0)

The NAME udev property was not available, so use the "name" sysfs
attribute instead, and don't use the readings struct before we've set
it.
2016-12-02 16:29:18 +01:00
Bastien Nocera
67a4b20d17 accel: Fallback to poll driver when no trigger available
Some IIO drivers have the ability to use triggers, but we'd fail at
runtime because no trigger was available for use. Fix that by checking
for a trigger being available early, and allow the poll driver to drive
buffer devices without a trigger.
2016-12-02 16:29:18 +01:00
Bastien Nocera
571b372702 all: Rename IioAccelVec3 to AccelVec3
As there's nothing IIO specific to it (says the maintainer
of "iio" sensor proxy).
2016-12-02 15:57:16 +01:00
Bastien Nocera
f54b52ffe1 accel: Apply mount-matrix from udev ACCEL_MOUNT_MATRIX property
Mount-matrix for devices that require them are now read from udev.
In some cases, the information is already available in the
device's firmware, but the kernel does not export it. Bear this
in mind when writing quirks.
2016-12-02 15:48:41 +01:00
Bastien Nocera
b2936ea4fc test: Correct vectors used by fake accelerometer 2016-12-02 12:34:20 +01:00
Bastien Nocera
8b91629cc5 test: Add mount-matrix application test
This allow us to verify that the mount-matrix applied to accel
vectors give us the right orientation.

The vectors were captured on a Onda v975, without quirks applied.
2016-12-02 12:34:20 +01:00
Bastien Nocera
d65078dd33 test: Allow passing a mount-matrix to test-orientation
To make it easier to test mount-matrix.
2016-12-02 12:34:20 +01:00
Bastien Nocera
fa7a800d43 test: Use GTest in mount-matrix test 2016-12-02 12:29:11 +01:00
Bastien Nocera
ebb910b968 test: Add a way to print the orientation given vectors
Given accelerometer readings, print the orientation.
2016-12-02 12:29:01 +01:00
Bastien Nocera
29d0bb5785 accel: Remove work-around quirk from poll accel driver 2016-12-01 16:28:59 +01:00
Bastien Nocera
9fc18613b1 accel: Remove work-around quirk from buffer accel driver 2016-12-01 16:28:13 +01:00
Bastien Nocera
35b6328cbd orientation: Fix orientation calculations to match Windows 10
This fixes the new test-orientation test case.
2016-12-01 16:28:13 +01:00
Bastien Nocera
ec5cafeb99 test: Add command-line orientation test
For automated testing eventually.

The values were taken from the SensorInfo application for
Windows 10. For now, our tests will fail because of the
quirks we wrongfully applied.
2016-12-01 16:28:12 +01:00
Bastien Nocera
748404c0b4 test: Add copyright header to the new mount-matrix test 2016-12-01 16:28:12 +01:00
Bastien Nocera
921c831c62 build: Check for libm in configure
Rather than hardcoding "-lm" in the linker flags
2016-12-01 16:28:12 +01:00
Bastien Nocera
5184796323 test: Add the graphical orientation to the build
That'll stop it from having a broken build. Also rename the test
to test-orientation-gtk as we'll want to have a non-graphical
test soon.
2016-12-01 16:28:12 +01:00
Bastien Nocera
d6f73717b4 README: Add another reference link
This time to MSDN, which explains sensor orientation.
2016-11-30 17:11:57 +01:00
Bastien Nocera
3877f1906a test: Fix for orientation_calc() API change 2016-11-30 17:11:57 +01:00
Bastien Nocera
999e91d27c test: Set default values to be "up"
Rather than some random orientation.
2016-11-30 17:11:57 +01:00
Bastien Nocera
ecf440ca9c main: Update copyright notice
Remove mention of orientation_calc() copyright, it's now
 in orientation.c
2016-11-30 17:11:57 +01:00
Bastien Nocera
d07793a343 test: Fix Z axis spin button not working 2016-11-30 17:11:57 +01:00
Bastien Nocera
560347c119 README: Add links to other reference implementations 2016-11-30 14:16:03 +01:00
Bastien Nocera
67174ca3db main: Add mount matrix parsing test 2016-11-30 14:16:03 +01:00
Bastien Nocera
58d8819cf6 main: Add helper functions for mount matrices
One function to parse the mount matrix string in the format exported by
the iio core in Linux to a 3x3 matrix, and another to apply the mount
matrix to an existing 3-dimensional vector.
2016-11-30 14:16:01 +01:00
Bastien Nocera
531dcc80f6 accel: Simplify input accel detection 2016-11-23 15:14:40 +01:00
Bastien Nocera
924dd58464 compass: Support more IIO compass sensors
The buffer driver should now be able to handle more than just the
HID sensor hub.
2016-11-23 15:14:40 +01:00
Bastien Nocera
43386bd459 hwmon: Support hwmon ALS on non-Apple devices
We used to require "platform:applesmc" in the modalias, which meant that
other device with compatible hwmon sensors wouldn't be used.
2016-11-23 15:14:40 +01:00
Bastien Nocera
79c79270b9 light: Support more IIO ALS sensors
The buffer driver should now be able to handle more than just the HID
sensor hub.
2016-11-23 15:14:40 +01:00
Bastien Nocera
ccaf37e00a accel: Use udev tags to know which driver to use
This means that the buffer driver can now handle more than the
bog-standard HID sensor hub, and that the polling driver can handle any
IIO polling device.

Closes: #39
2016-11-23 15:14:40 +01:00
Bastien Nocera
c1bc67339b accel: Add warning when opening the event node fails
Otherwise we'd continue polling without any output, and we wouldn't see
that something is wrong.
2016-11-23 15:14:40 +01:00