Thinkpad Middle Mouse Scrolling in Ubuntu 8.10

Posted in Guides, Linux, Lists by aliencam | 21 Comments »

I found a couple blogs that said they got middlemouse scrolling working on a thinkpad, but none of their methods worked on my x61Tablet with 64-bit Ubuntu 8.10 installed.  This version of ubuntu uses evdev instead of the xorg.conf file that previous versions used, so it makes configuring the middle mouse button a little bit more difficult.

The first thing you should do (just for your own records) is this command:

xinput -list-props "TPPS/2 IBM TrackPoint"

that will return the properties of your trackpoint.  (change “TPPS/2 IBM TrackPoint” to “DualPoint Stick” if you have an X200 or  X61s.) I did not do this before changing settings, so I don’t know what the original looks like (if you do, please post it in the comments so I can have a record of it! I posted the final results of that command at the end.)

Now, what you will need to do is create a file, /etc/hal/fdi/policy/mouse-wheel.fdi with the following command:

sudo nano /etc/hal/fdi/policy/mouse-wheel.fdi

then paste in the contents with ctrl-shift-v:

<match key="info.product" string="TPPS/2 IBM TrackPoint">
<merge key="input.x11_options.EmulateWheel" type="string">true</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>
<merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
<merge key="input.x11_options.XAxisMapping" type="string">6 7</merge>
<merge key="input.x11_options.Emulate3Buttons" type="string">true</merge>
<merge key="input.x11_options.EmulateWheelTimeout" type="string">200</merge>
</match>

save and quit by hitting ctrl-x, then “y”.

To tell you what each line does:

EmulateWheel should be pretty obvious, you don’t actually have a wheel with a trackpoint, so it emulates one

EmulateWheelButton: which button pretends to be a wheel? the mouse buttons are numbered 1 2 3 in order, so “2″ is the middle one

YAxisMapping: which directions should the y-axis go? (4 is up, 5 is down)

XAxisMapping: which directions should the x-axis go? (6 is left 7 is right)

Emulate3Buttons: actually I’m not sure what this does in conjunction with emulatewheel. It probably allows you to use middle-click still (like to close firefox tabs, or whatever else middle click does)

EmulateWheelTimeout: if the button is held for longer than the ammount of time, it switches off the middle mouse click.  Essentially, this is what turns off “middle mouse paste” when you are trying to scroll.

Now, the above configuration DOES NOT work for me, but it seems that it does for everybody else… If it still does not work for you, keep reading for the fix, and please leave a comment so I don’t feel so inept :P. What happens to me is that the xinput list-props command shows the buttons as being mapped correctly, but nothing happens in xev or in real use.  I cannot find errors in any log files or anywhere to indicate why or what is happening.

So, what I do to get it working is in the above file, change “YAxisMapping” and “XAxisMapping” to be misspelled by adding an extra “s” as such: “YAxsisMapping” “XAxsisMapping”

At this point, restart and test it again.  Just misspelling it works for many people.

If it still doesn’t work, create a new file.  This will be a shell script that is run at startup to map the horizontal scrolling correctly (If you don’t care about horizontal scrolling and only use vertical, just stop after you messed up or deleted the XAxisMapping and YAxisMapping lines).Use the following command:

nano /home/$USERNAME/.horizscrollscript

Then paste with ctrl-shift-v, or type in the following contents:

#!/bin/bash
#
#
# The following line sets the X-axis mapping to buttons 6 and 7 so that
# horizontal scrolling works.
xinput -set-int-prop "TPPS/2 IBM TrackPoint" "Wheel Emulation X Axis" 8 6 7

then save and close with ctrl-X, then “Y”.  make the file executible with:

chmod +x /home/$USERNAME/.horizscrollscript

Now open the gnome sessions manager (System > Prefferences > Sessions, or alt-f2 and “gnome-session-properties”) and click “add”

for the “Name” field, name it something so you know what it does (I named it Horizontal Scroll Script).

In the “Command” field, enter the path to the file (/home/$USERNAME/.horizscrollscript)

The comment field is optional.  Save and restart, and everything should be working!

Please leave a comment if this does or does not work for you, I’m curious to know if I messed something up and that is why the first part of the tutorial doesn’t work.  ***UPDATE: It seems to work for nearly everybody except me… ugh***

To test everything, you should try this command:

xinput -list-props "TPPS/2 IBM TrackPoint"

and it should return:

