You are not logged in.

#1 2021-01-18 02:13:27

tikhon03
Member
Registered: 2020-12-30
Posts: 6

No Automatic Rotation on a Lenovo Ideapad Flex 5

I am using KDE and arch linux on a Lenovo Ideapad Flex 5.

$ uname -r                                                                                     
5.10.7-arch1-1

$ lspci
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Root Complex
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Renoir IOMMU
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge
00:01.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge
00:02.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge
00:02.4 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe GPP Bridge
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus
00:08.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 51)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 7
01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
02:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)
03:00.0 Non-Volatile memory controller: SK hynix Device 174a
04:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c2)
04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Device 1637
04:00.2 Encryption controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor
04:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1
04:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir USB 3.1
04:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor (rev 01)
04:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller
04:00.7 Signal processing controller: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/Renoir Sensor Fusion Hub
05:00.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 81)
05:00.1 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 81)

I have been exprimenting with some of the methods of getting screen rotation to be automatic as described here https://wiki.archlinux.org/index.php/Ta … c_rotation,
but while I have been able to solve some issues screen I am now stuck. Here is what I have done so far. First, it looks like neither https://aur.archlinux.org/packages/kded-rotation-git/ nor
https://github.com/GuLinux/screenrotator work with wayland currently. So I am using X11. I read through the script /usr/bin/orientation-helper carefully. It assumes X11 in the way that xrandr is used, and it works just fine when I call it from the commandline like so

orientation-helper -r bottom-up

but it does not work automatically. Next I tried following the debuging steps for iio-sensor-proxy describe here https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/, and discovered that my accelerometer was not being recognized. From the lspci ouptut given above, I guessed that it was probably the Renoir Sensor Fusion Hub. I found this discussion https://bbs.archlinux.org/viewtopic.php?id=252815, and so I installed https://aur.archlinux.org/packages/amd-sfh-hid-dkms/, added

amd_iommu=off

to the grub command line, and rebooted. Now my accelerometer is detected as can be seen from this output

$ udevadm info --export-db | grep iio
P: /devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0
N: iio:device0
E: DEVPATH=/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0
E: SUBSYSTEM=iio
E: DEVNAME=/dev/iio:device0
E: DEVTYPE=iio_device
E: IIO_SENSOR_PROXY_TYPE=iio-poll-accel iio-buffer-accel
E: SYSTEMD_WANTS=iio-sensor-proxy.service
E: SUBSYSTEM=iio

but still no automatic rotation. Here are the remaining debuging steps described in the readme for iio-sensor-proxy

$ gdbus introspect --system --dest net.hadess.SensorProxy --object-path /net/hadess/SensorProxy
node /net/hadess/SensorProxy {
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface_name,
          in  s property_name,
          out v value);
      GetAll(in  s interface_name,
             out a{sv} properties);
      Set(in  s interface_name,
          in  s property_name,
          in  v value);
    signals:
      PropertiesChanged(s interface_name,
                        a{sv} changed_properties,
                        as invalidated_properties);
    properties:
  };
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s xml_data);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Peer {
    methods:
      Ping();
      GetMachineId(out s machine_uuid);
    signals:
    properties:
  };
  interface net.hadess.SensorProxy {
    methods:
      ClaimAccelerometer();
      ReleaseAccelerometer();
      ClaimLight();
      ReleaseLight();
      ClaimProximity();
      ReleaseProximity();
    signals:
    properties:
      readonly b HasAccelerometer = true;
      readonly s AccelerometerOrientation = 'undefined';
      readonly b HasAmbientLight = false;
      readonly s LightLevelUnit = 'lux';
      readonly d LightLevel = 0.0;
      readonly b HasProximity = false;
      readonly b ProximityNear = false;
  };
  node Compass {
  };
};

and

$ monitor-sensor
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: undefined)
=== No ambient light sensor
=== No proximity sensor

Somehow the orientation is undefied. I get the same thing regardless of whether I use the AUR or non-AUR version of iio-sensor-proxy. Using the AUR version here is some more debugging information

