How is accelerometer-triggered screen rotation handled?

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
armnrd
Level 1
Level 1
Posts: 4
Joined: Sun Sep 26, 2021 2:10 pm

How is accelerometer-triggered screen rotation handled?

Post by armnrd »

I am running Cinnamon 5.0.5 on an HP Envy x360 convertible. Currently, screen rotation isn't fully functional. When I change the orientation of my laptop:
  • display orientation changes
  • touchscreen orientation changes
  • stylus input orientation doesn't change
The display and touch input are usable, but moving the stylus on the screen moves the on-screen pointer in the wrong direction.

This is a known bug and has been open for a while now: https://github.com/linuxmint/cinnamon-s ... issues/188

My question is, which part of Cinnamon handles screen rotation? Is it the cinnamon window manager executable? What I would like to do is tweak the code that rotates the input devices to make it work for my device. And hopefully the developers fix the bug in the official sources soon.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
SMG
Level 25
Level 25
Posts: 31805
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How is accelerometer-triggered screen rotation handled?

Post by SMG »

armnrd wrote: Sun Sep 26, 2021 2:45 pmThis is a known bug and has been open for a while now: https://github.com/linuxmint/cinnamon-s ... issues/188
Welcome to the forum, armnrd.

There are several workarounds mentioned in the posts in that link. Did none of them work for you?
Image
A woman typing on a laptop with LM20.3 Cinnamon.
PogoOnMint
Level 1
Level 1
Posts: 16
Joined: Sat Mar 20, 2021 7:01 am

Re: How is accelerometer-triggered screen rotation handled?

Post by PogoOnMint »

I had this problem on my ASUS Zenbook and, following the link given, I tried this solution https://github.com/linuxmint/cinnamon-s ... -488800780. It works very well. If I could find out how the rotation is sensed and call the script directly, it would be a perfect solution.

Peter.
armnrd
Level 1
Level 1
Posts: 4
Joined: Sun Sep 26, 2021 2:10 pm

Re: How is accelerometer-triggered screen rotation handled?

Post by armnrd »

SMG wrote: Tue Sep 28, 2021 6:09 pm
armnrd wrote: Sun Sep 26, 2021 2:45 pmThis is a known bug and has been open for a while now: https://github.com/linuxmint/cinnamon-s ... issues/188
Welcome to the forum, armnrd.

There are several workarounds mentioned in the posts in that link. Did none of them work for you?
Thanks, SMG. I am currently using a hacked-together solution from that link which works. But I have to run a script every time I rotate my laptop.

The laptop has two "screen" inputs: touchscreen and stylus. From what I understand, Cinnamon is using D-Bus events generated by iio-sensor-proxy to detect changes in orientation an then trying to rotate inputs.

