lenovo trackpoint directions switched

Bug #1241944 reported by Trevor
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Magick Rotation
In Progress
Medium
Favux

Bug Description

After rotating the screen my trackpoint nub no longer moves the cursor in the correct direction, rather the directions seem to be reversed after rotating back to the normal screen orientation. The magick rotate icon is also no longer available in the system tray so I cannot change any settings. I am running Ubuntu 13.10 on a lenovo X230T

Trevor (trevormar)
description: updated
Revision history for this message
Favux (favux-is) wrote :

Isn't the trackpoint covered by the screen?

I'm wondering if this isn't related to this bug, "rotation is wrong on Fujitsu P1630 in 12.04"? See: https://bugs.launchpad.net/magick-rotation/+bug/1240589 The work around described might help you if you could access Advanced Setup. Perhaps I introduced it when I worked on xrotate.py.

As far as the missing icon goes that is due to Ubuntu. They went their own way and changed the system tray to a custom Application Indicator system starting with Raring. So new code needs to be written, which I just started on. Unfortunately, while my skeleton Python test code does result in putting the Magick icon in the new Indicator tray, my first pass at adding the Ind code to Magick fell flat. One problem being the links that are suppose to lead to the App. Indicator API specification return "Server not found." Not real helpful.

Revision history for this message
Trevor (trevormar) wrote :

Thanks for your comments. Yes the trackpoint is covered by the screen, but once I physically rotate the screen back into laptop mode and magick rotates the screen back, the trackpoint directions are now switched. If you rotate the screen several more times using magick, the issue still persists.

Revision history for this message
Favux (favux-is) wrote :

Let's rule out the sorts in xrotate.py being the issue. When you run 'xinput list' is the trackpoint under the "Virtual core pointer" section or the "Virtual core keyboard" section? If any question just post the entire output. Otherwise please post the entire trackpoint line in output.

Revision history for this message
Trevor (trevormar) wrote :

The trackpoint is under the "virtual core pointer" section:

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Finger touch id=11 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
⎜ ↳ Wacom ISDv4 E6 Pen eraser id=15 [slave pointer (2)]
⎜ ↳ TPPS/2 IBM TrackPoint id=16 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
    ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
    ↳ Power Button id=6 [slave keyboard (3)]
    ↳ Video Bus id=7 [slave keyboard (3)]
    ↳ Sleep Button id=8 [slave keyboard (3)]
    ↳ Integrated Camera id=9 [slave keyboard (3)]
    ↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
    ↳ ThinkPad Extra Buttons

Revision history for this message
Favux (favux-is) wrote :

Thanks Trevor. OK it is passing the first sort. Let's check the second sort.

Run 'xinput list-props 16' and post that output please.

Revision history for this message
Trevor (trevormar) wrote :

Device 'TPPS/2 IBM TrackPoint':
 Device Enabled (134): 1
 Coordinate Transformation Matrix (136): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
 Device Accel Profile (255): 0
 Device Accel Constant Deceleration (256): 1.000000
 Device Accel Adaptive Deceleration (257): 1.000000
 Device Accel Velocity Scaling (258): 10.000000
 Device Product ID (251): 2, 10
 Device Node (252): "/dev/input/event16"
 Evdev Axis Inversion (495): 0, 0
 Evdev Axes Swap (497): 0
 Axis Labels (498): "Rel X" (144), "Rel Y" (145)
 Button Labels (499): "Button Left" (137), "Button Middle" (138), "Button Right" (139), "Button Wheel Up" (140), "Button Wheel Down" (141), "Button Horiz Wheel Left" (142), "Button Horiz Wheel Right" (143)
 Evdev Middle Button Emulation (500): 0
 Evdev Middle Button Timeout (501): 50
 Evdev Third Button Emulation (502): 0
 Evdev Third Button Emulation Timeout (503): 1000
 Evdev Third Button Emulation Button (504): 3
 Evdev Third Button Emulation Threshold (505): 20
 Evdev Wheel Emulation (506): 1
 Evdev Wheel Emulation Axes (507): 6, 7, 4, 5
 Evdev Wheel Emulation Inertia (508): 10
 Evdev Wheel Emulation Timeout (509): 200
 Evdev Wheel Emulation Button (510): 2
 Evdev Drag Lock Buttons (511): 0