Device 'TPPS/2 IBM TrackPoint':
Device Enabled:        1
Middle Button Emulation:        1
Middle Button Timeout:        50
Wheel Emulation Inertia:        10
Wheel Emulation:        1
Wheel Emulation X Axis:        6, 7
Wheel Emulation Y Axis:        4, 5

Wheel Emulation Timeout:        200
Wheel Emulation Button:        2
Drag Lock Buttons:        0

those bolded lines are what we were trying to get! now to test how your computer sees you use those buttons, ust the command:

xev

then you can hit keys on the keyboard and watch what it returns, or put the mouse pointer in the box that pops up and watch that as well.  You should be able to see that scrolling down is 5, up is 4, left is 6 and right is 7. (close xev with ctrl-z or by pressing the “x” on the box.)

The websites I used to formulate this approach are:

psung.blogspot.com/2008/09/scrolling-with-thinkpads-trackpoint-in.html

mvogt.wordpress.com/2008/08/15/xorg-evdev-and-emulatewheel/

***Note:  There is a bug that makes it so that middlemouse scrolling does not work sometimes after a suspend/resume.  Here is the bug report on Launchpad.  There has been a patch released for the actual xorg-evdev, but not one specifically for ubuntu (so you would have to recompile and build evdev while applying this patch at this point)  Here is the URL for the Launchpad bug:

bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-evdev/+bug/282387

There is a temporary fix also, removing and reloading the “psmouse” module seems to fix it without suspending/resuming again, or restarting the computer.  This is kind of dangerous because it literally unloads the mouse drivers and then reloads them, so you will have to use the keyboard only to enter this in a terminal.  Use these commands:

sudo rmmod psmouse
sudo modprobe psmouse

–aliencam

Ubuntu 8.10 X61t Tablet Setup (With Touch)

Posted in Guides, Linux by aliencam | 17 Comments »

Well, I wanted to get a head start on playing with ubuntu 8.10, so that it doesn’t take me hundreds of hours this weekend to rewrite my entire ubuntu setup guide to be relevent to 8.10, so I partitioned off 10 gb and did a fresh install of ubuntu 8.10 RC last week. The first thing I set up was tablet support.

Supposedly this is more difficult in this version of Ubuntu thanks to a fancy new xorg server that ignores the xorg.conf file unless you tell it to, but you tell it to use the file by adding a server section to the xorg.conf file anyway!

This guide only activates the tablet in ubuntu 8.10, it does not do other things that I will need to do later in the xorg.conf file. (such as middle-mouse scroll, and turning off the annoying middle-mouse button = paste function)


***NOTE: ALWAYS BACKUP YOUR XORG.CONF FILE BEFORE EDITING. YOU CAN DO THIS WITH THE COMMAND:

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Then if you can’t login and need to restore the original, from a failsafe termainal login you can do:

sudo cp /etc/X11/xorg.conf.backup /etc/X11/xorg.conf

YOU MAY NOW PROCEED TO MAKING YOUR UBUNTU COMPUTER AWESOME.***

So, for archival/recovery purposes, here is my original xorg.conf with a Thinkpad x61 Tablet in Ubuntu 8.10, Intrepid Ibex:

Section "Device"
Identifier    "Configured Video Device"
EndSection

Section "Monitor"
Identifier    "Configured Monitor"
EndSection

Section "Screen"
Identifier    "Default Screen"
Monitor        "Configured Monitor"
Device        "Configured Video Device"
EndSection

Of course, that does not include the  commented out parts, or any correct tab spacing (curse you wordpress!!!) but those aren’t really important.

In order to get the tablet working, you need to add at least the three pen devices (eraser, stylus, and cursor) and optionally the “touch” device (if you have a multitouch screen [is your max resolution 102x768? then you likely have multitouch])

The lines for that is as follows:

#BEGIN TABLET SECTION
Section "InputDevice"
Driver        "wacom"
Identifier    "stylus"
Option        "Device"    "/dev/input/wacom"    # USB ONLY
Option        "Type"        "stylus"
Option        "USB"        "on"        # USB ONLY
Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
Option        "Button2"    "3"        # Added to map stylus click correctly
EndSection


Section "InputDevice"
Driver        "wacom"
Identifier    "eraser"
Option        "Device"    "/dev/input/wacom"   # USB ONLY
Option        "Type"          "eraser"
Option        "USB"           "on"        # USB ONLY
Option        "ForceDevice"   "ISDV4"        # Tablet PC ONLY
Option        "Button3"    "2"        # Added to map eraser correctly
EndSection

