如何修改 /usr/lib/udev/hwdb.d/60-sensor.hwdb 以纠正平板电脑模式下的屏幕旋转?

如何修改 /usr/lib/udev/hwdb.d/60-sensor.hwdb 以纠正平板电脑模式下的屏幕旋转?

操作系统:Debian 11

udev附带一个配置文件,/usr/lib/udev/hwdb.d/60-sensor.hwdb其中指出:

# Allowed properties are:
#    ACCEL_MOUNT_MATRIX=<matrix>
#    PROXIMITY_NEAR_LEVEL=<value>
#
# where <matrix> is a mount-matrix in the format specified in the IIO
# subsystem[1]. The default, when unset, is equivalent to:
#   ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 1, 0; 0, 0, 1
# eg. the identity matrix,
# and <value> is an integer value above which an object is considered
# close by a proximity sensor:
#   PROXIMITY_NEAR_LEVEL=100
#
# [1]: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dfc57732ad38f93ae6232a3b4e64fd077383a0f1
#
# Note for devices where the display (LCD panel) is mounted non upright
# in the device's casing, e.g. mounted upside-down or 90 degree rotated,
# the ACCEL_MOUNT_MATRIX should be such that the x and y axis matches the
# x and y axis of the display, not those of the casing, so that desktop
# environments using the accelerometer data for rotation will e.g.
# automatically flip their output for an upside-down display when the device
# is held upright.
#
#    ACCEL_LOCATION=<location>
#
# where <location> is the location of the sensor. This value could be 'base'
# or 'display'. The default, when unset, is equivalent to:
#    ACCEL_LOCATION=display

诸如此类的例子

#########################################
# Google Chromebooks
#########################################
sensor:modalias:platform:cros-ec-accel:dmi:*:svnGOOGLE:*
 ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1

我有一台运行 Debian 11 的 Pixelbook,平板电脑模式下的屏幕始终旋转 180 度(纵向和个人资料模式)。我想如果我应用一个旋转矩阵,它将使屏幕绕 z 轴旋转 180 度,即...... [ -1 0 0; 0 -1, 0; 0 0 1] 在 /etc/udev/hwdb.d 文件中它将解决该问题。但到目前为止,这一努力没有任何改变。难道是因为旋转矩阵错了?

另一个问题是 Pixelbook 有 2 个加速计,一个在盖子上,一个在底座上。它们modaliascros-ec-accel,如示例中所示,但sysfs它们还附加有.N.auto,其中N只是每次启动时都会更改的数字。上例中是否错误地或不充分地引用了传感器?我尝试sensor:modalias:platform:cros-ec-accel.*:dmi:*:svnGOOGLE:pnEve*并添加ACCEL_LOCATION=<lid|base>无济于事。

相关内容