Installing the NVIDIA driver for multiple kernels

December 1st, 2011

I know it is totally obvious, but I never tried to figure out how to build the NVIDIA driver for more than one kernel. I always just reinstalled it and assumed it has to be that way. As it turns out I was wrong. With the -k switch you can build the driver for any not-running kernel:

sh NVIDIA-Linux-x86-280.13.run -K -k 2.6.33.4-smp -a

-K builds only the kernel module and does not uninstall the current driver

-a accepts the license

-k is the uname -r output of the kernel to build (you can also use the name of the directory in /lib/modules)

Rebooting via dbus

November 13th, 2011

If you ever wondered how your window manager can shutdown or reboot your computer without asking for a root password, then the most likely answer is dbus.

This command will reboot a machine running dbus:

dbus-send --print-reply --system --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Reboot

You can replace “Reboot” with “Shutdown” to power off the machine completely.

Setting up us_de keyboard layout on Slackware 13.37 and Ubuntu

September 19th, 2011

It’s been some time since I talked about my us_de Keyboard layout (and a long time since I last blogged ;)) so I think it is time to update the installation instructions. You can download the layout here: us_de keyboard layout.

To set it up on Slackware do the following:

  1. Save the us_de file to /etc/X11/xkb/symbols/
  2. Copy 90-keyboard-layout.conf from /usr/share/X11/xorg.conf.d/ to /etc/X11/xorg.conf.d/
  3. Take a look at the example and change the line Option “XkbLayout” “us” to Option “XkbLayout” “us_de”
  4. Save it and restart X :)

For Ubuntu you can find all the information there: http://people.uleth.ca/~daniel.odonnell/Blog/custom-keyboard-in-linuxx11

The short version:

  1. Save the us_de file to /usr/share/X11/xkb/symbols/
  2. Edit /usr/share/X11/xkb/rules/evdev.xml and add a block like this to the <layoutList>section:
    <layout>
    <configItem>
    <name>us_de</name>
    <shortDescription>USde</shortDescription>
    <description>USde</description>
    <languageList><iso639Id>eng</iso639Id></languageList>
    </configItem>
    <variantList/>
    </layout>
  3. Then go to System->Preferences->Keyboard and klick on the Layouts tab.
  4. There click “Add”.
  5. Pick “By language”
  6. Set “Language” to “English” and “Variants” to “USde”.
  7. Click on “Add”
  8. Then remove your old layout (or move USde up as frist choice)

So much for easy to use eh ;)

Have fun with my layout!

 

Firefox middle mouse button on Linux

January 31st, 2010

I noticed that firefox did *something* when clicking the middle mouse button without hovering a link. I finally found out what it did and how to disable it:

http://aymanh.com/archives/2006/01/27/firefox-and-middle-click-clipboard-url

So setting middlemouse.contentLoadURL to false keeps firefox from trying to load the current clipboard content.

Remapping mouse buttons

May 31st, 2009

Yesterday I got a new mouse. A Logitech G5. Being a nice mouse overall it has a small little flaw: clicking the mouse wheel is not that easy because you can click it in three ways. Down and from left and right.

As I frequently use the middle mouse button I was not happy (because it often misinterpreted a click for a wiggle-left). As a geek I thought: wiggling the mouse wheel to the left is even easier than clicking on it. I would no longer have to lift my finger off the left mouse button. The question was: How can I remap this 7th mouse button?

After some research I found it was very easy to remap the button.

First you have to correctly configure the mouse in your Xorg configuration file:

Section "InputDevice"
Identifier "Logitech G5"
Driver "evdev"
Option "CorePointer"
Option "Device" "/dev/input/by-id/usb-Logitech_USB_Gaming_Mouse-event-mouse"
Option "ZAxisMapping" "invert"
Option "Emulate3Buttons" "false"
Option "Buttons" "9"
Option "Resolution" "800"
EndSection

(My thanks go to chuck)

From there it took a bit more research to learn that I can use xmodmap  to easily remap the mouse buttons:

xmodmap -e "pointer = 1 7 3 4 5 6 2 8 9"

Remaps button 7 into the poistion of button 2 ( mouse- wheel-click). For more information visit the very good tutorial by HP.

Now I just had to put the “pointer = 1 7 3 4 5 6 2 8 9” part into a file into my home directory (surprisingly called .Xmodmap) and let Fluxbox execute it at startup.

Now I just have to get used to other mice not worknig like that ;-)

Mapping postal codes to countries

February 5th, 2009

Every now and again I had the problem of matching postal codes and countries. I often wondered if there is a system to (austrian) postal codes and finally found a table that says how to map a postal code to a country.

I encoded it into a simple PHP function – maybe it is useful :-)

plz2bl.php

Connecting two monitor to a NVIDIA card without the proprietary driver

November 16th, 2008

For a long time I searched for a way to connect two monitors to an NVIDIA graphic card without using the proprietary nvidia driver (mainly because I wanted to try use OpenBSD and 64bit FreeBSD).

Somehow I never read nv’s (the free Xorg driver) man page – until today. And there it is, clear as crystal:

Option "Dualhead" "boolean"
    Enables simple VBE-based dual head mode.  This sets the same resolution on both outputs and lays them out
    side-by-side.   The screens will be panned together as one big metamode if the virtual desktop is larger than both
    screens combined.

So I just had to change my Xorg config from:

Section "Device"
    Identifier     "Card0"
    Driver         "nvidia"
    Option        "TwinView"
EndSection

to

Section "Device"
    Identifier     "Card0"
    Driver "nv"
    Option	"Dualhead"
EndSection

So simple!

Ken Thompson on Security

July 11th, 2008

I just stumbled on a very good article by Ken Thompson on computer security:

Reflections on Trusting Trust

In this article Ken shows how easy it is to alter a compiler  to compromise all binaries created with it. Although 24 years old this article is a very interesting read.

us_de Keyboardlayout

July 10th, 2008

The more I used it, the more unhappy I became with the us-intl keyboard layout. Especially all the dead keys (keys that may modify the following key e.g. ” + a to write ä) made typing tiresome. Always typing a space after double quotes is really not suited for programming.

I found a good tutorial on writing your own Xorg keyboard layouts:
Creating custom keyboard layouts for X11 using XKB

Using these instructions I created a us_de layout, that uses the us layout and bind alt + a/u/o/s to the german  umlauts ä/ü/ö/ß.

To install the file, just copy it to /etc/X11/xkb/symbols/ and edit your /etc/X11/xorg.conf (or type setxkbmap -layout us_de -variant basic into a shell): us_de

cups woes

March 4th, 2008

I just tried to get cups working and had the following problem:

I have a Lexmark Optra E+ parallel port printer and usually cups shows the parallel port as Device: on the second configuration screen. Only this time cups did not recognize the parallel port. lptest > /dev/lpt0 worked fine, just cups could not see the parallel port.

After about half an hour I finally found the solution:

# ls -l /dev/lpt0
crw——-  1 root  wheel    0,  57 Mar  4 20:00 /dev/lpt0

The rights on /dev/lpt0 were not set correctly. After changing them, everything worked fine:

# chmod 666 /dev/lpt0
# ls -l /dev/lpt0
crw-rw-rw-  1 root  wheel    0,  57 Mar  4 20:00 /dev/lpt0