Linux Depot - Projects - nVidia Display Control


Nvidia Display Control on the Thinkpad

Update: 20/07/2010
After moving to another Thinkpad that has nVidia graphics I have found that the current script doesn't work as the /proc/acpi/ibm/video entries aren't there. I have started looking at removed that portion from the code and relying solely on using just disper and xrandr to provide the required information. This should in theory make things more flexible, but is a little more complicated. It's currently a work in progress and I will post a new version once its ready.


As I use a Thinkpad on a regular basis, I decided to make the move from Windows to Linux, more specifically Ubuntu 8.10. While most things work out of the box and have been great, one thing I missed was the Fn+F7 display software, as it allowed for specific display profiles and easy switching. I couldn't find anything easily available so I decided to write my own.

I found a very good backend program called Disper written by Willem van Engen, which allows for easy configuration of an Nvidia graphics card using nvidia-settings. This however doesn't provide the required functionality for the Fn+F7 combo, so I decided to write a script that uses it to find out what the display settings currently are and change as needed.

The requirements for it are pretty minimal. You will need Python etc (as thats a requirement for Disper), and for the script I wrote just the usual utils and the IBM ACPI module. You will need to add it as an ACPI event (you can see how I did it below) and you may also need to set a flag on the IBM ACPI module.

The script can be called either via ACPID of via the commandline or shortcuts. I currently have a set of gnome shortcuts that call it with different modes (e.g. projector etc). The profiles by default are stored in /etc/disper, but this can be changed at the top of the script. They are effectively dumps of current configs using disper (run disper --help) for more info. It gives a very quick way of changing screen setup/resolution to your requirements.

/etc/acpi/events/ibmvideobtn
event=ibm/hotkey HKEY 00000080 00001007
action=/usr/local/bin/thinkpad-screen.sh fnf7 >/var/log/thinkpad-screen 2>&1

/etc/rc.local
echo enable,0x084e >/proc/acpi/ibm/hotkey
NOTE: This is for a T61p, for other thinkpads it may differ

This software is used at your own risk.
Thinkpad Screen v0.1
Thinkpad Screen v0.2
Thinkpad Screen v0.3
Thinkpad Screen v0.4


Changelog

Version 0.1, initial release
Version 0.2, big rewrite, removed a lot of duplicate code
Version 0.3, changed the default disper log path to fix permission problems, can now be run as normal user
Version 0.4, fixed a bug with dvi switching not working due to the device being called dfp-1