Section "InputDevice"
Driver        "wacom"
Identifier    "cursor"
Option        "Device"        "/dev/input/wacom"    # USB ONLY
Option        "Type"        "cursor"
Option        "USB"        "on"        # USB ONLY
Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
EndSection
#END TABLET SECTION

And if you have a tablet PC with multitouch, before the line “#END TABLET SECTION” you can add:

# This section is for the TabletPC that supports touch
Section "InputDevice"
Driver        "wacom"
Identifier    "touch"
Option        "Device"        "/dev/input/wacom"  # USB ONLY
Option        "Type"          "touch"
Option        "ForceDevice"   "ISDV4"               # Tablet PC ONLY
Option        "USB"           "on"                  # USB ONLY
EndSection

Finally, add the server layout section to the bottom of the file so that what you just entered does something:

Section "ServerLayout"
Identifier    "Default Layout"
Screen        "Default Screen"

#Section for tablet events
InputDevice     "stylus"    "SendCoreEvents"
InputDevice     "cursor"    "SendCoreEvents"
InputDevice     "eraser"    "SendCoreEvents"
#InputDevice    "touch"        "SendCoreEvents"  #for the TabletPCs that supports touch
EndSection

If your laptop DOES have multitouch, and you want poking the screen with your finger to work, remove the “#” that is before the line InputDevice    "touch"        "SendCoreEvents"

That’s it, save and restart, and BAM!