trevor@Thinkpad:~$ xinput list-props 16
Device 'TPPS/2 IBM TrackPoint':
 Device Enabled (134): 1
 Coordinate Transformation Matrix (136): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
 Device Accel Profile (255): 0
 Device Accel Constant Deceleration (256): 1.000000
 Device Accel Adaptive Deceleration (257): 1.000000
 Device Accel Velocity Scaling (258): 10.000000
 Device Product ID (251): 2, 10
 Device Node (252): "/dev/input/event16"
 Evdev Axis Inversion (495): 0, 0
 Evdev Axes Swap (497): 0
 Axis Labels (498): "Rel X" (144), "Rel Y" (145)
 Button Labels (499): "Button Left" (137), "Button Middle" (138), "Button Right" (139), "Button Wheel Up" (140), "Button Wheel Down" (141), "Button Horiz Wheel Left" (142), "Button Horiz Wheel Right" (143)
 Evdev Middle Button Emulation (500): 0
 Evdev Middle Button Timeout (501): 50
 Evdev Third Button Emulation (502): 0
 Evdev Third Button Emulation Timeout (503): 1000
 Evdev Third Button Emulation Button (504): 3
 Evdev Third Button Emulation Threshold (505): 20
 Evdev Wheel Emulation (506): 1
 Evdev Wheel Emulation Axes (507): 6, 7, 4, 5
 Evdev Wheel Emulation Inertia (508): 10
 Evdev Wheel Emulation Timeout (509): 200
 Evdev Wheel Emulation Button (510): 2
 Evdev Drag Lock Buttons (511): 0

Revision history for this message
Favux (favux-is) wrote :

Thank you for the list-props output. It looks like it is passing the second sort.

I now have a partially functioning Application Indicator, i.e. the Magick Rotation icon appears in Unity Raring. It Saves and Closes and you can access Advanced Setup. So you may be able to use the before and after rotation commands work around I mentioned above. Would you be interested in testing?

My priority right now is to try and get as much of the Magick functionality back into the Application Indicator as possible. Then I'll try and figure out what is wrong with xrotate.py evdev rotation. As you probably know one of the bug fix releases was aimed at evdev rotation for N-Trig digitizers and I thought I had that fixed. So to hear there still is a problem is dissapointing.

Revision history for this message
Trevor (trevormar) wrote :

Hi favux.

I reinstalled magik and linked my screen rotate button to the new rotate python script and the problem has gone away, so I am not sure what the issue was. Thanks for your help.

Revision history for this message
Favux (favux-is) wrote :

Trevor a testing version of Magick with an App Indicator for Unity Raring or later is now available on the devel branch, revision 68.

Test version for Ubuntu 13.04 (and later) Unity App Indicator in -> Code -> devel branch -> rev. 68 -> download tarball; see FAQ 1406.

Revision history for this message
Trevor (trevormar) wrote :

Nevermind, the trackpoint bug is back now. Same issue as before.

Revision history for this message
Trevor (trevormar) wrote :

thanks for the update Favux

Revision history for this message
Alexander Heuer (evilphish) wrote :

Same problem here with the rev 68 on a X220t.

Also, after installing the rev 68 I still get no icon in the unity panel. Are there additional steps that have to be taken?

Revision history for this message
Favux (favux-is) wrote :

Hi Alexander,

The App Indicator should appear in the Unity tray after a reboot. Are you in Raring or Saucy?

Could you, following INSTALLER.txt, verify that the Magick files are in /usr/share/magick-rotation? Also that 62-magick.rules is in /etc/udev/rules.d and checkmagick64 is in /usr/bin. Also verify that the magick group was created and your username is in it with:
    getent group magick
or
    cat /etc/group | grep magick

Revision history for this message
Favux (favux-is) wrote :

Oh, and also in Nautilus under View change to show hidden files. Under Home in .local/share/applications do you see the auto start file magick-rotation.desktop?

Revision history for this message
Alexander Heuer (evilphish) wrote :

/usr/share/magick-rotation files are there

udev rules are there

checkmagic64 is there

my user is also a member of the magick group

However there is no autostart file magick-rotation.desktop in .local/share/applications/

If I start magick-rotation from /usr/share/magick-rotation by hand I still don't get any tray icon though.

Revision history for this message
Favux (favux-is) wrote :

Sorry, wrong directory for magick-rotion.desktop. I should have said ~/.config/autostart.

So if you:
    cd /usr/share/magick-rotation
and run:
    ./magick-rotation
the App Indicator does not appear? It does for me in Raring.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Ah sorry I forgot to mention, I am on 13.10 saucy.
If I go to the folder you mentioned and start it by hand I get a notification popup saying "Touch status on" which then disappears after a couple of seconds. Other than that there is no icon in the systray from magick-rotation.

Revision history for this message
Favux (favux-is) wrote :

Alright, the notification about touch means that Magick is running but you are not seeing an App Indicator.

To close Magick hit ctrl-z. Is there any output with complaints/errors?

I was reading about another App Indicator that needed to be manually started and once it was it would run. So maybe try logging out or rebooting? See if the attempt at a manual start did anything.

Otherwise it is looking like I'm going to have to assume there is a difference between Saucy and Raring for some reason and install Saucy and see if I can figure it out.

Revision history for this message
Alexander Heuer (evilphish) wrote :

