I've recently got a non-touchscreen hp laptop with a hdd accelerometer. After upgrading it to Debian testing I noticed that whenever I tilt my laptop upwards past +45 deg, the screen rotates upside down. The opposite happens when I tilt my laptop -45 deg. To clarify, I am facing my laptop with the screen facing me with the keyboard parallel to the ground. The screen also rotates whenever I tilt my laptop clockwise or counterclockwise.

Is there a file where I can edit to change the screen's rotational direction?

The accelerometer in /proc/bus/input/devices shows this:

    I: Bus=0019 Vendor=0000 Product=0000 Version=0000
    N: Name="ST LIS3LV02DL Accelerometer"
    P: Phys=lis3lv02d/input0
    S: Sysfs=/devices/platform/lis3lv02d/input/input7
    U: Uniq=
    H: Handlers=event6 js0
    B: PROP=0
    B: EV=9
    B: ABS=7   


I found that watch -n 1 'cat /sys/devices/platform/lis3lv02d/position' is similar to what is found with the command below. Except it just displays coordinates such as (18,18,1098).

evtest /dev/input/event6 shows this:

    william@wksp0:~/Downloads$ sudo evtest /dev/input/event6
    Input driver version is 1.0.1
    Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
    Input device name: "ST LIS3LV02DL Accelerometer"
    Supported events:
      Event type 0 (EV_SYN)
      Event type 3 (EV_ABS)
        Event code 0 (ABS_X)
          Value     20
          Min    -2304
          Max     2304
          Fuzz      18
          Flat      18
        Event code 1 (ABS_Y)
          Value    -38
          Min    -2304
          Max     2304
          Fuzz      18
          Flat      18
        Event code 2 (ABS_Z)
          Value   1105
          Min    -2304
          Max     2304
          Fuzz      18
          Flat      18
    Testing ... (interrupt to exit)
    Event: time 1483747056.088195, type 3 (EV_ABS), code 1 (ABS_Y), value -23
    Event: time 1483747056.088195, -------------- SYN_REPORT ------------
    Event: time 1483747056.124189, type 3 (EV_ABS), code 0 (ABS_X), value 20
    Event: time 1483747056.124189, type 3 (EV_ABS), code 1 (ABS_Y), value -38
    Event: time 1483747056.124189, type 3 (EV_ABS), code 2 (ABS_Z), value 1105
    Event: time 1483747056.124189, -------------- SYN_REPORT ------------
    Event: time 1483747056.210931, type 3 (EV_ABS), code 0 (ABS_X), value -18
    Event: time 1483747056.210931, type 3 (EV_ABS), code 1 (ABS_Y), value -28
    Event: time 1483747056.210931, type 3 (EV_ABS), code 2 (ABS_Z), value 1107...


After some googling, I've come across this which lead me to some interesting files that have little to no help on this. :P

  • note: I am not looking to disable or blacklist the accelerometer. I just want the screen to rotate the other direction
    – MrWm
    Jan 6, 2017 at 2:30
  • First I'd try to find out what is causing the behaviour: BIOS, some system program, .... Does xrandr show a rotated screen if the screen is rotated? What kind of events do you get for``evtest /dev/input/event6`? (assuming it's event6 on every boot, check the path).
    – dirkt
    Jan 6, 2017 at 6:26
  • yup, xrandr shows that the screen is rotated when the event happens. From what I can tell, it's not a BIOS thing but either a kernel thing or a program thing.
    – MrWm
    Jan 6, 2017 at 23:59
  • Are you using gnome 3.18 or 3.20 in combination with iio-sensor-proxy (comes to gnome by default)? Jan 7, 2017 at 0:17
  • I'm using cinnamon and yes, I also have iio-sensor-proxy installed.
    – MrWm
    Jan 7, 2017 at 0:22

3 Answers 3


The whole story you mention is actually a kind of bug in iio-sensor-proxy or in your DE code who makes use of iio-sensor-proxy info.

