6

I recently acquired a Lenovo Yoga 3 11" convertible notebook. It works really with out-of-the-box with Ubuntu Gnome LTS 16.04.2 - WiFi, Bluetooth, even suspend and resume work without any issues so far.

I noticed that Gnome 3 even allows the screen to auto-rotate based on the built-in rotation sensors. The Yoga 3 11" does offer rotation sensors via iio-sensor-proxy which is already installed by default in Ubuntu Gnome. As it happens, the orientation reported by iio-sensor-proxy seems to be off by 90°.

https://askubuntu.com/questions/634151/auto-rotate-screen-on-dell-13-7000-with-15-04-gnome has a solution in terms of a custom shell script which handles the screen rotation. I would rather not use this solution as it disables the "disable screen rotation" button in Gnome Shell.

I did some research already and found that iio-sensor-proxy should cause udev to trigger an event which is then used by Gnome 3 to set the screen orientation via xrandr. I cannot, however, find a way to tell either udev or Gnome 3 that the accelerometer is mounted in an orientation different from the display, which requires the directions to be translated in between.

So, the question is: How can that be done? The orientation remapping should be possible in either iio-sensor-proxy, udev or Gnome 3, and I actually don't care that much where it is done. I don't seem to find any config files I can easily change to achieve what I need.

As a workaround for now I am using the script from the ask ubuntu question linked above, with modifications to account for the misaligned display/accelerometer issue. For this to work, I have to disable the automatic screen rotation in Gnome 3. Although this solution also allows automatically starting and killing onboard (on-screen keyboard) depending on current orientation, it kind of defeats the purpose of the Gnome 3 screen rotation setting.

1

From GITHUB iio-sensor-proxy site When the accelerometer is not mounted the same way as the screen, we need to modify the readings from the accelerometer to make sure that the computed orientation matches the screen one.

iio-sensor-proxy reads this information from the device's ACCEL_MOUNT_MATRIX udev property. See 60-sensor.hwdb for details.

1

See the answer by Krzysztof Stasiak for the theory.

In practice, my machine - a one mix one netbook 2s - by default has a screen rotated 90deg anticlockwise.

From what I understand, by default - every machine that doesn't have overrides has a matrix of ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 1, 0; 0, 0, 1

Putting the following into /etc/udev/hwdb.d/60-sensor.hwdb fixed my case:

sensor:modalias:*
  ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.