I did quite a few reboots and re-logins already.

Output wise I only get this:
Magick is using a gtk.StatusIcon.
Configuration file ~/.magick-rotation.xml not found.
Will load the defaults instead.
checking for rotation
/usr/bin/checkmagick64

Revision history for this message
Favux (favux-is) wrote :

Excellent! I think you identified the problem. This is the key:
Magick is using a gtk.StatusIcon.

It should say App Indicator instead of gtk.StatusIcon. So the code I put in to identify Raring and later is failing. In both magick-rotation and gui_gtk.py near the top you'll see a code block similar to:

# to support App Indicator for Ubuntu Raring (13.04) Unity and later
from commands import getstatusoutput
find_distro = "cat /etc/issue"
distro_raw = getstatusoutput(find_distro)
distro_split = distro_raw[1].split(' ')
distro = distro_split[0]
release = distro_split[1]
major_version = (release.split('.'))[0]
if distro == "Ubuntu":
    if int(major_version) >= 13:
        try:
            import appindicator # should only be available in Unity (and KDE?)
            have_appindicator = True
        except:
            have_appindicator = False
    else:
        have_appindicator = False

Just add below each one:
have_appindicator = True

so it reads:

# to support App Indicator for Ubuntu Raring (13.04) Unity and later
from commands import getstatusoutput
find_distro = "cat /etc/issue"
distro_raw = getstatusoutput(find_distro)
distro_split = distro_raw[1].split(' ')
distro = distro_split[0]
release = distro_split[1]
major_version = (release.split('.'))[0]
if distro == "Ubuntu":
    if int(major_version) >= 13:
        try:
            import appindicator # should only be available in Unity (and KDE?)
            have_appindicator = True
        except:
            have_appindicator = False
    else:
        have_appindicator = False

have_appindicator = True

Using:
    gksudo gedit /usr/share/magick-rotation/gui_gtk.py
and:
    gksudo gedit /usr/share/magick-rotation/magick-rotation

Let's see if that fixes it.

Revision history for this message
Favux (favux-is) wrote :

Oops! I got excited and didn't think that through.

Instead of the one line add these lines:

try:
    import appindicator # should only be available in Unity (and KDE?)
    have_appindicator = True
except:
    have_appindicator = False
print "have_appindicator", have_appindicator

Notice no idents on try and except or print. Other lines indented 4 spaces.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Hmm, maybe I did it wrong but I only needed to add the print line (which of course won't really change the outcome)
My magick-rotation looks like this:
# removal necessitating an App Indicator in 13.04 (12.04.3?) and later?
release = distro_split[1]
major_version = (release.split('.'))[0]
if distro == "Ubuntu":
    if int(major_version) >= 13:
        try:
            import appindicator # should only be available in Unity (and KDE?)
            have_appindicator = True
        except:
            have_appindicator = False
        print "have_appindicator", have_appindicator
    else:
        have_appindicator = False

prog_ver="1.7"

and the gui_gtk.py like this:
release = distro_split[1]
major_version = (release.split('.'))[0]
if distro == "Ubuntu":
    if int(major_version) >= 13:
        try:
            import appindicator # should only be available in Unity (and KDE?)
            have_appindicator = True
        except:
            have_appindicator = False
        print "have_appindicator", have_appindicator
    else:
        have_appindicator = False

prog_ver="1.7"

using the print commands the output is now:
have_appindicator False
Magick is using a gtk.StatusIcon.
have_appindicator False
Configuration file ~/.magick-rotation.xml not found.
Will load the defaults instead.
checking for rotation
/usr/bin/checkmagick64

Revision history for this message
Favux (favux-is) wrote :

By the way thank you for testing Alexander.

Am I correct in assuming the App Indicator didn't show? Given where you placed the print line it looks like the:
cat /etc/issue

command is producing the correct output and so the code block is working. But please provide that output just to be sure. And also the output of:
unity --version

So it appears libappindicator wasn't imported into Python with the 'import appindicator' line. Because with either code block we should have seen 'True'. If that's correct we need to figure out what they changed the name to in Saucy. Maybe run my code block as a confirmation?

Let's try some googling and see if we can come up with something.

Revision history for this message
Favux (favux-is) wrote :

In Software Center or Synaptic check and see if you have the package 'python-appindicator' installed. If not install it.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Always happy to help :) Your neat little python thing is pretty much the most important thing to my x220t ^^ I'd hate to write my lab-log on real paper ^^
Also I wouldn't be caught dead using unity but since cinnamon is broken in 13.10 I have to, so lets get that testing underway before they fix it so it may help someone who actually wants to use unity ;)

Anyway

Yes, the app indicator didn't show.
cat /etc/issue gives: Ubuntu 13.10 \n \l
unity --version gives: unity 7.1.2