$ sudo /usr/lib/iio-sensor-proxy -v -r
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.306: Found associated trigger at /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/trigger0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.309: Found IIO buffer accelerometer at /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.309: No auto-detected location, falling back to display location
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.309: Found device /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0 of type accelerometer at IIO Buffer accelerometer
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.316: Found associated trigger at /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/trigger0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.316: Already enabled sensor /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_accel_x_en
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.316: Already enabled sensor /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_accel_z_en
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.316: Already enabled sensor /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_timestamp_en
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.316: Already enabled sensor /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_accel_y_en
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.316: Trying to read 'in_accel_x_scale' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_x_scale: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Trying to read 'in_accel_scale' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Trying to read 'in_accel_x_offset' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_x_offset: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Trying to read 'in_accel_offset' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Got type for in_accel_x: is signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x4294967295, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Trying to read 'in_accel_z_scale' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_z_scale: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.317: Trying to read 'in_accel_scale' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_accel_z_offset' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_z_offset: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_accel_offset' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Got type for in_accel_z: is signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x4294967295, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_timestamp_scale' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_timestamp_scale: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_scale' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_scale: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_timestamp_offset' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_timestamp_offset: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_offset' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_offset: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Got type for in_timestamp: is signed: 1, bytes: 8, bits_used: 64, shift: 0, mask: 0x18446744073709551615, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_accel_y_scale' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_y_scale: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_accel_scale' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_accel_y_offset' (name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to read float from /sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_y_offset: No such file or directory
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Trying to read 'in_accel_offset' (generic name) from dir '/sys/devices/0018:03FE:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Got type for in_accel_y: is signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x4294967295, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Built channel array for in_accel_x: index: 0, is signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x4294967295, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Built channel array for in_accel_y: index: 1, is signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x4294967295, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Built channel array for in_accel_z: index: 2, is signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x4294967295, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Built channel array for in_timestamp: index: 3, is signed: 1, bytes: 8, bits_used: 64, shift: 0, mask: 0x18446744073709551615, be: 0
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: Failed to auto-detect mount matrix, falling back to identity
** (iio-sensor-proxy:5355): DEBUG: 20:53:48.318: No auto-detected location, falling back to display location

Also I found this discussion https://github.com/hadess/iio-sensor-proxy/issues/228, so I tried

$ cat '/sys/bus/iio/devices/iio:device'*/*raw*
0
0
0

and the output is the same irrespecitve of the orientation of my screen. So, where should I go from here?

Last edited by tikhon03 (2021-01-18 03:22:46)

Offline

#2 2021-05-28 17:33:48

arcccher
Member
Registered: 2021-05-28
Posts: 1

Re: No Automatic Rotation on a Lenovo Ideapad Flex 5

Found somewhere, you have to watch state

#!/bin/sh
# Auto rotate screen based on device orientation

# Receives input from monitor-sensor (part of iio-sensor-proxy package)
# Screen orientation and launcher location is set based upon accelerometer position
# Launcher will be on the left in a landscape orientation and on the bottom in a portrait orientation
# This script should be added to startup applications for the user

# touchscreen rotation has to set up too...


# Clear sensor.log so it doesn't get too long over time
> sensor.log

# Launch monitor-sensor and store the output in a variable that can be parsed by the rest of the script
monitor-sensor >> sensor.log 2>&1 &

# Parse output or monitor sensor to get the new orientation whenever the log file is updated
# Possibles are: normal, bottom-up, right-up, left-up
# Light data will be ignored
while inotifywait -e modify sensor.log; do

# Read the last line that was added to the file and get the orientation
    ORIENTATION=$(tail -n 1 sensor.log | grep 'orientation' | grep -oE '[^ ]+$')

# Set the actions to be taken for each possible orientation
    case "$ORIENTATION" in
	normal)
	    xrandr --output DSI1 --rotate normal && gsettings set com.canonical.Unity.Launcher launcher-position Left ;;

	bottom-up)
	    xrandr --output DSI1 --rotate inverted && gsettings set com.canonical.Unity.Launcher launcher-position Left ;;

	right-up)
	    xrandr --output DSI1 --rotate right && gsettings set com.canonical.Unity.Launcher launcher-position Bottom ;;

	left-up)
	    xrandr --output DSI1 --rotate left && gsettings set com.canonical.Unity.Launcher launcher-position Bottom ;;
    esac
done

Offline

Board footer

Powered by FluxBB