Xranr & KDE display rotation problems

I have a Lenovo X61 tablet running Opensuse 11.4 x86_64 with KDE4.5

I’m trying to control the screen rotation through personal settings -> Display -> Orientation

Problem #1: It rotates from landscape orientation to the correct portrait orientation but after rotating back to landscape the top half of the screen is black and may windows (including the personal settings window) aren’t accepting input anymore. For some reason Klaunch accepts input even though it isn’t drawn, which is how I rebooted the machine. This sort of behavior is actually progress from when I tried it a few years ago. The X61 has the Intel 965 graphics, and, OpenGl is enabled. It didn’t used to get even this far because of a development issue with Intel integrated graphics and xrandr. So, before I go playing around making calls to xrandr directly (which is what I assume the control panel is doing), I’d like to know if there is a simple fix.

Problem #2: Because it’s a tablet, the pen/touch input has to rotate too. That doesn’t happen. The pen is still in landscape input. The way this used to be fixed is by editing xorg.conf. Did they just forget to set that up? What configuration files does this control panel touch? Linux thinks my pen input is a wacom serial tablet, so, it should be fairly common.

Can an administrator please fix the typo in the title ( Xranr -> XRandR)?

It looks like xsetwacom is broken.

xsetwacom set --stylus Rotate ccw

says that it can’t find device stylus. This is the usual way of rotating the tablet, so, I assume the configure display panel is also calling this at some point.

There is some mention in the wacom configuration file that everything is falling through to the evdev driver. The tablet pen seems to work fine, but, it can’t be rotated or controlled in the usual way.

Does anyone know where the new controls for the tablet input are being kept?

Apparently others have had problems. I’m very tempted to try Robert Schweikert’s solution from 11.3 openSUSE Lizards and just recompile everything into the kernel. Obviously this is a desperate move. Why doesn’t the default kernel I’m running have wacom in it? Is there some sort of other bug.in XOrg (by design) that can fix this even more deftly. It’s not that it isn’t controlling the tablet. It’s certainly receiving input but not orienting it.

I appeal for a hearing before the great lord of suse-tablets!!!

One part of this mystery is solved. The usual examples of xsetwacom use no longer work. See The following now works:

xsetwacom --set “Serial Wacom Tablet stylus” Rotate “ccw”

xsetwacom --set “Serial Wacom Tablet stylus” Rotate “none”

Everything needs to be in quotes, and, the full device name needs to be used. You probably need a similar line for the eraser device. I still don’t know why the KDE screen rotation isn’t rotating the tablet, and, XRandR is still quite broken when rotating the screen back to landscape, but, at least that’s one thing solved.

The KDE display widget rotation is broken. Don’t use it on the X61. I’ve submitted a bug report to KDE.

The following script works, but, Opensuse has “fixed” the tablet buttons and events so well that none of the old ways of controlling tablet buttons & events works anymore. Here’s a script that make everything work fine, but, I just can’t invoke it with tablet button presses or the tablet position. I’m going to start an independent thread to see if anyone here can solve this little mystery.

This script was ripped from someone named dmg & fixed to work with the bastardization that is now xsetwacom & xrandr. You can rotate like “./x61_rotate 0” for landscpe “./x61_rotate 3” for the normal tablet position and “./x61_rotate -” or “+” to rotate stepwise. It works on KDE 4.6.3 and doesn’t crash. Make sure that xsetwacom & xrandr are in the appropriate places vis-a-vis this script. The keycodes section is still borked. If anyone can fix it, feel free.

Save as x61_rotate; chmod u+x ./x61_rotate
#!/usr/bin/perl

use strict;

my $wacomDevice = ‘“Serial Wacom Tablet stylus”’;

my %rotation = (
“normal” => 0,
“right” => 1,
“inverted” => 2,
“left” => 3,
);

my @rotationInv = (
“normal”,
“right”,
“inverted”,
“left”
);

#98 => up
#100=> left
#103 =>right
#100=>down

Set the thumb-toggle on tablet display depending on orientation

my @keycodesComplete = (
“0x71 103 0x6f 108 0x6e 105 0x6d 106”,
“0x71 105 0x6f 106 0x6e 108 0x6d 103”,
“0x71 108 0x6f 103 0x6e 106 0x6d 105”,
“0x71 106 0x6f 105 0x6e 103 0x6d 108”);

my @keycodes = (‘111’, ‘113’,‘116’,‘114’);
my @mapKeys = (‘Up’, ‘Left’, ‘Down’, ‘Right’);

Translate current rotation into the rotation values of this script

my $current = Find_Display_Rotation();

my @wacom = (’“NONE”’, ‘“CW”’, ‘“HALF”’, ‘“CCW”’);

Get input

my $next = $ARGV[0];

The + is rotation clockwise, - rotation counterclockwise

The 0-3 correspond to %rotation & @wacom arrays

if ($next >= 0 || $next <= 3) {
$current = $next;
}
elsif ($next eq “-”) {
$current --;
} elsif ($next eq “+” ) {
$current ++;
} elsif ($next eq “”) {
$current ++;
} else {
$current = $next;
}
$current %=4;
print "Setting to : $current
";

die “invalid current $current]” unless $current >= 0 and $current <4;

set xrandr

print "Setting $rotationInv$current]
";
print xrandr -display :0.0 -o $rotationInv$current];
#print xrandr -display :0.0 --output LVDS --pos 0x0 ;
#print “xsetwacom --set $wacomDevice Rotate $wacom$current]”;
print xsetwacom --set $wacomDevice Rotate $wacom$current];
#print xmodmap -e 'keycode 146 = Menu';
#print sawfish-client --display :0.0 -e '(dmg-move-current-window-inside)';
#Set_Wacom_Tablet();

This command would set the thumb toggle buttons based on rotation

but it seems to be working out of the box in Opensuse KDE

The only key that needs to be set it the rotate button.

set_keys($current);

exit;

sub Set_Wacom_Tablet
{
my ($currentRotation) = @_;
# x1, y1, x2, y2
my @coor = ( -27, 47, 18509, 24701);
my @where = (“topx”, “topy”, “bottomx”, “bottomy”);
my $command = “/usr/bin/xsetwacom”;

if ($current %2 == 1) {
    for my $i (0..3) {
        print `$command set eraser $where$i] '$coor$i]'`;
        print `$command set stylus $where$i] '$coor$i]'`;
    }
}

}

sub Find_Display_Rotation
{
my $mode = /usr/bin/xrandr --verbose| grep LVDS;

if ($mode =~ / +([a-z]+) +\(/) {
} else {
    print STDERR "UNable to detect mode $mode

";
die;
}
die "($mode) ($1) " if ($1 ne “right” and
$1 ne “left” and
$1 ne “inverted” and
$1 ne “normal”);

return $rotation{$1};

}

sub set_keys
{
my ($rotation) = @_;
my ($a) = $keycodesComplete$rotation];
print /bin/setkeycodes $a;

}

Unfortunately we can not change the title without breaking the thread for our NNTP users. Sorry.

Thnx oldcpu. I’m still working this problem.