Put you rcodeblock in a separate file which now has the contents:
#!/usr/bin/env python2
try:
    import appindicator # should only be available in Unity (and KDE?)
    have_appindicator = True
except:
    have_appindicator = False
print "have_appindicator", have_appindicator

executing this prints:
have_appindicator False

While we're on the subject of failing imports, during installation of your magnificent script, if one tries to execute MAGICK-INSTALL you actually get a popup saying:
There are no package managers that are compatible
with this installer. Please read INSTALLER.txt
for manual installation instructions.

what I actually did to fix this was comment out the line (7):
from apt.progress import InstallProgress
in the file apt_pm.py
which allows the installer to continue.
Don't know if that is the desired behaviour with ubuntu, from your source it looked that the installer should work on this distro.

Revision history for this message
Favux (favux-is) wrote :

Your separate file seems pin it on import appindicator for sure because your cat line should work. Hoping the python-appindicator package is the problem.

Thanks for the tip on the installer. I'm definitely going to have to install Saucy. Just don't know where, kind of out of room. Don't know if I'll be able to fix it because that was Jayhawk's baby and I still don't follow some of it. Been having similar problems on some Debian versions of APT and can't figure out why unless it's a bug in those versions. Unfortunately the project lost its second developer and now there is just me.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Put one saucy install up on virtualbox maybe?

I would offer more help but I never really did stuff in Python and the inner workings of gtk/unity/etc elude me ;)
Know my way around in perl, C (been a while) and php so I don't think I would be of much help ^^ Also wrote a somewhat neat bash script to use the thinkpads hdaps sensor to guess the screen orientation on button press so you can hold it the way you like, press a button and the screen will rotate in a way that makes sense. It uses your xrotate.py ;)

That's about it, usually I just fiddle around with solid state lasers ^^

If I can still be of any assistance feel free to hit me up, even if it's just for testing. Would hate to see this project drop because of a stressed out dev. It's way too important ;)

Revision history for this message
Favux (favux-is) wrote :

Ah, I unintentionally mislead you. The dev.s were Red_Lion and Jayhawk. I am not a dev. I'm the look and feel guy and general gopher. I enjoyed writing code with Jayhawk giving hints and supervising. Bit insecure without the backstop. I've been managing to keep things limping along, just.

I'd love to see the hdaps sensor code. We did talk about adding accelerometer support and I have code samples.

I'll figure out the Saucy install. Might be a while. Be great if you're available for some more testing. Really appreciate it.

Hopefully the thing works in Raring anyway, which has a few months left I think.

Revision history for this message
Favux (favux-is) wrote :

@ Trevor and Alexander,

Let's check if the trackpoint driver is broken with respect to CMT rotation. There have been more general bugs before involving the X Server itself. The matrices are in xrotate.py and there is more discussion of CTM here: http://forums.linuxmint.com/viewtopic.php?f=42&t=112852 Let's try some xinput commands to test trackpoint rotation.

The "device name" we are seeing for the trackpoint from 'xinput list' looks to be "TPPS/2 IBM TrackPoint". If you get something different test with that instead.

The xinput CTM command for none/normal or no rotation is the identity matrix:
xinput set-prop "TPPS/2 IBM TrackPoint" "Coordinate Transformation Matrix" 1, 0, 0, 0, 1, 0, 0, 0, 1

The xinput CTM command for ccw/left rotation is:
xinput set-prop "TPPS/2 IBM TrackPoint" "Coordinate Transformation Matrix" 0, -1, 1, 1, 0, 0, 0, 0, 1

The xinput CTM command for half/inverted rotation is:
xinput set-prop "TPPS/2 IBM TrackPoint" "Coordinate Transformation Matrix" -1, 0, 1, 0, -1, 1, 0, 0, 1

The xinput CTM command for cw/right rotation is:
xinput set-prop "TPPS/2 IBM TrackPoint" "Coordinate Transformation Matrix" 0, 1, 0, -1, 0, 1, 0, 0, 1

At the least if these commands work you can run them from a terminal or script to fix things even if Magick's Advanced Setup isn't available.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Ok I have done the following:

- Start magick-rotation by hand
- Flip the display to tablet mode
- Flip the display back to normal mode

-> Trackpoint is still stuck in tablet coordinates

Then I used the xinput command for the normal rotation:
xinput set-prop "TPPS/2 IBM TrackPoint" "Coordinate Transformation Matrix" 1, 0, 0, 0, 1, 0, 0, 0, 1

And after executing it the trackpoint behaves like it should again. :)