For some reason, it rotates the touchscreen (libinput coordinate transformation matrix changes) but does not rotate the stylus input (transformation matrix doesn't change).

What I was looking for was some configuration file or bit of code I could change to make sure whatever is changing the coordinate transformation matrix rotates the stylus device as well.

For now, the solution from https://github.com/linuxmint/cinnamon-s ... issues/188 works, but it's dirty.
armnrd
Level 1
Level 1
Posts: 4
Joined: Sun Sep 26, 2021 2:10 pm

Re: How is accelerometer-triggered screen rotation handled?

Post by armnrd »

PogoOnMint wrote: Thu Oct 07, 2021 9:00 am I had this problem on my ASUS Zenbook and, following the link given, I tried this solution https://github.com/linuxmint/cinnamon-s ... -488800780. It works very well. If I could find out how the rotation is sensed and call the script directly, it would be a perfect solution.

Peter.
That's exactly what I am trying to figure out as well, Peter. For some reason, the touchscreen is being recognized as an input device that needs to be rotated, but the stylus isn't.

xinput outputs the following.

Code: Select all

⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ ELAN2514:00 04F3:23AE                   	id=8	[slave  pointer  (2)]
⎜   ↳ SYNA328F:01 06CB:CD50 Mouse             	id=10	[slave  pointer  (2)]
⎜   ↳ SYNA328F:01 06CB:CD50 Touchpad          	id=11	[slave  pointer  (2)]
⎜   ↳ MX Master 2S Mouse                      	id=16	[slave  pointer  (2)]
⎜   ↳ ELAN2514:00 04F3:23AE Eraser (0)        	id=19	[slave  pointer  (2)]
⎜   ↳ ELAN2514:00 04F3:23AE Pen (0)           	id=18	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Video Bus                               	id=6	[slave  keyboard (3)]
    ↳ Power Button                            	id=7	[slave  keyboard (3)]
    ↳ ELAN2514:00 04F3:23AE                   	id=9	[slave  keyboard (3)]
    ↳ HP Wireless hotkeys                     	id=13	[slave  keyboard (3)]
    ↳ HP WMI hotkeys                          	id=14	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=12	[slave  keyboard (3)]
    ↳ MX Master 2S Keyboard                   	id=15	[slave  keyboard (3)]
id=8 is the touchscreen and id=18 is the stylus. Cinnamon rotates 8, but doesn't rotate 18.

I am looking at these options. The last two options respond to orientation changes using D-Bus events, making them more efficient than running a script to poll for changes. I also remember seeing a solution that pipes the output of monitor-sensor (from iio-sensor-proxy) to a shell script. When the orientation changes, monitor-sensor outputs a new line and the script reads this to rotate inputs. But this is inefficient.
User avatar
SMG
Level 25
Level 25
Posts: 31805
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How is accelerometer-triggered screen rotation handled?

Post by SMG »

armnrd wrote: Sat Oct 09, 2021 2:20 pmWhat I was looking for was some configuration file or bit of code I could change to make sure whatever is changing the coordinate transformation matrix rotates the stylus device as well.
Are you seeing any errors related to the pen in /var/log/Xorg.0.log?
Image
A woman typing on a laptop with LM20.3 Cinnamon.
armnrd
Level 1
Level 1
Posts: 4
Joined: Sun Sep 26, 2021 2:10 pm

Re: How is accelerometer-triggered screen rotation handled?

Post by armnrd »

Code: Select all

[   230.508] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE (/dev/input/event4)
[   230.509] (**) ELAN2514:00 04F3:23AE: Applying InputClass "evdev touchscreen catchall"
[   230.509] (**) ELAN2514:00 04F3:23AE: Applying InputClass "libinput touchscreen catchall"
[   230.509] (II) Using input driver 'libinput' for 'ELAN2514:00 04F3:23AE'
[   230.509] (**) ELAN2514:00 04F3:23AE: always reports core events
[   230.509] (**) Option "Device" "/dev/input/event4"
[   230.509] (**) Option "_source" "server/udev"
[   230.510] (II) event4  - ELAN2514:00 04F3:23AE: is tagged by udev as: Touchscreen
[   230.510] (II) event4  - ELAN2514:00 04F3:23AE: device is a touch device
[   230.510] (II) event4  - ELAN2514:00 04F3:23AE: device removed
[   230.524] (**) Option "config_info" "udev:/sys/devices/platform/AMDI0010:00/i2c-0/i2c-ELAN2514:00/0018:04F3:23AE.0004/input/input13/event4"
[   230.524] (II) XINPUT: Adding extended input device "ELAN2514:00 04F3:23AE" (type: TOUCHSCREEN, id 8)
[   230.524] (**) Option "AccelerationScheme" "none"
[   230.524] (**) ELAN2514:00 04F3:23AE: (accel) selected scheme none/0
[   230.524] (**) ELAN2514:00 04F3:23AE: (accel) acceleration factor: 2.000
[   230.524] (**) ELAN2514:00 04F3:23AE: (accel) acceleration threshold: 4
[   230.526] (II) event4  - ELAN2514:00 04F3:23AE: is tagged by udev as: Touchscreen
[   230.526] (II) event4  - ELAN2514:00 04F3:23AE: device is a touch device
[   230.527] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE (/dev/input/mouse0)
[   230.527] (II) No input driver specified, ignoring this device.
[   230.527] (II) This device may have been added with another device file.
[   230.527] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE UNKNOWN (/dev/input/event5)
[   230.527] (II) No input driver specified, ignoring this device.
[   230.527] (II) This device may have been added with another device file.
[   230.528] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE UNKNOWN (/dev/input/event6)
[   230.528] (II) No input driver specified, ignoring this device.
[   230.528] (II) This device may have been added with another device file.
[   230.529] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE (/dev/input/event7)
[   230.529] (**) ELAN2514:00 04F3:23AE: Applying InputClass "evdev tablet catchall"
[   230.529] (**) ELAN2514:00 04F3:23AE: Applying InputClass "libinput tablet catchall"
[   230.529] (II) Using input driver 'libinput' for 'ELAN2514:00 04F3:23AE'
[   230.529] (**) ELAN2514:00 04F3:23AE: always reports core events
[   230.529] (**) Option "Device" "/dev/input/event7"
[   230.529] (**) Option "_source" "server/udev"
[   230.530] (II) event7  - ELAN2514:00 04F3:23AE: is tagged by udev as: Tablet
[   230.556] (II) event7  - ELAN2514:00 04F3:23AE: tablet 'ELAN2514:00 04F3:23AE' unknown to libwacom
[   230.556] (II) event7  - ELAN2514:00 04F3:23AE: device is a tablet
[   230.557] (II) event7  - ELAN2514:00 04F3:23AE: device removed
[   230.578] (**) Option "config_info" "udev:/sys/devices/platform/AMDI0010:00/i2c-0/i2c-ELAN2514:00/0018:04F3:23AE.0004/input/input16/event7"
[   230.578] (II) XINPUT: Adding extended input device "ELAN2514:00 04F3:23AE" (type: TABLET, id 9)
[   230.579] (II) event7  - ELAN2514:00 04F3:23AE: is tagged by udev as: Tablet
[   230.580] (II) event7  - ELAN2514:00 04F3:23AE: tablet 'ELAN2514:00 04F3:23AE' unknown to libwacom
[   230.580] (II) event7  - ELAN2514:00 04F3:23AE: device is a tablet
[   230.581] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE (/dev/input/mouse1)
[   230.581] (II) No input driver specified, ignoring this device.
[   230.581] (II) This device may have been added with another device file.
No errors, but it looks like Xorg adds the touchscreen and the pen, and then ignores them. Do you see what might be going on?
Both devices are available under /dev/input. The touchscreen is /dev/input/event4 and the pen is /dev/input/event/7. I can probe both of them using evtest.
User avatar
SMG
Level 25
Level 25
Posts: 31805
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How is accelerometer-triggered screen rotation handled?

Post by SMG »

armnrd wrote: Sun Oct 10, 2021 2:00 amBoth devices are available under /dev/input. The touchscreen is /dev/input/event4 and the pen is /dev/input/event/7.
You checked the input number for this particular boot cycle?

The reason I ask is because I do not necessarily see the pen in the code you listed. (However, I am not an expert in touchscreen technology, so I could be wrong.) While you mention evtest, as I see in this output it appears libinput is doing the "driving" and not evdev.

Code: Select all

[   230.508] (II) config/udev: Adding input device ELAN2514:00 04F3:23AE (/dev/input/event4)
[   230.509] (**) ELAN2514:00 04F3:23AE: Applying InputClass "evdev touchscreen catchall"
[   230.509] (**) ELAN2514:00 04F3:23AE: Applying InputClass "libinput touchscreen catchall"
[   230.509] (II) Using input driver 'libinput' for 'ELAN2514:00 04F3:23AE'
Have you checked the below file on your install to see what is in it?

Code: Select all

[   230.524] (**) Option "config_info" "udev:/sys/devices/platform/AMDI0010:00/i2c-0/i2c-ELAN2514:00/0018:04F3:23AE.0004/input/input13/event4"
armnrd wrote: Sun Oct 10, 2021 2:00 amNo errors, but it looks like Xorg adds the touchscreen and the pen, and then ignores them.
Where do you think the touchscreen is being ignored? Look at the messages in the order listed. Some of the items are saying to ignore because another driver already has control of them.

Remember that your pen is working. It is just not rotating the correct direction. The fact the pen does work means there is a driver for it, so it is not being ignored.

I ended up going down a rabbit hole today in trying to determine what might be happening. There are several different drivers which might have control and I'm used to working with the Wacom files (libwacom). I am not sure if they are being used in this case, so this is new territory for me. Plus I do not have this hardware.

I did find this accelerometer + screen rotation on non-touchscreen laptop? which is a way to turn off the touchscreen and the answers discuss the iio-sensor-proxy and Cinnamon. I do not know if Cinnamon's control mechanism has changed since then.

Here is some information on libinput and graphics tablet support.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Locked

Return to “Cinnamon”