Saturday, May 30, 2009

Configuring external monitor on Debian laptop

Here I'll try to describe how external monitor can be used on laptop in mirroring mode.

Hardware details



Laptop supports maximum resolution 1280x800.
Monitor SCALEOVIEW D22W-1 maximum resolution is 1680x1050.

X configuration



Here is /etc/X11/xorg.conf configuration adopted for HP6730b internal
display and external monitor:
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
EndSection

Section "Device"
Identifier "Primary Video Device"
# Intel driver
Driver "intel"
Option "MergedFB" "true"
# These modes specify mapping of internal monitor resolution to external
# monitor resolution, as list of two pairs (X by Y) separated with -
Option "MetaModes" "1024x768-1680x1050 1024x768-1280x1024 1024x768-1024x768 1024x768-800x600"
Option "MergedDPI" "100 100"
EndSection

Section "Device"
Identifier "Secondary Video Device"
Screen 1
EndSection

Section "Monitor"
Identifier "Laptop Monitor"
EndSection

Section "Monitor"
Identifier "External Monitor"
EndSection

Section "Screen"
Identifier "Internal Screen"
Device "Primary Video Device"
Monitor "Laptop Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
# Resolutions supported by laptop display
Modes "1024x768" "800x600"
EndSubSection
EndSection

Section "Screen"
Identifier "External Screen"
Device "Secondary Video Device"
Monitor "External Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
# Resolutions supported by external display
Modes "1680x1050" "1600x1200" "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Internal Screen"
InputDevice "Generic Keyboard"
EndSection


Please notice that driver set to "intel" - generic driver does not work with VGA output.

Switching resolution



To switch to external monitor with (probably) higher
resolution, create desktop.sh script in /usr/local/bin with following content:

xrandr --output LVDS --mode 1024x768 --set BACKLIGHT_CONTROL legacy --output VGA --mode 1680x1050
# This will completely turn laptop display off, commented out since we control backlight instead
# xrandr --output LVDS --off
# This will set backlight to 10%
xbacklight -set 10


To switch to smaller resolution (that laptop display supports), create
laptop.sh script with content:

xrandr --output LVDS --mode 1024x768 --set BACKLIGHT_CONTROL legacy --output VGA --mode 1024x768
# This will restore backlight to 100%
xbacklight -set 100


I found it much safer/useful to control laptop display backlight,
instead of switching LVDS output off, because it is easier to switch
resolution back, to smaller (something is still visible on display) when
the external monitor is taken away by crazy administrator guy :)

References


Xorg RandR 1.2 Wiki

mergefb - dual monitor setup on a linux laptop

2 comments:

  1. It helped me, thanks. :)

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete