diff options
author | 2017-02-28 11:38:18 -0600 | |
---|---|---|
committer | 2017-03-02 00:02:22 +0100 | |
commit | 906d8a2ac52f38ab0c9e65462cb2233c4ef46ef3 (patch) | |
tree | 4c6eea6b0eb9a513b110c70c8ded54b898c8a1ac /rules | |
parent | Merge pull request #5283 from poettering/tighten-sandbox (diff) | |
download | systemd-906d8a2ac52f38ab0c9e65462cb2233c4ef46ef3.tar.gz systemd-906d8a2ac52f38ab0c9e65462cb2233c4ef46ef3.tar.bz2 systemd-906d8a2ac52f38ab0c9e65462cb2233c4ef46ef3.zip |
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.
Diffstat (limited to 'rules')
-rw-r--r-- | rules/60-sensor.rules | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rules/60-sensor.rules b/rules/60-sensor.rules index 82e44f884..d2f0d90ce 100644 --- a/rules/60-sensor.rules +++ b/rules/60-sensor.rules @@ -7,4 +7,8 @@ SUBSYSTEM=="iio", KERNEL=="iio*", SUBSYSTEMS=="usb|i2c", \ IMPORT{builtin}="hwdb 'sensor:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \ GOTO="sensor_end" +SUBSYSTEM=="input", ENV{ID_INPUT_ACCELEROMETER}=="1", SUBSYSTEMS=="acpi", \ + IMPORT{builtin}="hwdb 'sensor:modalias:acpi:$attr{hid}:$attr{[dmi/id]modalias}'", \ + GOTO="sensor_end" + LABEL="sensor_end" |