Commit Graph

3 Commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen 3e021232da rules: allow quirks for platform input accelerometers 2017-03-03 21:23:39 +01:00
Daniel Drake 906d8a2ac5 udev: Allow quirks for ACPI input accelerometers
The existing accelerometer rules only support IIO devices, however
iio-sensor-proxy can also work with accelerometers made available
through the input (evdev) subsystem.

In this case I am working with an accelerometer input device backed by an
ACPI driver for which the hierarchy is:
- ACCE0001 (ACPI device)
  -> input8
    -> event7

We want the mount matrix (from hwdb) to be applied to both input8 and
event7. However, to match in 60-sensor.hwdb, we need to be working
with the modalias of the parent device (ACCE0001), and it is tricky
to access that when processing the input8 device which has it's own
modalias.

Instead of working directly with modalias, this ACPI-specific rule
uses the "hid" attribute to reconstruct the ACPI modalias. Since input
and event devices do not provide a hid attribute we will always get this
from the ACPI parent.

The modalias is constructed according to the definition in the kernel's
Documentation/acpi/namespace.txt and create_pnp_modalias(). We will only
use the first _CID/_HID value available, i.e. in some cases we will only
reconstruct the first part of the modalias, but that should be enough
granularity for our needs.
2017-03-02 00:02:22 +01:00
Bastien Nocera 1f886b50f6 udev: Add rules for accelerometer orientation quirks
This commit adds a rules file to extract the properties from hwdb
to set on i2c IIO devices. This is used to set the ACCEL_MOUNT_MATRIX
property on IIO devices, to be consumed by iio-sensor-proxy or
equivalent daemon.

The hwdb file contains documentation on how to write quirks. Note
however that mount information is usually exported in:
- the device-tree for ARM devices
- the ACPI DSDT for Intel-compatible devices
but currently not extracted by the kernel.

Also note that some devices have the framebuffer rotation that changes
between the bootloader and the main system, which might mean that the
accelerometer is then wrongly oriented. This is a missing feature in the
i915 kernel driver: https://bugs.freedesktop.org/show_bug.cgi?id=94894
which needs to be fixed, and won't require quirks.
2016-12-10 02:25:11 -05:00