Skip to content

Commit

Permalink
Merge pull request #239 from bbonev/sd-pr-24353
Browse files Browse the repository at this point in the history
Systemd PR 24353
  • Loading branch information
bbonev authored Sep 22, 2022
2 parents ba2cff9 + 152456e commit bebf651
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hwdb/60-sensor.hwdb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
# ABI.
#
# Match string formats:
# sensor:<label>:modalias:<parent modalias pattern>:dmi:<dmi pattern>
# sensor:modalias:<parent modalias pattern>:dmi:<dmi pattern>
#
# The device modalias can be seen in the `modalias` file of the sensor parent,
# and the device label can be seen in the `label` file of the sensor,
# for example:
# cat /sys/`udevadm info -q path -n /dev/iio:device0`/label
# cat /sys/`udevadm info -q path -n /dev/iio:device0`/../modalias
#
# The full DMI string of the running machine can be read from
Expand Down Expand Up @@ -399,6 +402,17 @@ sensor:modalias:platform:cros-ec-accel:dmi:*svnGoogle:pnVayne*:*
sensor:modalias:platform:cros-ec-accel:dmi:*Google_Nocturne*:*
ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1

sensor:modalias:platform:cros-ec-accel:*
sensor:accel-display:modalias:platform:cros-ec-accel:*
sensor:accel-display:modalias:platform:cros-ec-accel-legacy:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1

# Base accel reports the same as display when lid angle is 180 degrees (vs 0),
# so it needs an additional 180 degree rotation around the X axis.
sensor:accel-base:modalias:platform:cros-ec-accel:*
sensor:accel-base:modalias:platform:cros-ec-accel-legacy:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, 1

#########################################
# GP-electronic
#########################################
Expand Down
16 changes: 16 additions & 0 deletions rules/60-sensor.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

ACTION=="remove", GOTO="sensor_end"

# device matching the sensor's label, name and the machine's DMI data for IIO devices
SUBSYSTEM=="iio", KERNEL=="iio*", SUBSYSTEMS=="usb|i2c|platform", ATTR{label}!="", \
IMPORT{builtin}="hwdb 'sensor:$attr{label}:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \
GOTO="sensor_end"

# Before Linux v6.0, cros-ec-accel used a non-standard 'location' sysfs file
SUBSYSTEM=="iio", KERNEL=="iio*", SUBSYSTEMS=="platform", \
ATTR{name}=="cros-ec-accel|cros-ec-accel-legacy", ATTR{location}=="base", \
IMPORT{builtin}="hwdb 'sensor:accel-base:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \
GOTO="sensor_end"

SUBSYSTEM=="iio", KERNEL=="iio*", SUBSYSTEMS=="platform", \
ATTR{name}=="cros-ec-accel|cros-ec-accel-legacy", ATTR{location}=="lid", \
IMPORT{builtin}="hwdb 'sensor:accel-display:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \
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|platform", \
IMPORT{builtin}="hwdb 'sensor:modalias:$attr{modalias}:$attr{[dmi/id]modalias}'", \
Expand Down

0 comments on commit bebf651

Please sign in to comment.