Ubuntu Setup Guide Part IV. Middle Mouse Scrolling

Posted in Guides, Life in General, Linux, Lists, Ubuntu by aliencam | 1 Comment »

==Thinkpad/IBM Mouse only==

Jaunty uses the same evdev system that Intrepid used, that I had some troubles with. However, the solution should be the same, and I just hope it works correctly this time.

Here are the original settings, before middle mouse scrolling works:
$ xinput -list-props "TPPS/2 IBM TrackPoint"
Device 'TPPS/2 IBM TrackPoint':
Device Enabled (109): 1
Evdev Axis Inversion (251): 0, 0
Evdev Reopen Attempts (242): 10
Evdev Axis Calibration (243):
Evdev Axes Swap (244): 0
Evdev Middle Button Emulation (252): 2
Evdev Middle Button Timeout (253): 50
Evdev Wheel Emulation (254): 0
Evdev Wheel Emulation Axes (255): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (256): 10
Evdev Wheel Emulation Timeout (257): 200
Evdev Wheel Emulation Button (258): 4
Evdev Drag Lock Buttons (259): 0

Now, to get this working, you need to create “/etc/hal/fdi/policy/mouse-wheel.fdi”. Easiest way to do this is to open up a terminal, and enter:
sudo gedit /etc/hal/fdi/policy/mouse-wheel.fdi

Now, paste in the following content and remove the extra space in each line (between “< " and "merge"
< match key="info.product" string="TPPS/2 IBM TrackPoint">
< merge key="input.x11_options.EmulateWheel" type="string">true
< merge key="input.x11_options.EmulateWheelButton" type="string">2
< merge key="input.x11_options.ZAxsisMapping" type="string">4 5
< merge key="input.x11_options.XAxisMapping" type="string">6 7
< merge key="input.x11_options.Emulate3Buttons" type="string">true
< merge key="input.x11_options.EmulateWheelTimeout" type="string">200

The 2nd to last line in there (200) is optional. This line prevents the middle mouse button from exhibiting the annoying paste function that an unconfigured button does. I need to set this option because as I’m scrolling through a document, I hate random sections being pasted where they don’t belong.

Save, exit, and restart X server by restarting the computer (the guide will cover re-enabling ctrl-alt-backspace to restart X later).

If you want an explanation of the other lines, in my post on this with the last version of Ubuntu, I wrote the following:

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.

With these settings, my middle mouse scrolling vertically and horizontally works even after suspending.

–aliencam

UPDATE: oops, I realized that I forgot some code tags around the most important part of this post! (the mouse-wheel.fdi code) I fixed that now.

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:

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

http://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:

https://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

aliencam's Customized Ubuntu Setup part II: Thinkpad Middle Mouse Scroll

Posted in Life in General by aliencam | No Comments »

In order to get the middle-mouse button to scroll you need to edit a configuration file. This is probably the most “dangerous” step in the guide, it could make you unable to access your regular account without fixing an issue if something else gets changed, but if only these options are changed you should be fine. Just in case, ALWAYS BACK UP before editing xorg.conf. To back up, open a terminal and enter:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
What this does is it copies the xorg.conf file to another file named xorg.conf.backup in the same directory. If you have to revert to the original one from the failsafe terminal mode, or a live CD, you will need to enter the opposite:
sudo cp /etc/X11/xorg.conf.backup /etc/X11/xorg.conf
That will replace the one you edited with the backup version you made before.

Now onto editing. In a terminal, enter:
sudo gedit /etc/X11/xorg.conf
You will then need to find the section labeled “Section “InputDevice”” that also has “Identifier “Configured Mouse”” in it. Mine is the second one on the list. Then put a pound sign (#) before each line in that section, and above it another line with a pound sign and “Original mouse configuration” The “#” means that line is a comment, and will not be read. Doing this gives you the opportunity to fix errors without erasing all of your configurations, and to know what you did. After the original section is commented out, type in this mouse section (above or below doesn’t matter) If you choose to copy-paste this section, make sure you re-type each quotation mark, because wordpress changes quotes to curved quotes instead of straight quotes, and the curved will cause an error.:
#Configured Mouse
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "Protocol" "ExplorerPS/2" #IMPS/2 is not recommend for TrackPoints
Option "Device" "/dev/input/mice"
Option "EmulateWheel" "on"
Option "Emulate3Buttons" "on"
Option "EmulateWheelButton" "2"
Option "YAxisMapping" "4 5"
Option "XAxisMapping" "6 7"
EndSection

Note: I would tab over all the lines between Section and EndSection just to keep in the same format as the rest of the file. My blog won’t let me tab it over in the post. Here is a screenshot of the original and final xorg.conf files next to each other.
original and backup xorg.conf files
Then save the file, and restart your computer. Hopefully everything will work out great and you will now have a working middle mouse button, if not though, log into the Failsafe Terminal mode and either fix the error, or restore the backup. If you see random brown pixels on the desktop, clicking doesn’t work like it used to, or something is much more messed up, restore the backup or reconfigure using the instructions in the “Repairing xorg.conf” section in the notes.

If you have issues with the middle mouse button acting as “paste” as well as scrolling in Firefox, (an issue I found very annoying while writing this blog) all you need to do is open a new firefox tab, and navigate it to about:config then in the filter bar type “mouse,” and change the value of middlemouse.paste to false by double-clicking on it or right-clicking on it.

Creative Commons License