From b24e437ab00efe191f57d56d0d5412e026a72c3b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 18 Nov 2020 21:11:14 +0100 Subject: [PATCH 1/6] hwdb: Document how to properly set the mount-matrix for the base-accelerometer in 360 degree hinges style 2-in-1s with 2 accelerometers Document how the mount-matrix for the base-accelerometer must be set on 360 degree hinges style 2-in-1s with 2 sensors (one in the display and 1 in the base). Note the choice to define the lid being fully closed as an angle of 0 degrees is based on the ACPI tables of devices with a BOSC0200 ACPI device-node describing both sensors. In this case the ACPI tables contain mount-matrix info (and the kernel will soon support reading this and exporting it to userspace) and the mount-matrices defined in these ACPI tables are such that the angle of the G-force vector measured by the sensors is identical for both sensors when the laptop's lid is fully closed. This also feels more natural then defining the laptop being fully open (180 degrees open) as the home / 0 degree angle position. --- hwdb.d/60-sensor.hwdb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index b0d0d084de..a975abdf04 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -67,6 +67,16 @@ # or 'display'. The default, when unset, is equivalent to: # ACCEL_LOCATION=display # +# A note about setting ACCEL_MOUNT_MATRIX for ACCEL_LOCATION=base sensors, +# on 360 degree hinges style 2-in-1s with 2 sensors (one in the display and +# 1 in the base). Userspace will use both sensors to calculate the angle between +# the 2 halves and the angle is defined as being 0 when the device is folded +# as a regular clamshell laptop with its lid closed. This means that the +# base-accelerometer's mount-matrix must be such, that after applying +# the mount-matrices to both sensors, the base-accelerometer's readings must +# be identical to the display-accelerometer's readings (when the lid is +# closed). +# # Sort by brand, model ######################################### From 276ede07404a802dbde8fc41da07636ec8998340 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 18 Nov 2020 18:48:43 +0100 Subject: [PATCH 2/6] hwdb: Add base accelerometer orientation quirk for base sensor of Medion Akoya E* series The KIOX010A and KIOX02A ACPI hw-ids (HIDs) are used in 360 degree hinges style 2-in-1s which have 2 accelerometers, 1 in the display (as usual) and a second accelerometer in the base. So far 60-sensor.hwdb has only defined a mount-matrix for the sensor with the KIOX010A HID, which is the sensor in the display half of the device. The reason for this is that sofar userspace has only cared actually used the sensor in the display (for automatic display rotation. Work is underway to make userspace use both sensors: https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/216 Recently an entry was added for the Medion Akoya's E2221T base-sensor, but that was added to mark it with ACCEL_LOCATION=base and the entry simply used the identity-matrix for ACCEL_MOUNT_MATRIX since nothing is using the mount-matrix info for the second accelerometer. I believe that this entry was added because on some devices the second accelerometer gets enumerated first and then iio-sensor-proxy will wrongly use the second sensor for display-rotation, unless it is marked with ACCEL_LOCATION=base. Instead of adding info for the second accelerometer on a per device basis use the same generic dmi matches as used for the first (KIOX010A) sensor, replacing the special case added for the E2221T and also update the ACCEL_MOUNT_MATRIX with the actual mount-matrix for the KIOX020A sensor in the base of these devices. This was tested on a Medion Akoya E2228T. --- hwdb.d/60-sensor.hwdb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index a975abdf04..4a5aeb0c96 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -540,10 +540,12 @@ sensor:modalias:acpi:KIOX010A*:dmi:*:svnMEDION:pnE*:* # Medion Akoya E3222 MD62450 sensor:modalias:acpi:KIOX010A*:dmi:*:svnMEDION:pnMEDION*:* ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1 + ACCEL_LOCATION=display -# Medion Akoya E2221T MD60691 -sensor:modalias:acpi:KIOX020A*:dmi:*:pnE2221TMD60691*:* - ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 1, 0; 0, 0, 1 +# Same as above, but for base sensor +sensor:modalias:acpi:KIOX020A*:dmi:*:svnMEDION:pnE*:* +sensor:modalias:acpi:KIOX020A*:dmi:*:svnMEDION:pnMEDION*:* + ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, -1 ACCEL_LOCATION=base ######################################### From 21b58655f3bd029fa8fe04e02e1c3546f110c524 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 14 Nov 2020 17:10:51 +0100 Subject: [PATCH 3/6] hwdb: Fix accel orientation quirk Z-axis for Lenovo ThinkPad Yoga 11e 3th gen The Lenovo ThinkPad Yoga 11e 360 degree hinges style 2-in-1s use 2 accelerometers, 1 in the display and 1 in the base. Kernel work is under way to also export the second accelerometer in the base as an iio-device; and userspace work is underway to use both accelerometers on 360 degree hinges style 2-in-1s (with 2 accels) to figure out the angle between the 2 halves. So far most orientation-matrix quirks have not cared much about the Z-axis being correct, but in these 2 accelerometer setups getting the Z-axis correct is important too. --- hwdb.d/60-sensor.hwdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index 4a5aeb0c96..202fada5f9 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -468,7 +468,7 @@ sensor:modalias:acpi:NCPE0388*:dmi:*:rnLenovoYOGA510-14IKB:* ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, 1 sensor:modalias:acpi:BOSC0200*:dmi:*ThinkPadYoga11e3rdGen:* - ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1 + ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, -1 # Miix3-1030 sensor:modalias:acpi:BMA250E*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-1030:* From 169cd66baad905d0df24f607cea0f84bf6ad1ad1 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 14 Nov 2020 17:09:04 +0100 Subject: [PATCH 4/6] hwdb: Add accel orientation quirk for Lenovo ThinkPad Yoga 11e 4th gen Add a quirk to fix the accelerometer orientation on the Lenovo ThinkPad Yoga 11e 4th gen 360 degree hinges 2-in-1. --- hwdb.d/60-sensor.hwdb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index 202fada5f9..c568a8d22f 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -470,6 +470,9 @@ sensor:modalias:acpi:NCPE0388*:dmi:*:rnLenovoYOGA510-14IKB:* sensor:modalias:acpi:BOSC0200*:dmi:*ThinkPadYoga11e3rdGen:* ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, -1 +sensor:modalias:acpi:BOSC0200*:dmi:*:svnLENOVO:*pvrThinkPadYoga11e4thGen:* + ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, -1 + # Miix3-1030 sensor:modalias:acpi:BMA250E*:dmi:bvnLENOVO:*:pvrLenovoMIIX3-1030:* ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1 From 565849429da55252b6b7e3cc77fc344c253f9848 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 15 Nov 2020 11:23:04 +0100 Subject: [PATCH 5/6] hwdb: Add accel orientation quirk for Voyo Winpad A15 tablet Add a quirk to fix the accelerometer orientation on the Voyo Winpad A15 tablet. --- hwdb.d/60-sensor.hwdb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index c568a8d22f..57123e6f1b 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -775,6 +775,16 @@ sensor:modalias:acpi:KIOX000A*:dmi:*:svnUMAX:pnVisionBook10WiPro:* sensor:modalias:acpi:SMO8500*:dmi:*:svnUMAX:pnVisionBook10WiPlus:* ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1 +######################################### +# Voyo +######################################### +# Voyo Winpad A15 +# The Winpad A15 does not have its product name filled, so we +# match the entire dmi-alias, assuming that the use of a SMO8500 + +# bios-version + bios-date combo is unique +sensor:modalias:acpi:SMO8500*:dmi:bvnAmericanMegatrendsInc.:bvr5.6.5:bd11/20/2014:br5.6:svnTobefilledbyO.E.M.:pnTobefilledbyO.E.M.:pvrTobefilledbyO.E.M.:rvnAMICorporation:rnAptioCRB:rvrTobefilledbyO.E.M.:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:* + ACCEL_MOUNT_MATRIX=0, -1, 0; 1, 0, 0; 0, 0, -1 + ######################################### # Wortmann ######################################### From 86de5e4239df2ea066d69f996e072fb578718a2c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 18 Nov 2020 17:11:50 +0100 Subject: [PATCH 6/6] hwdb: Add accel orientation quirk for Acer Aspire Switch 10 SW3-016 2-in-1 Add a quirk to fix the accelerometer orientation on the Acer Aspire Switch 10 SW3-016 2-in-1. --- hwdb.d/60-sensor.hwdb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index 57123e6f1b..0f75fd11a8 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -82,6 +82,9 @@ ######################################### # Acer ######################################### +sensor:modalias:acpi:KIOX0009*:dmi:*:svnAcer:pnAspireSW3-016:* + ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, -1 + sensor:modalias:acpi:INVN6500*:dmi:*svn*Acer*:*pn*AspireSW5-011:* ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1