From cd3d83fb303947d371089e0c11ac01e0ea4e4518 Mon Sep 17 00:00:00 2001 From: Austere Grim Date: Tue, 27 Aug 2024 12:51:27 -0700 Subject: [PATCH 1/2] Update README.md Rotation fix example Added a rotation fix example solution. This solution was developed by using copilot but rewritten by hand to make sense for an example for the readme. --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index 6dc859d..06d0ed8 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,50 @@ one-line representation of the matrix above: x_1, y_1, z_1; x_2, y_2, z_2; x_3, y_3, z_3 ``` +Fix Rotation Example +------------------- + +To fix rotation issues using iio sensors proxy, you’ll need to adjust the +mount matrix. + +As an example; a Chuwi Hi10 X device is defined in 60-sensor.hwdb with this +matrix line `ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1`. In this example the device has a +90-degree counterclockwise rotation issue, where the bottom of the screen is always +in the right hand. To correct this, you need to modify the matrix to reflect +the desired orientation. + +For a 90-degree clockwise rotation fix, the matrix line should be: +`0, -1, 0; 1, 0, 0; 0, 0, 1` + +$` \left[ {\begin{array}{ccc} + 0 & -1 & 0\\ + 1 & 0 & 0\\ + 0 & 0 & 1\\ + \end{array} } \right] +`$ + + +Create a new or edit existing /etc/udev/hwdb.d/99-sensor.hwdb file and add the following lines: +``` +sensor:modalias:acpi:MXC6655*:dmi:*:svnCHUWIInnovationAndTechnology*:pnHi10X:* +ACCEL_MOUNT_MATRIX=0, -1, 0; 1, 0, 0; 0, 0, 1 +``` + +Run the following commands to update the hardware database and trigger +the changes: +``` +sudo systemd-hwdb update +sudo udevadm trigger +``` + +Restart the service to apply the changes: +``` +sudo systemctl restart iio-sensor-proxy.service +``` + +Use the `monitor-sensor` command to check if the orientation is now corrected. + + Compass testing --------------- From c8e22dcdabf16f9b5336a4630f4e7815a754c4bb Mon Sep 17 00:00:00 2001 From: Austere Grim Date: Tue, 27 Aug 2024 13:37:49 -0700 Subject: [PATCH 2/2] Update README.md fixed the matrix and made some clarifications --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 06d0ed8..c5497db 100644 --- a/README.md +++ b/README.md @@ -155,20 +155,21 @@ in the right hand. To correct this, you need to modify the matrix to reflect the desired orientation. For a 90-degree clockwise rotation fix, the matrix line should be: -`0, -1, 0; 1, 0, 0; 0, 0, 1` +`0, 1, 0; -1, 0, 0; 0, 0, 1` + +Second line: `-1, 0, 0` negates the sensor on its x axis. $` \left[ {\begin{array}{ccc} - 0 & -1 & 0\\ - 1 & 0 & 0\\ + 0 & 1 & 0\\ + -1 & 0 & 0\\ 0 & 0 & 1\\ \end{array} } \right] `$ - -Create a new or edit existing /etc/udev/hwdb.d/99-sensor.hwdb file and add the following lines: +Create a new or edit existing /etc/udev/hwdb.d/99-sensor.hwdb file and add the following lines (using the wildcards to remove any unique module identifier that may not apply to your device, and requires a space before the `ACCEL_MOUNT_MATRIX` line): ``` -sensor:modalias:acpi:MXC6655*:dmi:*:svnCHUWIInnovationAndTechnology*:pnHi10X:* -ACCEL_MOUNT_MATRIX=0, -1, 0; 1, 0, 0; 0, 0, 1 +sensor:modalias:acpi:MXC6655*:dmi:*:*:*:* + ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1 ``` Run the following commands to update the hardware database and trigger @@ -184,6 +185,7 @@ sudo systemctl restart iio-sensor-proxy.service ``` Use the `monitor-sensor` command to check if the orientation is now corrected. +Rotate the tablet clockwise and `left-up` should be stated, and you can rotate counterclockwise back to `normal`. Compass testing