boltblog

Improve the mouse response and acceleration in Debian

Posted on March 4, 2009

Note: This information is now slightly outdated, as the patch is already in Debian Squeeze.

One of my biggest issues with moving from Windows to Linux as my desktop is how the mouse is handled in xorg. In xorg, the mouse had (and still has, in Debian Lenny) two settings for mouse speed: acceleration and threshold. Simply put, what these do is that whenever the mouse is moving faster than the threshold, it gets accelerated by the acceleration value, and otherwise it's unaccelerated.

While this may work for some people, I found it horribly annoying. Before anyone jumps up and bites me, I do know that I can set the threshold to 0 and get some sort of normal acceleration, but I hate that one too. Luckily, Simon Thum has come up with a solution.

His solution has been patched into the newer versions of xorg. The bug is available at freedesktop.org, and the latest patch is here. However, while this patch goes into version 1.4 or xorg without a hitch, the Debian (and probably Ubuntu) build system requires an additional change in the Makefile.in file.

In short, here's a howto for Debian Lenny on getting the new and much improved mouse handling in:

Become root

su (type root password)

First, make sure you've installed everything required to build stuff in the first place:

apt-get update && apt-get install build-essential fakeroot

Become a normal user again

exit

Make a temporary directory, cd to it, then get the sources for xserver-xorg-core

mkdir mousepatch
cd mousepatch
apt-get source xserver-xorg-core

apt-get will download the sources, extract them and apply the Debian-specific patches.
Next, we need all the build-dependencies. These are the libraries used in xserver-xorg-core, which we'll need to compile the source code.

apt-get build-dep xserver-xorg-core

Now make a backup of the source code (This is not strictly necessary, but I like to do so anyway before messing around with it. Saves doing another apt-get download.)

cp -r xorg-server-1.4.2 xorg-server-1.4.2-orig

Now we want to apply the mouse patch. You can either use Simon's original patch from the link above, or you can download a Debian-specific version of it here. This is the exact same patch as the one above, except it only fits into this specific source code, and it contains the changes to the Makefile.in file, which allows dpkg-buildpackage to successfully compile it.

LINK TO DEBIAN-SPECIFIC PATCH

cd xorg-server-1.4.2
patch -p1 <path to mouse patch>

Now build the package.

dpkg-buildpackage -rfakeroot

This will generate quite a few .deb files in the parent directory, and will probably also exit with a return value of 1, complaining it is unable to find Julien Christau's private key. You are most likely not Julien Christau, so you will not be able to sign the package as him. This is irrelevant, as we're not going to distribute this package anyway.

The only .deb you have actually changed is the one named xserver-xorg-core_1.4.2-10_i386.deb, so this is the one we want to install:

cd ..
su   (root password again)
dpkg -i xserver-xorg-core_1.4.2-10_i386.deb

Now, assuming all went well, you may restart X or reboot, whatever your preference, and enjoy your newfound mouse bliss. I actually prefer my new Linux mouse-setup to my dualbooted WinXP IntelliMouse drivers now.

To learn how to set up your new mouse acceleration, please refer to the developer documentation. For the record, these are the relevant lines from xorg.conf for my current setup:

Section "InputDevice"
    Identifier	"Configured Mouse"
    Driver		"mouse"
    Option		"Device"	"/dev/input/mice"
    Option		"Protocol"	"auto"
    Option		"Buttons"	"7"
    Option		"ButtonMapping"	"1 2 3 6 7"
    Option		"ZAxisMapping"	"4 5"
    Option		"AccelerationProfile" "1"
    Option		"VelocityScale" "10"
EndSection

Only the AccelerationProfile and VelocityScale is specific to this patch. Also, I use "xset m 18/10 0" to set my mouse speed.

Filed under: Howto's, Linux 3 Comments

Compiling and patching debian packages from source

Posted on March 2, 2009

A quick reference on how to compile Debian packages from source, and possibly patching them along the way.

Enlightened XFCE4

Posted on February 27, 2009

A howto stolen from http://ubuntuforums.org/showthread.php?t=101066 for later use. All credit to its writer, Iandefor.

How to kill a process that uses too much CPU

Posted on October 23, 2008

Cleaning up my 'dump' directory, I found this aging script I got from somewhere, which will check the current CPU usage of a program and kill it if it uses too much. This is useful if you are for some reason forced to run buggy, closed source software which get stuck in endless loops when things go wrong. I've been there, it wasn't fun, but this thing solved it. Thank you, french christmas...




Norwegian Windows edition on suicide mission

Posted on October 23, 2008

So I downloaded this Debian netinstall image... and Windows went suicidal?

Filed under: Linux, Rants Continue reading

Fun with “beep”

Posted on October 22, 2008

At the end of my huge list of stuff I always install on a Debian box, I put a "beep" to let me know when it's done, because I will no doubt be doing something else, most likely on a different screen, when it's done.

Now, suppose you run a lot of processes you want to know when are done, it's nice to have separate, easily distinguishable sounds for each event. Of course you could do this by playing a short mp3 or something with mpg321 or mplayer if you have a sound card set up on that particular box, but even if you do, playing short tunes on the PC speaker is so much more geeky, and thus cool, since you've already proven yourself to be a geek by working on the linux box in the first place.

Beep has the ability to play a sound at any frequency your PC speaker can do, and with configurable length... do I hear music?

Filed under: Linux Continue reading

How to move a mysql database from one box to another

Posted on August 19, 2008

Simple reference, moving a mysql database:

mysqldump -h <oldhostip/name> -u username -p[<password>] <databasename> > <dumpfilename>.sql
mysql -u<username> -p[<password>] < <dumpfilename>.sql

Note: The lack of spaces in some places of the commands. They are intended.
Note: Specifying the password after -p is []'d, which means it's optional.
Note: If you do enter a password on the command line, it will get saved in your .bash_history or similar in clear text.

Filed under: Linux, Reference No Comments

GPG Error: The following signatures were invalid

Posted on August 3, 2008

debian-archive-keyring up to date? still get the error?

here's a tip: try without a transparent proxy (i had to flush the cache on mine)

CIFS VFS No response for cmd n mid…

Posted on August 2, 2008

On a few systems, I've noticed CIFS mounts have a tendency to lock up the system when transferring large files, or a shitload of small ones in quick succession. When this happens, the system may or may not completely lock up, and lines like these will appear in your syslog:

Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response to cmd 46 mid 25661 

Disable the “No mail” notification on machines which have no local mail

Posted on July 20, 2008

On machines which are set up to have no local mail and send all their messages to a smarthost, using e.g. exim4, the "No mail." message at login is both unnecessary and annoying, because when things are set up correctly, there should never be any local mail in the first place.

This can be remedied by editing /etc/pam.d/ssh (or whichever file corresponds to the login method you're using) and taking a look at the two following lines:

# Print the status of the user's mailbox upon successful login.
session optional pam_mail.so standard noenv # [1]

It's time to comment something out :)

Filed under: Howto's, Linux 1 Comment