Also I noticed that if I cycle through the different orientations, on all orientations after the first the trackpoint is off. So one would have to execute the appropriate xinput transformation matrix after every orientation change, the "execute before" and "after" option in the magick-rotation settings (which I can't access anyway via the gui due to the missing icon) would probably only be able to fix this if you only use the Normal and Tablet rotation.

Maybe something in the magick-rotation script is not executing the transform commands properly?

Revision history for this message
Favux (favux-is) wrote :

Good we have a work around.

The trackpoint is using the evdev driver according to the list-props above. The evdev driver did have a CTM bug but but that was fixed. So testing it would not seem necessary.

By the way to test the driver open 4 terminals and place one of the xinput commands in each. Then run one of the commands without physically rotating the screen and check if the trackpoint has the correct orientation with respect to the command. Using your stylus select the terminal with the next command you want and hit Enter. And you can use the up arrow to recall a command from the command line's history buffer.

Anyway so it is unlikely to be the evdev driver. If you run Magick or xrotate.py from /usr/share/magick-rotation with ./magick-rotation or ./xrotate.py then the line:
    print "val_string:", val_string
should print out the CTM used for the trackpoint on rotation to tablet mode and back. That's at about line #368. The ID # for the trackpoint should be the same as what you get from 'xinput list'. You can make xrotate.py much more verbose by changing at near the top of xrotate.py 'debug = 0' to 'debug = 1'.

Another way to check if the problem is with the CTM code is to use the old way for evdev rotation. Near the top of "class evdev:" I stuck in a switch. It's at about line #290. Change:
        # Do not run the method if the property does not exist
        if not cur_ctm:
        # to disable CTM comment out above line and uncomment line below
# if cur_ctm:
            return None

to read:
        # Do not run the method if the property does not exist
# if not cur_ctm:
        # to disable CTM comment out above line and uncomment line below
        if cur_ctm:
            return None

Revision history for this message
Alexander Heuer (evilphish) wrote :

Ok, executing all the commands in a row shows they are rotating the stylus in the correct direction.

using ./magick-rotation with debug enabled in xyrotate.py I get this when flipping to tablet mode and going back:

./magick-rotation
have_appindicator False
Magick is using a gtk.StatusIcon.
have_appindicator False
Configuration file ~/.magick-rotation.xml not found.
Will load the defaults instead.
xsetwacom set "11" Touch on

type 6e29 code 5271 value 0
type bb6b code 2 value 0
type 5 code 1 value 1
type 6e29 code 5271 value 0
type bb6b code 2 value 0
type 0 code 0 value 0
Entered rotate_devices
rotating wacom device Wacom ISDv4 E6 Pen stylus
skipping next rotation check
xsetwacom set 10 rotate cw

rotating wacom device Wacom ISDv4 E6 Finger touch
skipping next rotation check
xsetwacom set 11 rotate cw

rotating wacom device Wacom ISDv4 E6 Pen eraser
skipping next rotation check
xsetwacom set 14 rotate cw

rotating evdev device TPPS/2 IBM TrackPoint
going: right
class monitor monitor_count: 1
directional CTM selected -> right: [0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0]
tablet.x: primary 768
tablet.y: 1366
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
wacom count: 3
direction: right
sh: 1: cellwriter: not found
type 6e31 code 5271 value 0
type d21e code 0 value 0
type 5 code 1 value 0
type 6e31 code 5271 value 0
type d21e code 0 value 0
type 0 code 0 value 0
Entered rotate_devices
rotating wacom device Wacom ISDv4 E6 Pen stylus
skipping next rotation check
xsetwacom set 10 rotate none

rotating wacom device Wacom ISDv4 E6 Finger touch
skipping next rotation check
xsetwacom set 11 rotate none

rotating wacom device Wacom ISDv4 E6 Pen eraser
skipping next rotation check
xsetwacom set 14 rotate none

rotating evdev device TPPS/2 IBM TrackPoint
going: normal
class monitor monitor_count: 1
directional CTM selected -> normal: [0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0]
tablet.x: primary 768
tablet.y: 1366
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
wacom count: 3
direction: normal
sh: 1: cellwriter: not found

It looks to me that, even though magick-rotation is supposed to rotate to normal view, it still uses the transform matrix for going right.

Revision history for this message
Trevor (trevormar) wrote :

after installing the new update from post #9 I can see the app indicator and everything seems to be working well. The trackpoint issue is still present however so I will look at the CTM

Revision history for this message
Trevor (trevormar) wrote :

ok so running the command that Alexander wrote in post #30 fixes the trackpoint issue so ostensibly the problem is the same with my X230T

Revision history for this message
Favux (favux-is) wrote :

Thanks Trevor, so the App Indicator does work in Raring. Just need to figure out why it isn't in Saucy. And you've confirmed the correct CTM command gets the trackpoint in the right orientation.

I think we need to look at cur_dir. The debug "directional CTM selected" statement is claiming normal but using the wrong CTM. Let's see what cur_dir is saying. At about line #330 add the following 'print "cur_dir:", cur_dir' under:
cur_dir = tablet.direction

so it looks like this:
cur_dir = tablet.direction
print "cur_dir:", cur_dir

Also let's check, if we can, and compare that to direction.
print "direction:", direction
cur_dir = tablet.direction
print "cur_dir:", cur_dir

Then produce the rotate output like Alexander did in #32.

I don't have a device that uses the evdev driver so I had to make a testing lash-up last time. I'm trying to remember what I did. It wasn't great but it kind of worked.

Revision history for this message
Trevor (trevormar) wrote :

Thanks for your help. I actually have 13.10 (saucy) installed on a X230T and the app indicator is working fine.

Revision history for this message
Trevor (trevormar) wrote :

here is what my output looks like:

trevor@Thinkpad:/usr/share/magick-rotation$ ./xrotate.py
class monitor monitor_count: 1
going: left
class monitor monitor_count: 1
direction: left
cur_dir: left
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 0.0 -1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0
trevor@Thinkpad:/usr/share/magick-rotation$ ./xrotate.py
class monitor monitor_count: 1
going: inverted
class monitor monitor_count: 1
direction: inverted
cur_dir: inverted
val_string: 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
trevor@Thinkpad:/usr/share/magick-rotation$ ./xrotate.py
class monitor monitor_count: 1
going: right
class monitor monitor_count: 1
direction: right
cur_dir: right
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
trevor@Thinkpad:/usr/share/magick-rotation$ ./xrotate.py
class monitor monitor_count: 1
going: normal
class monitor monitor_count: 1
direction: normal
cur_dir: normal
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0

Revision history for this message
Favux (favux-is) wrote :

"I actually have 13.10 (saucy) installed on a X230T and the app indicator is working fine." Wow, that's great! I just installed Saucy and haven't tested in it. Still trying to figure out what to do with them dropping gksu and gksudo. I guess tell folks to install the gksu package. Is that what you did? And I figured out a solution for the import problem Alexander found in apt_pm.py.

Good. xrotate.py is working as expected when you do 360 degrees. But what happens if you first quit Magick and then launch Magick from the command line and rotate to tablet mode and then back to laptop? Let's check if all the directions still agree.

cd /usr/share/magick-rotation
./magick-rotation

Revision history for this message
Alexander Heuer (evilphish) wrote :

What about what I wrote in #32? It looks to me as if magick-rotation uses the wrong transfer matrix when automatically rotating back to normal mode. At least in the debug output it shows the matrix for rotating right where it wants to rotate to normal.

Revision history for this message
Favux (favux-is) wrote :

That's what we're looking into Alexander. From about line #332 to 343 cur_dir is used to select the matrix. Given your debug output a likely explantation is cur_dir is returning an unexpected value. Trevor has now shown cur_dir is correct when rotating through 360 degrees. Now let's see if it is returning right instead of normal when rotating back to laptop mode from a previous tablet mode rotation to the right.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Ok this is what I get with the inserted print statements

./magick-rotation
have_appindicator False
Magick is using a gtk.StatusIcon.
have_appindicator False
Configuration file ~/.magick-rotation.xml not found.
Will load the defaults instead.
xsetwacom set "11" Touch on

type 5796 code 5272 value 0
type 52e1 code 6 value 0
type 5 code 1 value 1
type 5796 code 5272 value 0
type 52e1 code 6 value 0
type 0 code 0 value 0
Entered rotate_devices
rotating wacom device Wacom ISDv4 E6 Pen stylus
skipping next rotation check
xsetwacom set 10 rotate cw

rotating wacom device Wacom ISDv4 E6 Finger touch
skipping next rotation check
xsetwacom set 11 rotate cw

rotating wacom device Wacom ISDv4 E6 Pen eraser
skipping next rotation check
xsetwacom set 14 rotate cw

rotating evdev device TPPS/2 IBM TrackPoint
going: right
class monitor monitor_count: 1
direction: right
cur_dir: right
directional CTM selected -> right: [0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0]
tablet.x: primary 768
tablet.y: 1366
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
wacom count: 3
direction: right
sh: 1: cellwriter: not found
type 57a0 code 5272 value 0
type 4055 code e value 0
type 5 code 1 value 0
type 57a0 code 5272 value 0
type 4055 code e value 0
type 0 code 0 value 0
Entered rotate_devices
rotating wacom device Wacom ISDv4 E6 Pen stylus
skipping next rotation check
xsetwacom set 10 rotate none

rotating wacom device Wacom ISDv4 E6 Finger touch
skipping next rotation check
xsetwacom set 11 rotate none

rotating wacom device Wacom ISDv4 E6 Pen eraser
skipping next rotation check
xsetwacom set 14 rotate none

rotating evdev device TPPS/2 IBM TrackPoint
going: normal
class monitor monitor_count: 1
direction: normal
cur_dir: right
directional CTM selected -> normal: [0.0, 1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 1.0]
tablet.x: primary 768
tablet.y: 1366
val_string: xinput set-prop 16 'Coordinate Transformation Matrix' 0.0 1.0 0.0 -1.0 0.0 1.0 0.0 0.0 1.0
wacom count: 3
direction: normal
sh: 1: cellwriter: not found

Revision history for this message
Favux (favux-is) wrote :

Outstanding Alexander. There is is, cur_dir has right when it should read normal on rotation back to laptop. So what happens if we change 'cur_dir' in the code block from #332 to 343 to 'direction'? Does that fix everything?

And Trevor since you see the icon in Saucy can you confirm the touch toggle entry in the popup menu works? Also the new rotation entry? The rotation should go 360 degrees counter clockwise.

Revision history for this message
Alexander Heuer (evilphish) wrote :

Confirming that changing cur_dir to direction works.

# establish requested rotation direction
#cur_dir = tablet.direction
cur_dir = direction

Now the only thing that's left for me would be the tray icon ^^

Revision history for this message
Favux (favux-is) wrote :

Great! :) Keep testing. Hopefully Trevor will confirm.