Everything on a line after a pound sign (#)  in the above is a comment.  I have put comments in the above xorg.conf configuration so that I know what sections do what, without having to remember things.  If you want, you can remove all of the comments, but I would not suggest it because someday when  you are editing xorg.conf and xorg crashes on you and you want to figure out what you messed up, you will need that documentation.

Remember that my favorite system file editor is nano, NOT gedit.  gedit is very nice for editing normal text files, but I find that things break much more often when using a graphical text editor than a CLI one like nano.  The hardest part about nano is the keyboard shortcuts.  arrow keys to move up and down, and ctrl-shift-c for copy, ctrl-shift-v for paste, and ctrl-x for exit.  You cannot save until you exit (I think…) and when you press ctrl-x it will ask you “do you want to save this file” or something similar, press y, then where you want to save it (probably just hit enter).

So, using nano, the command to edit xorg.conf is:

sudo nano /etc/X11/xorg.conf

And just in case I was not clear enough above, here are the contents of my final xorg.conf file:

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type “man xorg.conf” at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# Note that some configuration settings that could be done previously
# in this file, now are automatically configured by the server and settings
# here are ignored.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "Device"
Identifier    "Configured Video Device"
EndSection

Section "Monitor"
Identifier    "Configured Monitor"
EndSection


Section "Screen"
Identifier    "Default Screen"
Monitor        "Configured Monitor"
Device        "Configured Video Device"
EndSection

#BEGIN TABLET SECTION
Section "InputDevice"
Driver        "wacom"
Identifier    "stylus"
Option        "Device"    "/dev/input/wacom"    # USB ONLY
Option        "Type"        "stylus"
Option        "USB"        "on"        # USB ONLY
Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
Option        "Button2"    "3"        # Added for stylus click
EndSection

Section "InputDevice"
Driver        "wacom"
Identifier    "eraser"
Option        "Device"    "/dev/input/wacom"   # USB ONLY
Option        "Type"          "eraser"
Option        "USB"           "on"        # USB ONLY
Option        "ForceDevice"   "ISDV4"        # Tablet PC ONLY
Option        "Button3"    "2"        # Added for eraser working
EndSection

Section "InputDevice"
Driver        "wacom"
Identifier    "cursor"
Option        "Device"        "/dev/input/wacom"    # USB ONLY
Option        "Type"        "cursor"
Option        "USB"        "on"        # USB ONLY
Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
EndSection

# This section is for the TabletPC that supports touch
Section "InputDevice"
Driver        "wacom"
Identifier    "touch"
Option        "Device"        "/dev/input/wacom"  # USB ONLY
Option        "Type"          "touch"
Option        "ForceDevice"   "ISDV4"               # Tablet PC ONLY
Option        "USB"           "on"                  # USB ONLY
EndSection
#END TABLET SECTION

Section "ServerLayout"
Identifier    "Default Layout"
Screen        "Default Screen"
#    InputDevice    "Synaptics Touchpad"


#added to get tablet working
InputDevice     "stylus"    "SendCoreEvents"
InputDevice     "cursor"    "SendCoreEvents"
InputDevice     "eraser"    "SendCoreEvents"
InputDevice    "touch"        "SendCoreEvents"
EndSection

Hope this helps, I don’t think there is another guide for it online yet.

–aliencam

Final Note:

I wrote this guide in Noble Library on ASU’s campus this morning, and I lost my laptop’s stylus while I was there… So far it has not shown up in any of the lost and founds around campus, and it was not in the study room where I was working, so it looks like I need a new one… The problem is that I don’t have any money right now, the pen costs $50, and I need it to take notes in many of my classes… If this  guide helped you out, and you need web hosting, please consider using the bluehost affiliate link in the right sidebar.  Bluehost is great for very cheap unlimited hosting, (I think about $90/yr) and if one person were to sign up, the affiliate program would pay me enough to afford a new digitizer pen for my laptop. The stylus is also on my amazon wishlist at the link at the top of the page, and here

Here is my xorg.conf file with Touch disabled.  I am posting this because there are problems with wordpress messing up quotation marks and indentations/tab spacing in the things I have posted, causing people who copy-pasted from my blog to only be able to boot in low-graphics mode.

xorg.conf

UPDATE 01.07.2008: I just updated the xorg.conf sections in this post to include “code” tags, so now it should be okay to copy-paste directly from here. Double check that it is not still pasting “smart-quotes” before saving the changes, but hopefully that shouldn’t happen.

Also, one commenter has said that the buttons on their digitizer pen are mapped differently. If you could not get the eraser working, try mapping the eraser to "Button1" "3" instead of "Button3" "2"

aliencam’s Customized Ubuntu Setup part V: Getting the Tablet to work in Ubuntu Hardy

Posted in Life in General by aliencam | No Comments »

Setting up the Tablet
Thinkpad x61 or x60 tablet only (I think. But it might work for other wacom tablet computers as well.)

This again requires editing the xorg.conf file, so make sure you have at least one backed up copy of it already. If not, see the Middle Mouse Scroll section. Backing up xorg.conf before making edits is VERY IMPORTANT.
in a terminal:
sudo gedit /etc/X11/xorg.conf
then scroll down the the very bottom. Here you will find a section that looks like this:

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Synaptics Touchpad"
EndSection

(of course, the correct line spacing will actually work… unlike wordpress’s)
change that so that it looks like this:

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Synaptics Touchpad"

#added to get tablet working
InputDevice "stylus" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
InputDevice "touch" "SendCoreEvents"
EndSection

Then, above that, make a few more lines, and then add in this:

#BEGIN TABLET SECTION
Section "InputDevice"
Driver "wacom"
Identifier "stylus"
Option "Device" "/dev/input/wacom" # USB ONLY
Option "Type" "stylus"
Option "USB" "on" # USB ONLY
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
Option "Button2" "3" # Added for stylus click
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "eraser"
Option "Device" "/dev/input/wacom" # USB ONLY
Option "Type" "eraser"
Option "USB" "on" # USB ONLY
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
Option "Button3" "2" # Added for eraser working
EndSection

Section "InputDevice"
Driver "wacom"
Identifier "cursor"
Option "Device" "/dev/input/wacom" # USB ONLY
Option "Type" "cursor"
Option "USB" "on" # USB ONLY
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
EndSection

# This section is for the TabletPC that supports touch
Section "InputDevice"
Driver "wacom"
Identifier "touch"
Option "Device" "/dev/input/wacom" # USB ONLY
Option "Type" "touch"
Option "ForceDevice" "ISDV4" # Tablet PC ONLY
Option "USB" "on" # USB ONLY
EndSection
#END TABLET SECTION

Now I would like to note that “touch” does not work yet with this tablet driver. However, It was in the manual, which means that it eventually could work, which would be amazing. It does not cause me any errors to have it in there though, so I figure it won’t hurt. If you wish, remove the section “for the TabletPC that supports touch” and the “touch” line in the server layout section at the bottom.

With this setting, the tip of the pen will act as a regular “left-click”, the button on the pen will act as a “right-click” and the eraser will act as a regular left-click except in applications that support the eraser.

My favorite of such eraser-supporting applications is called xournal. This is a note-taking program that allows a combination of tablet and typing, and lets you annotate PDF files. Very handy for taking notes in my engineering classes. However the eraser does not work correctly by default in this program. In order to get it to work go to Options, and check Use XInput, Discard Core Events, and Eraser Tip. Then, Options > Button 3 Mapping > Highlighter, and back to Options to select Auto-Save Preferences and Save Preferences. Then your pen will work nicely in Xournal from now on.

image of xorg.conf next to tablet writings in xournal

References: The Linux Wacom Project (man wacdump)

Creative Commons License