summaryrefslogtreecommitdiff
path: root/rules/60-sensor.rules
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-12-06 17:16:43 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-10 02:25:11 -0500
commit1f886b50f6cf17af12bf74049fb4e8031a33f40d (patch)
treedbdfb8a952d23a4bfe5ee552f82290f5bef52c40 /rules/60-sensor.rules
parent5efdbf11d1ef7da72d3de58abecd84edefbaf98a (diff)
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.
Diffstat (limited to 'rules/60-sensor.rules')
-rw-r--r--rules/60-sensor.rules10
1 files changed, 10 insertions, 0 deletions
diff --git a/rules/60-sensor.rules b/rules/60-sensor.rules
new file mode 100644
index 0000000000..82e44f8843
--- /dev/null
+++ b/rules/60-sensor.rules
@@ -0,0 +1,10 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION=="remove", GOTO="sensor_end"
+
+# device matching the sensor's name and the machine's DMI data for IIO devices
+SUBSYSTEM=="iio", KERNEL=="iio*", SUBSYSTEMS=="usb|i2c", \
+ IMPORT{builtin}="hwdb 'sensor:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \
+ GOTO="sensor_end"
+
+LABEL="sensor_end"