It would be nice to have gotten another evdev rotation bug. I'm hoping it might even be the last.

I should be able to test the App Indicator icon in Saucy shortly. In the meantime in /usr/share/magick-rotation/MagickIcons do you see 6 icons, 4 small, one of the small ones labelled magick-rotation-enabled.png?

Revision history for this message
Alexander Heuer (evilphish) wrote :

I have in the MagickIcons folder the following:
MagickAbout.png
magick-rotation-disabled.png
magick-rotation-disabled-touchoff.png
magick-rotation-enabled.png
magick-rotation-enabled-touchoff.png

Identify gives:
MagickAbout.png PNG 128x128 128x128+0+0 8-bit DirectClass 13.6KB 0.000u 0:00.000
magick-rotation-disabled.png[1] PNG 32x32 32x32+0+0 8-bit DirectClass 1.4KB 0.000u 0:00.000
magick-rotation-disabled-touchoff.png[2] PNG 32x32 32x32+0+0 8-bit DirectClass 1.45KB 0.000u 0:00.000
magick-rotation-enabled.png[3] PNG 32x32 32x32+0+0 8-bit DirectClass 1.84KB 0.000u 0:00.000
magick-rotation-enabled-touchoff.png[4] PNG 32x32 32x32+0+0 8-bit DirectClass 1.81KB 0.000u 0:00.000