Is not bios or kernel that does the rotation but the marriage between iio-sensor-proxy and your Desktop Environment.

DE like Gnome (and Cinnamon as turns out) does screen auto rotate based on the data provided by iio-sensor-proxy in dbus.

You can try to remove/purge iio-sensor-proxy and screen rotation will go away completely.

It is not clear if this is a iio-sensor-proxy bug or a Cinnamon bug. It could be iio-sensor-proxy that is reading in a wrong way your accelerometer data or could be Cinnamon who even if it receives correct data by sensor-proxy, rotates the screen wrongly.

You can clarify this issue by running monitor-sensor in root terminal. This utility comes with iio-sensor-proxy package and displays in terminal the current state of accelerometer / current screen orientation.
If orientation is correctly displayed by monitor-sensor then it is a Cinnamon bug. But i'm 90% sure that this is an iio-sensor-proxy bug and you should report it to the developer.

PS: It had been also mentioned that sensor-proxy had been working well with kernels up to version 4.7 but had some problems with kernel 4.8 and above. You could try to install an older kernel (i.e 4.7) for testing.

If monitor-sensor reports correctly the orientation and this is a Cinnamon bug, as a workaround you could disable Cinnamon auto screen rotation feature and run a kind of shell script that will make the correct rotation based on the data of monitor-sensor.

PS: Gnome gives the option to completely disable auto screen rotation, i'm not sure if Cinnamon has this option too.

In XFCE that iio-sensor-proxy is installed but XFCE devs are not performing auto screen rotation (yet) we apply this script to have auto screen rotation: https://linuxappfinder.com/blog/auto_screen_rotation_in_ubuntu

PS: Improved version for touch screens with transformation matrix: https://github.com/gevasiliou/PythonTests/blob/master/autorotate.sh

Update for future reference / future "google searches"

As advised in comments, by running monitor-sensor in a root terminal and observing the messages provided by iio-sensor-proxy it proved that iio-sensor-proxy is correctly understood the real screen orientation.
As a result this seems to be a Cinnamon bug that though it gets correct info by iio-sensor-proxy is rotating the screen wrongly.

You can disable the Cinnamon auto rotation feature and try the auto-rotation script as advised above (https://linuxappfinder.com/blog/auto_screen_rotation_in_ubuntu).

To disable Cinnamon internal autorotation you need to apply settings set org.cinnamon.settings-daemon.plugins.orientation active false as advised in OP's comment.

  • I see that monitor-sensor has the right orientations. Now all I just need to figure out is how to disable the auto screen rotation on this. :P
    – MrWm
    Jan 7, 2017 at 7:17
  • finally found it: settings set org.cinnamon.settings-daemon.plugins.orientation active false
    – MrWm
    Jan 10, 2017 at 7:59
  • @MrWm Good job! Does it work ? I mean does it disables auto rotation as expected? PS: If you like you could file this bug to Cinnamon people to have this issue fixed. It is very nice that Desktop Environments start to support auto screen rotation (some months ago was only Gnome3) , so it is important to be made right! Jan 10, 2017 at 8:59
  • yep, it disables the screen rotation. It's basically the same command used in gnome except the "gnome" is swapped with "cinnamon". :)
    – MrWm
    Jan 11, 2017 at 23:55
  • great answer! buggy issue! I have 'iio-sensor-proxy' reportng the wrong orientation on fedora 30, kernel 5.3.15 ... -_-
    – scjorge
    Dec 13, 2019 at 23:46

Using dconf-editor, change the key value for


to False.

This is identical to the command line solution presented above, but uses the gui tool dconf-editor.


Sorry if I'm misunderstanding something, but I could set the orientation matrix in udev by putting

# /etc/udev/hwdb.d/61-sensor-local.hwdb
 ACCEL_MOUNT_MATRIX=0, -1, 0;-1, 0, 0; 0, 0, 1

then I ran

sudo systemd-hwdb update
sudo udevadm trigger

and now the orientation works for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .