Closed tomidomi closed 8 years ago
Hi @tomidomi. Thanks for your bug report; I hope I can help.
Will you please provide the following information?
thinkpad-scripts
did you use before upgrading to 4.7.1? You can determine this by looking at the output of grep thinkpad-scripts /var/log/dpkg.log
.thinkpad-rotate
directly (e.g. thinkpad-rotate cw
)?xinput
directly? (See this comment for the commands, making sure to use the id of Wacom ISDv4 E6 Pen stylus
provided by the output of xinput
.)xsetwacom
directly (e.g. xsetwacom set 12 Rotate none
or xsetwacom set 12 Rotate cw
, making sure to use the id of Wacom ISDv4 E6 Pen stylus
provided by the output of xinput
)?thinkpad-rotate -vv --force-direction cw
and thinkpad-rotate -vv --force-direction normal
?~/.config/thinkpad-scripts/config.ini
) and any custom hooks you may have (~/.config/thinkpad-scripts/hooks/*
).@martin-ueding This sounds very similar to #112.
1) Unfortunately I cannot do that. It is pretty strange but there is no information about installation of thinkpad-scripts in any of dpkg.log.?.gz file. I have found deb file in /var/cache/apt/archives
-rw-r--r-- 1 root root 32206 lis 12 20:27 thinkpad-scripts_4.7.1-0ubuntu2_all.deb
So I know when the file was downloaded. Around the same date dpkg.log.5.gz contains the following information
2015-11-12 10:27:56 status half-configured wpasupplicant:amd64 2.1-0ubuntu1.4
2015-11-12 10:27:56 status installed wpasupplicant:amd64 2.1-0ubuntu1.4
2015-11-13 09:17:32 startup archives unpack
2015-11-13 09:17:39 upgrade libk5crypto3:amd64 1.12+dfsg-2ubuntu5.1 1.12+dfsg-2ubuntu5.2
So there is no information about installation of thinkpad-script. However package is installed as given by dpkg --get-selections | grep thinkpad
thinkpad-scripts install
2) Probably before I updated thinkpad-scripts I done system update to Ubuntu 15.10. I don't remember the earlier version. But for sure this was not update from 15.04 but from some older version. So the update was through two or more versions and was harsh. It failed in the first attempt. I had to continue after reboot and in fact I had to do some tricks with package conflicts. So there were plenty of updated packages.
3) No the stylus does not rotate (or not rotate correctly) in any case except but back to normal. As I said before the finger touch rotates correctly.
4) Yes the stylus input rotates. But if I do ( thinkpad-rotate cw ) and then ( xinput set-prop 12 "Coordinate Transformation Matrix" 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
) the stylus position does not match the cursor position. If I call back to normal ( xinput set-prop 12 "Coordinate Transformation Matrix" 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0
) the stylus works OK.
So to make the stylus to work correctly for rotated screen I have to do
thinkpad-rotate cw
xinput set-prop 12 "Coordinate Transformation Matrix" 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0
So the screen is rotated and the stylus is not. The touch with id=13 and the eraser id=14 work without any tricks. My guess is that none of these devices should be rotated but the script rotates only the first one. In may case it is the stylus id=12 and this one is broken and have to be restored to normal.
5) Yes, the stylus rotates.
6)
thinkpad-rotate -vv --force-direction cw
tps.config DEBUG ----------------------------------
tps.config DEBUG Program was started with arguments: ['/usr/bin/thinkpad-rotate', '-vv', '--force-direction', 'cw']
tps.config DEBUG Default configfile is /usr/lib/python3/dist-packages/tps/default.ini.
tps.screen DEBUG subprocess “xrandr -q --verbose”
tps DEBUG Converted “right” to “Direction(xrandr='right', subpixel='vbgr', physically_closed=True, rot_mat=[0, 1, 0, -1, 0, 1, 0, 0, 1])”.
tps.screen INFO Current rotation is “Direction(xrandr='right', subpixel='vbgr', physically_closed=True, rot_mat=[0, 1, 0, -1, 0, 1, 0, 0, 1])”.
tps DEBUG Converted “cw” to “Direction(xrandr='right', subpixel='vbgr', physically_closed=True, rot_mat=[0, 1, 0, -1, 0, 1, 0, 0, 1])”.
tps.rotate INFO User chose to set to Direction(xrandr='right', subpixel='vbgr', physically_closed=True, rot_mat=[0, 1, 0, -1, 0, 1, 0, 0, 1])
tps DEBUG Command “/home/tomek/.config/thinkpad-scripts/hooks/prerotate” not found.
tps.screen DEBUG subprocess “xrandr --output LVDS1 --rotate right”
tps.screen DEBUG subprocess “xrandr -q”
tps.input DEBUG Translation and scaling matrix: [[ 1.00000 0.00000 0.00000 ][ 0.00000 1.00000 0.00000 ][ 0.00000 0.00000 1.00000 ]]
tps.input DEBUG Complete transformation matrix: [[ 0.00000 1.00000 0.00000 ][ -1.00000 0.00000 1.00000 ][ 0.00000 0.00000 1.00000 ]]
tps.config DEBUG Default configfile is /usr/lib/python3/dist-packages/tps/default.ini.
tps.input DEBUG Using “Wacom ISD.*id=(\d+)” as regex to find Wacom devices.
tps.input DEBUG subprocess “xinput”
tps.input DEBUG subprocess “xinput set-prop 12 Coordinate Transformation Matrix 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0”
tps.input DEBUG subprocess “xinput set-prop 13 Coordinate Transformation Matrix 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0”
tps.input DEBUG subprocess “xinput set-prop 18 Coordinate Transformation Matrix 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0”
tps.screen DEBUG subprocess “xrandr”
tps DEBUG Command “xfconf-query” not found.
tps DEBUG Command “gsettings” found.
tps.screen DEBUG subprocess “gsettings list-schemas”
tps.screen DEBUG subprocess “gsettings set org.gnome.settings-daemon.plugins.xsettings rgba-order vbgr”
tps.vkeyboard DEBUG subprocess “pgrep onboard”
tps.input DEBUG subprocess “xinput list”
tps.input DEBUG subprocess “xinput set-prop 16 Device Enabled 0”
tps.input DEBUG subprocess “xinput list”
tps.input DEBUG subprocess “xinput set-prop 15 Device Enabled 0”
tps DEBUG Command “/home/tomek/.config/thinkpad-scripts/hooks/postrotate” not found.
thinkpad-rotate -vv --force-direction normal
tps.config DEBUG ----------------------------------
tps.config DEBUG Program was started with arguments: ['/usr/bin/thinkpad-rotate', '-vv', '--force-direction', 'normal']
tps.config DEBUG Default configfile is /usr/lib/python3/dist-packages/tps/default.ini.
tps.screen DEBUG subprocess “xrandr -q --verbose”
tps DEBUG Converted “normal” to “Direction(xrandr='normal', subpixel='rgb', physically_closed=False, rot_mat=[1, 0, 0, 0, 1, 0, 0, 0, 1])”.
tps.screen INFO Current rotation is “Direction(xrandr='normal', subpixel='rgb', physically_closed=False, rot_mat=[1, 0, 0, 0, 1, 0, 0, 0, 1])”.
tps DEBUG Converted “normal” to “Direction(xrandr='normal', subpixel='rgb', physically_closed=False, rot_mat=[1, 0, 0, 0, 1, 0, 0, 0, 1])”.
tps.rotate INFO User chose to set to Direction(xrandr='normal', subpixel='rgb', physically_closed=False, rot_mat=[1, 0, 0, 0, 1, 0, 0, 0, 1])
tps DEBUG Command “/home/tomek/.config/thinkpad-scripts/hooks/prerotate” not found.
tps.screen DEBUG subprocess “xrandr --output LVDS1 --rotate normal”
tps.screen DEBUG subprocess “xrandr -q”
tps.input DEBUG Translation and scaling matrix: [[ 1.00000 0.00000 0.00000 ][ 0.00000 1.00000 0.00000 ][ 0.00000 0.00000 1.00000 ]]
tps.input DEBUG Complete transformation matrix: [[ 1.00000 0.00000 0.00000 ][ 0.00000 1.00000 0.00000 ][ 0.00000 0.00000 1.00000 ]]
tps.config DEBUG Default configfile is /usr/lib/python3/dist-packages/tps/default.ini.
tps.input DEBUG Using “Wacom ISD.*id=(\d+)” as regex to find Wacom devices.
tps.input DEBUG subprocess “xinput”
tps.input DEBUG subprocess “xinput set-prop 12 Coordinate Transformation Matrix 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0”
tps.input DEBUG subprocess “xinput set-prop 13 Coordinate Transformation Matrix 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0”
tps.input DEBUG subprocess “xinput set-prop 18 Coordinate Transformation Matrix 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0”
tps.screen DEBUG subprocess “xrandr”
tps DEBUG Command “xfconf-query” not found.
tps DEBUG Command “gsettings” found.
tps.screen DEBUG subprocess “gsettings list-schemas”
tps.screen DEBUG subprocess “gsettings set org.gnome.settings-daemon.plugins.xsettings rgba-order rgb”
tps.vkeyboard DEBUG subprocess “pgrep onboard”
tps.input DEBUG subprocess “xinput list”
tps.input DEBUG subprocess “xinput set-prop 16 Device Enabled 1”
tps.input DEBUG subprocess “xinput list”
tps.input DEBUG subprocess “xinput set-prop 15 Device Enabled 1”
tps DEBUG Command “/home/tomek/.config/thinkpad-scripts/hooks/postrotate” not found.
7)
~/.config/thinkpad-scripts/config.ini
[unity]
toggle_launcher = false
[vkeyboard]
program = onboard
[input]
touchscreen_device = Wacom ISDv4 E6 Pen stylus
I do not have any hooks.
8) Finally my solution for now is to run two commands:
thinkpad-rotate cw
xsetwacom set 12 Rotate none
This does the job for me.
Thanks for the information; your symptoms sound very similar to those reported by others. I'm glad that you have a temporary workaround.
Multiple people have reported issues when upgrading to Ubuntu 15.10. I'll try reproducing the issue this weekend by running Ubuntu 15.10 off an external HDD to see if I can narrow down the cause.
I fear that I broke Ubuntu 15.10 by accident. Now Fedora is installed on the machine, I cannot check Ubuntu right now.
The gist is that the xinput
rotation is broken but xsetwacom
is working? We only abandoned xsetwacom
because there were some non-Wacom input devices around, right? So if we just put the xsetwacom
back in if it is supported, that should do the trick.
I am just a bit curious as the stuff works on my ThinkPad X220 on Fedora …
I just found my comment where I wrote
I now removed all
xsetwacom
from the codebase, I hope that I did not break anything.
Perhaps we should put that back into the codebase and use xsetwacom
when it is installed and the transformation matrix if not. Perhaps the “is installed” test is too brittle and we would have to check whether the string Wacom
appears in the description of the input device.
Reading through the related bug reports, #112 and #107, I really have the impression that we should go back to xsetwacom
if it is supported.
I installed Ubuntu 15.10 on an external HDD and was able to reproduce the problem. Here's what's happening:
Coordinate Transformation Matrix
and Wacom Rotation
. Both properties affect the resulting orientation of the Wacom device.thinkpad-rotate
calls xrandr
to rotate the display, something sets Wacom Rotation
to the corresponding rotation of the display. (I'm not sure what is setting the Wacom Rotation
property. I doubt it's xrandr
itself; it's probably a feature of Unity or something.)thinkpad-rotate
sets the Coordinate Transformation Matrix
property.Note that the Wacom Rotation
property is changed only for the stylus and eraser, but not the touch device. That's why the touch device ends up being rotated properly while the stylus and eraser have issues.
So, we can either (1) stop using Coordinate Transformation Matrix
and use Wacom Rotation
instead, or (2) set Wacom Rotation
to 0
on every rotation (so it doesn't conflict with the new Coordinate Transformation Matrix
). In other words, solution (2) is to call
xinput set-prop <id> "Wacom Rotation" 0
for every Wacom device id whenever thinkpad-rotate
is called. (Just make sure this is done after calling xrandr
. I'm not sure if there would be a race condition with whatever is setting the Wacom Rotation
property when xrandr
is called; that needs more investigation.)
By the way, xsetwacom
changes the Wacom Rotation
property, which is why calling xsetwacom set 10 Rotate none
after calling thinkpad-rotate
was a workaround for @tomidomi.
Okay, then we can just add this additional line to the code, right? As this only happens on Ubuntu, I would assume that they have patched xrandr
somehow to incorporate xsetwacom
into the mix. Adding this single line is not a big deal and should close three bugs. I try to do this.
@jturner314: I assume you still have the Ubuntu installation? Could you check out the branch feature/xsetwacom-reset
and try to rotate with say python3 -m tps.rotate flip -vv
? It should print the following:
tps.input INFO Mapping and rotating all input devices.
tps.input DEBUG subprocess “xinput set-prop 10 Coordinate Transformation Matrix -1.0 0.0 1.0 0.0 -1.0 1.0 0.0 0.0 1.0”
tps.input DEBUG subprocess “xinput set-prop 16 Coordinate Transformation Matrix -1.0 0.0 1.0 0.0 -1.0 1.0 0.0 0.0 1.0”
tps.input DEBUG subprocess “xinput set-prop 11 Coordinate Transformation Matrix -1.0 0.0 1.0 0.0 -1.0 1.0 0.0 0.0 1.0”
tps.input INFO Resetting “Wacom Rotation” property.
tps.input DEBUG subprocess “xinput --list-props 10”
tps.input DEBUG subprocess “xinput set-prop 10 Wacom Rotation 0”
tps.input DEBUG subprocess “xinput --list-props 16”
tps.input DEBUG subprocess “xinput set-prop 16 Wacom Rotation 0”
tps.input DEBUG subprocess “xinput --list-props 11”
It does not seem to break it on Fedora. If that fixes it on Ubuntu, we could push out the update via the Ubuntu PPA.
If somebody of the bug reporters here want to try out the git branch, that would be awesome as well!
Calling python3 -m tps.rotate flip -vv
on the feature/xsetwacom-reset
branch works great on Ubuntu 15.10 (everything rotates correctly), and the output is what you posted above. (I also tried a few other cases.) Additionally, it does not cause any problems on my Arch Linux system.
The feature/xsetwacom-reset
branch looks ready to merge. A couple of nitpicks that you may want to change:
wacom_rotate_reset
: "with out rotation here" should be "with our rotation here"has_device_property
for other things in the future, it may be helpful to make the check a little more robust against partial matches or property values containing property names. (It's a tradeoff between code simplicity and robustness.) Something like this would match only against full property names:def has_device_property(device, property_):
'''
Checks whether a given device supports a property.
'''
command = ['xinput', '--list-props', str(device)]
output = tps.check_output(command, logger).decode()
regex = r'^\s+{}\s+\(\d+\):'.format(property_)
return re.search(regex, output, re.MULTILINE) is not None
I just realized that property_
should be escaped in my proposal for has_device_property
above. Something like this would be better:
def has_device_property(device, property_):
'''
Checks whether a given device supports a property.
'''
command = ['xinput', '--list-props', str(device)]
output = tps.check_output(command, logger).decode()
regex = r'^\s+({})\s+\(\d+\):'.format(re.escape(property_))
return re.search(regex, output, re.MULTILINE) is not None
I see that the difference is {}
to ({})
. But what does the additional capturing group change?
The re.escape
does seem to make a lot of sense, though.
The capturing group doesn't do anything functionally; it just makes it a little clearer (at least to me) what's going on.
Okay. I included the group, it should not hurt.
Then I will try to package this update today. I do not have an Ubuntu 15.10 virtual machine around to package, yet. I downloaded a box using Vagrant and have to provision that.
The update is out for 15.10. Does that resolve the issue?
Yes, it does. Moreover after update to 16.04 it still works correctly for me.
Great! Then I can also upload this version to 14.04 and 16.04. You still have the version installed from 15.10, I assume. The Ubuntu release upgrader will disable all the PPAs, you will have to activate them again manually.
Yea, probably I have. But for now I have 4.7.3, so it is the newest version I assume. Great thanks for Your effort.
I have updated my PPA for Ubuntu 14.04 and 16.04 now. Let's see if we get a bunch of bug reports from people which got their setup broken by that upgrade …
After update to 4.7.1 (unfortunately I do not remember previous version I used) Wacom Pen Stylus do not rotate correctly (or do not rotate at all - I do not know). In my device I have both Wacom Pen Touch (sensible to a real finger) and Wacom Pen Stylus (sensible to a stylus). Wacom Pen Touch is rotated correctly, but Wacom Pen Stylus is not!!! And the stylus is what I used till I have made update. Now the tablet mode is useless under linux.
I know that this is a similar issue to already two unsolved issues. But I hope more input - faster solution.
Some info: System: Ubuntu 15.10 64bit Hardware: Thinkpad X220i Tablet