diff options
author | Pierre Equoy <pierre.equoy@canonical.com> | 2015-10-21 17:08:41 +0800 |
---|---|---|
committer | Pierre Equoy <pierre.equoy@canonical.com> | 2015-10-21 17:08:41 +0800 |
commit | 8c66c6ad60e1c675da288ae172b3ea610361dca5 (patch) | |
tree | b6860476f7f31ab20851c717f1fd5bbe40365c20 /bin | |
parent | 52add568d9fb9b6de265403fe71a6c91a8675314 (diff) |
Modify rotation test to use DBUS directly
On some NVidia cards, calling xrandr script to rotate the screen programatically may not work. Triggering screen rotation using DBUS directly is closer to what is done when the user manually modifies the rotation settings in the System Settings Display screen. We add a new script to handle this and modify the graphics rotation test job to use it.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rotation_test_using_dbus | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/bin/rotation_test_using_dbus b/bin/rotation_test_using_dbus new file mode 100755 index 0000000..aa19223 --- /dev/null +++ b/bin/rotation_test_using_dbus @@ -0,0 +1,47 @@ +#!/bin/sh +# +# rotation_test_using_dbus +# +# This script is used to trigger a main screen rotation directly from DBUS to +# simulate the way screen rotation is done when using System Settings screen. +# Indeed, when using xrandr command or Python lib, we sometimes have weird +# behaviours, specifically when used with NVidia cards with proprietary drivers. +# +# This file is part of Checkbox. +# +# Copyright 2015 Canonical Ltd. +# +# Authors: Pierre Equoy <pierre.equoy@canonical.com> +# +# Checkbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, +# as published by the Free Software Foundation. +# +# Checkbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Checkbox. If not, see <http://www.gnu.org/licenses/>. + + +rotate() { + dbus-send --session --print-reply --dest=org.gnome.SettingsDaemon /org/gnome/SettingsDaemon/XRANDR org.gnome.SettingsDaemon.XRANDR_2.RotateTo int32:$1 int64:0 > /dev/null 2>&1 +} + +# Rotate the screen in the following modes: +# - left +# - inverted +# - right +# - normal +for i in 2 4 8 1 +do + rotate $i + sleep 4 +done + +# Rotate one more time to "normal" so next time we logout/login, +# the screen will be set in normal mode. +rotate 1 + |