Revision history for this message
Favux (favux-is) wrote :

@ Trevor. How did you install Magick Rotation on Saucy?

@ Alexander. To use MAGICK_INSTALL did you do anything else but comment out in apt_pm.py?
#from apt.progress import InstallProgress
The fix seems to be to change it to:
from apt.progress.base import InstallProgress

But then after it shows me the files it is going to install it dies after printing in the log:
Installing APT packages.

With no output other than a:
Killed python installer_gtk.py

But I'm not running the installer normally, have to use ./ or python. So maybe I'm running into an environment problem. I think I may have a bad install of Saucy. It won't let me double click on an executable file to run it. It just loads it into gedit without the choices to Run or Run in a terminal, etc. Like exec has been disabled in /home/username. OpenSUSE did that as a default and you had to edit fstab to fix it but Saucy's fstab looks ok.

This thread has gotten long enough with trackpoint stuff. Alexander could you maybe open another bug report about the icon?

Revision history for this message
Trevor (trevormar) wrote :

all I did was download revision #68 and then I ran the install script. The app indicator is there when I start up my computer, turning touch on and off works and displays a message and all of the settings are accessible as well. I had gksu isntalled beforehand.

Revision history for this message
Trevor (trevormar) wrote :

also, I can confrim that adding:
# establish requested rotation direction
#cur_dir = tablet.direction
cur_dir = direction

fixes the trackpoint issue. So right now, everything is working for me!

Revision history for this message
Trevor (trevormar) wrote :

also, I commented out: from apt.progress import InstallProgress in apt_pm.py and then ran the isntall script

Revision history for this message
Favux (favux-is) wrote :

Excellent Trevor! So your bug is solved. I'll mark it as such if Alexander opens a new report on the App Indicator icon.

I had expected the installer would work on Saucy because they kept Python 2.7 and didn't go to 3. So the installer working on your Saucy 13.10 install doesn't surprise me but does make me happy.

But why then do I and Alexander run into that import line problem and you didn't? My situation is even worse since the installer blows up without giving a clue as to why. I can't even run it by double clicking on it. You and Alexander aren't seeing that. I'm wondering if that isn't the reason it is blowing up, maybe the shell environment variables differ depending on the method used to run MAGICK-INSTALL. Gksudo/gksu seems to be working correctly. I think I may need to reinstall Saucy.

