Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd PR 24353 #239

Merged
merged 3 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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