Commit Graph

286 Commits

Author SHA1 Message Date
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
Bastien Nocera
f7be8bba37 data: Don't start iio-sensor-proxy for devices we don't handle
For every type of device we support, tag the device with an
IIO_SENSOR_PROXY_TYPE property which the drivers can use to filter the
type of driver it will use.

This also means that hwmon temperature sensors, unsupported IIO sensors,
etc. don't start iio-sensor-proxy, and iio-sensor-proxy doesn't appear
in the udev output for that device (which lead to folks thinking their
hardware had light sensors or an accelerometer, which it didn't).
2016-11-23 15:14:40 +01:00
Bastien Nocera
04741e53ea README: Add Asus Zenbooks to the tested list
Closes: #76
2016-11-23 15:14:39 +01:00
Bastien Nocera
ba9a803628 data, main: Move debug envvar to service file
To make it easier to debug iio-sensor-proxy
without recompiling.
2016-11-22 14:19:12 +01:00
Bastien Nocera
5468452f7a main: Add artificial delay before starting daemon
The IIO core, or the HID layer for HID sensor hubs, seems not
to like being poked straight after waking up, so add an
artificial delay during startup.

This is similar to the work-arounds doing the rounds in the
iio-sensor-proxy issues that switch the service type to idle
which would add a delay of up to 5 seconds by waiting for
other daemons to have finished startup.

This will need a real fix in the kernel at some point.
2016-11-22 14:14:18 +01:00
Bastien Nocera
d71d4342e4 iio-buffer-utils: Better debug in enable_sensors() 2016-11-22 14:14:18 +01:00
Srinivas Pandruvada
12c137bcf1 iio-buffer-utils: Don't fail on non-existing attributes
build_channel_array() goes through each directory member in
scan_elements folder and tries to get scale and offset of matching
elements. But there will be no scale and offset for some elements
like timestamp.
For example:
in_accel_x_en     in_accel_y_en     in_accel_z_en     in_timestamp_en
in_accel_x_index  in_accel_y_index  in_accel_z_index  in_timestamp_index
in_accel_x_type   in_accel_y_type   in_accel_z_type   in_timestamp_type

When scale and offset not present, iioutils_get_param_float() will fail,
this causes return from the build_channel_array().

It shouldn't return when the error is caused by the attribute not being
present as, in this case, in_time_stamp_scale.

This was fixed in the kernel's iio_utils.c in commit 7868dfd.
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7868dfd216074fc5f902e7befacda2a0ec76e403

Closes: #114
2016-11-18 11:46:57 +01:00
Bastien Nocera
78b4656fc2 build: Check for .pc files before using them
Otherwise we might install the udev rules in /rules.d.

Closes #107
2016-10-27 11:12:22 +02:00
Sebastian Krzyszkowiak
a5cf6e13b3 README: Add Lenovo Yoga 900
Tested on Lenovo Yoga 900

Also, fix Yoga 2 Pro name.
2016-10-03 23:55:54 +02:00
Bastien Nocera
cbde855337 README: Add HP Pavilion X360
Closes #102
2016-09-26 13:02:54 +02:00
Bastien Nocera
ed14eee19a 1.3 2016-09-17 00:56:37 +02:00
Srinivas Pandruvada
5d3a83d77d iio-buffer-utils: Really fix sorting of channels
As per the documentation of g_ptr_array_sort
"Note that the comparison function for g_ptr_array_sort() doesn't take the
pointers from the array as arguments, it takes pointers to the pointers in
the array"
So the arguments to the function
	compare_channel_index (gconstpointer a, gconstpointer b)
needs to be dereferenced to get pointer to iio_channel_info.

The error was included in the fixup for commit 984803b by
the maintainer.

Closes #99
2016-09-17 00:49:59 +02:00
Bastien Nocera
cabe6ee4a3 main: Remove unused struct members
->accel_{x,y,z} was set but never used.
2016-09-14 14:15:49 +02:00
Bastien Nocera
8ac58ec86a accel: Add debug for input and iio-poll accel drivers 2016-09-14 14:15:26 +02:00
Bastien Nocera
07299fb51b accel: Fix accelerometer unit confusion
The original orientation code was based upon code that expected 1G to
roughly correspond to a reading of 256, to work-around the fact that the
input layer could not pass fractional values easily.

So the orientation_calc() code expected that too. But IIO readings after
scaling are properly in m/s², and our readings are integers.

We'll pass the scaling around to be applied at the last minute, when
doing calculations.

Closes: #100
2016-09-14 14:12:01 +02:00
Bastien Nocera
5ff39aea7d build: Refuse to build with srcdir != builddir
The API docs currently fail to dist correctly.

See https://bugzilla.gnome.org/show_bug.cgi?id=771359
2016-09-13 15:19:44 +02:00
Bastien Nocera
b4b9fe2037 iio: Add "scale" to the debug output 2016-09-12 19:22:41 +02:00