Open max-kazak opened 1 month ago
@max-kazak Thanks for opening this issue and explaining the bug you are facing.
Could you enable debug-logging in the extension's preferences and then try to replicate the bug? The logs from gnome-shell should show if something external is altering the state of display's orientation or the extension itself has some unexpected behaviour with power related events.
@shyzus, thank you for looking into this.
I've enabled debug-logging and captured the moment of the forced rotation with journalctl /usb/bin/gnome-shell -f
. Unfortunately, I'm not experienced with gnome enough to figure out the problem from the logs. The link to the logs is in the description at the end.
If there's a better way to capture the logs or if you can give me some ideas about what might be the problem, I can try to investigate it a bit further on my end.
Thanks again.
btw, I forgot to mention that the same thing happens after the system suspend, but it might be a different issue.
I was hoping with debug logging enabled every time your device would be rotated these lines would be executed which should be printing to the journal as part of gnome-shell see: https://github.com/shyzus/gnome-shell-extension-screen-autorotate/blob/532c7f442fdfba7595544d700128ed00be9f45b8/screen-rotate%40shyzus.github.io/extension.js#L203C1-L207C6
Strange that it doesn't print anything in your environment. Il try and see if I can replicate the issue you are running into on my end.
just now decided to try and replicate this with all extensions turned off except screen-autorotate. The same problem is present, but now logs don't show anything at all (I guess logs that I uploaded came from other extensions).
Also, when I rotate screen myself manually (autorotate doesn't work on my machine) I do see
Aug 09 11:55:19 fedora gnome-shell[3241]: sensor=0
Aug 09 11:55:19 fedora gnome-shell[3241]: offset=0
Aug 09 11:55:19 fedora gnome-shell[3241]: target=0
But nothing on power mode change.
Ah. So you don't use the autorotate feature just the manual rotate. that would 100% indicate that an external program is setting a different orientation. Which would also explain why the extension doesn't output any log when the power mode changes because there is no trigger for it to do anything.
I am currently working on setting up a test device with Fedora WS 40 and see if I can figure out what external program is causing the orientation change. Hopefully its something the extension can cleanly mitigate.
I have been trying to replicate this issue on my Lenovo C340-14API 2-in-1 laptop. But cannot replicate it.
When using manual or auto-rotate and then plugging in or plugging out the charging cable I observe no changes to the orientation.
The same lack of change applies to toggling a power profile in my case from balanced to power save and vice versa.
Having briefly looked over the code for power profiles in gnome-shell and that of hadess's project. I do not see any code that would directly cause the orientation to be changed when switching power profiles.
This leads me to believe this may be a specific issue with your environment and/or hardware.
Could you answer the following questions:
Lastly please reboot your machine. Log in and replicate the issue a few times then execute the following command:
sudo journalctl -b --no-hostname | fpaste
This should upload your full logs to paste.centos.org that will be removed after 24h. Please share the link in here so I can hopefully view it and see if there is something in the logs that would explain this bug.
After turning off all extensions and a restart, the power profile change no longer affects the orientation. Plugging/unplugging USB power cord is still a problem though.
Here's the captured logs: https://paste.centos.org/view/7db9e28d
I don't see any logs that would explain what is going on. At this point, I can accept that it's a device-specific issue.
Some details about the system:
btw, another thing I forgot to mention is that rotation in system display settings works just fine and isn't affected by any external events.
After turning off all extensions and a restart, the power profile change no longer affects the orientation. Plugging/unplugging USB power cord is still a problem though.
Here's the captured logs: https://paste.centos.org/view/7db9e28d
* line 3269 is when I rotated screen manually and then consequently unplugged the cable. * at 3280 I pressed the rotation button on the dashboard to reset the extension status (it didn't actually do a rotation since it's been rotated back to the landscape already on its own)
I don't see any logs that would explain what is going on. At this point, I can accept that it's a device-specific issue.
Some details about the system:
1. It's a new system, so I've only used the latest version 2. I'm running fedora WS 40 on Minisforum V3 3. it does have an accelerometer, but it's a known issue that it doesn't work on linux (probably missing driver)
In regards to point three: https://github.com/mudkipme/awesome-minisforum-v3/issues/2#issuecomment-2259419538
Seems there is a driver just some ACPI mapping shenanigans hopefully it will be resolved soon.
One thing that does jump out to me is line 3309:
Aug 09 14:20:00 kernel: usb 1-3: reset full-speed USB device number 4 using xhci_hcd
I presume this is when you remove your usb power plug. The first thing that came to mind being perhaps the USB device number 4 references there may be connected to accelerometer. A reset of the accelerometer may cause it to adjust orientation just once.
But that seems to be contradicted by your following comment of this issue not ocurring when using the system display settings.
I will continue looking into this perhaps its an extension issue after all.
@max-kazak I have done some experimentation. Which have lead me to two possible culprits.
Mutter itself is doing this for some unknown reason it may believe that the panel is directly managed by it. You can verify if that is so by using a utility like D-Spy:
The other is some external factor other than Mutter causing this. Normally only Mutter itself and SettingsDaemon on GNOME desktops interact with the DBus mutter DisplayConfig interface.
In case your machine reports the same value for the PanelOrientationManaged
property.
If you wish to further troubleshoot this, I can write a small script for you to execute on your machine that should be able to observe what service/program is interacting with the DBus Mutter DisplayConfig interface if at all.
Thank you for digging into this @shyzus. For clarity, this is not a critical issue to me, just an annoyance.
I tried installing D-Spy and it looks like it's the same setting as on your screenshot
I prefer to get to the bottom of this, so if you can write a script to diagnose this I'll try it out. But I understand if you'd rather close this issue, especially if it's not related to the extension.
Thank you.
Sorry for the sudden drop in communications. I have been sick for some time. Once I have the script available I will share it with you.
Describe the bug Whenever one of the following power-related events happens screen rotation resets back to default landscaping mode:
To Reproduce Steps to reproduce the behavior:
Expected behavior Chosen orientation should remain unchanged on power-related events
Screenshots Extension status shows portrait even after orientation reverting back to landscape:
Desktop (please complete the following information):
Relevant logs (please use a tool like
fpaste
or a service like pastebin.) patebin link