If I just ignore the installer problem and manually install it I'm not confident I'd have a valid test bed to figure out why Alexander doesn't see the App Indicator icon and you do.

Revision history for this message
Alexander Heuer (evilphish) wrote :

New bug is open.

And yes I just commented out the import line in order to run the installer.

And I can confirm adding .base to the first part of the import line gets the installer to run normally.

Revision history for this message
Favux (favux-is) wrote :

Ah, thanks for that. I missed the commenting out the InstallProgress line. Both that or adding .base still results in the Installer blowing up for me. So its two to one and I have an idiosyncratic situation. Which is what I was thinking.

Favux (favux-is)
Changed in magick-rotation:
importance: Undecided → Medium
assignee: nobody → Favux (favux-is)
status: New → Fix Committed
Revision history for this message
Favux (favux-is) wrote :

Trevor is your Saucy a 32-bit install?

Alexander thanks for confirming .base. So far it looks backwards compatible. Is your Saucy install a amd_64?

I have a proposed fix for the App Indicator icon.

Revision history for this message
Trevor (trevormar) wrote :

I have a 64 bit install with a core i7

Revision history for this message
Favux (favux-is) wrote :

According to Alexander fix apparently works for tablet back to laptop mode. But breaks rotation just using the script and with the new Rotation option in the popup menu.

This may be a bit harebrained because I only have the tablet rotation back to laptop in post #41 where direction=normal and cur_dir=right plus what #37 tells us. But let's try this code. Starts at about line #330. Code block is the original except for the two lines at the bottom.

        cur_dir = tablet.direction

        # select directional CTM for requested rotation direction
        ctm = []
        if (cur_dir == 'normal'):
            ctm = normal_ctm
        elif (cur_dir == 'left'):
            ctm = left_ctm
        elif (cur_dir == 'inverted'):
            ctm = inverted_ctm
        elif (cur_dir == 'right'):
            ctm = right_ctm
        else:
            print "Unable to select directional CTM."

        if not (direction == cur_dir):
            ctm = normal_ctm

If that works please do a lot of testing to verify.

Favux (favux-is)
Changed in magick-rotation:
status: Fix Committed → In Progress
Revision history for this message
Lightman (yli-uosh) wrote :

Sorry to bumping in... but just to let you know that I had same problems after upgraded to saucy: appindicator didn't work; installer didn't work - had to compile manually, and then had the problem of trackpoint didn't return to normal..

But the silver lining is everything now is working after installing revision 77 in devel.. Thank you so much for your work.. It's almost the whole point of sticking with thinkpad..

Almost lost faith in Ubuntu. I have had so much trouble in the last two upgrades, 13.04 and 13.10, and it wasn't just me.

Thank you again..

Revision history for this message
skamster (hersche-8) wrote :

mh, didn't read the whole text and also just bumping in..

laptop is a thinkpad x200t.
i work with kde/kubuntu (hold in mind, that kde get a own tablet-support too, not for auto- but for rotate at all) instead of gnome, no uniquity-stuff. now, i'm on trusty and the bug is still alive. i was able to fix it for myself, may not very proper, but works.
in the end it's exactly this coordinate-matrix-transform-stuff.. i really reconize it, cause i plug out my usb-mouse (which got same effect as trackpad).

first i was filtering out trackpad and the mouse by id with if/else (if not this id!). then it worked, after restart it doesn't the first time, but after i unplugg the mouse once and plug in again it does it proper.. cause it changed the id from 10 to 11 which wasn't transformed.

now i just commented out those lines and i'm happy!

so maybe all pointer-devices are affected and this transformstuff should just go out? is it maybe a workaround? cause a lot of people seems to have inverted-mouse-problems - maybe this is just fixed proper in newer stuff.. a option, when needed a little hidden, would be great to tell, if mouseinverting should be on or off - then it shouldn't be a problem to anyone..
i mean, this is maybe a real bugfeature at same time now... and it could really drives you to madness, when you try to fix it through xinput by yourself (needed me 3-4 hours :/)

but ey, it works, so anyway, thanks for your work, thanks to make it easily fixable by using python and keep the nice work up :)

btw: Trevor, when you could push those rotate-button-changes, i will be even more happy :)

Revision history for this message
John Pierce (john-w-pierce) wrote :

Favux,

I can confirm that by adding:

if not (direction == cur_dir):
            ctm = normal_ctm

the problem has been 75% fixed. The mouse rotation is working correctly at 180, 270, and back at 0 (start/normal laptop mode) degrees. However at 90 degrees (first rotate) the mouse is not being changed at all (stuck at 0 degree rotation). At 180 it is working correctly with the mouse flipped approprately. Thanks for the hard work.

My System:
Lenovo x230t
Funtoo
Xfce4
Compiz
Cairo Dock

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.