Friday, October 1, 2010

How to add a second monitor (Dual monitor)

I buy a new LG E2250V monitor and I try to connect it to my laptop (HP Compaq 6715s) which has installed Ubuntu 10.04 on it. The laptop has an ATI Radeon X1250 graphical card.
At first I successfully connect using System -> Preferences -> Monitors, but with a wrong resolution.
To change that I searched Internet for it. So here are the steps to follow to change your resolution or refreshing rate:

1. Where is xorg.conf?
xorg.conf is the configuration file used for monitors settings. It is located in etc/X11/xorg.conf
Ubuntu 10.04 may not use this file by default. But if you create it, it will.
1.1. first check if xorg.conf exists. If it does, skip this step.
1.2. You can create an xorg.conf file by entering recovery mode (hold down shift at startup, or choose it from GRUB when it appears) and type: $ sudo Xorg -configure
1.3. A file /root/ will be created. Copy this file to /etc/X11/xorg.conf
Now you have xorg.cong file in proper location.

2. Backup your configuration file by running command: sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

3. run the next commands to change resolution

3.0 First, here are couple commands to inform the current configuration:

$ xrandr -v

Sample output

xrandr program version 1.3.2
Server reports RandR version 1.3

$ xrandr -q

Sample output

Screen 0: minimum 320 x 200, current 2896 x 800, maximum 8192 x 8192
VGA-0 connected 1360x768+1536+32 (normal left inverted right x axis y axis) 0mm x 0mm
1360x768 59.8*
1024x768 60.0
800x600 60.3 56.2
848x480 60.0
640x480 59.9 59.9
LVDS connected 1280x800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
1280x800 59.9*+
1280x720 59.9
1152x768 59.8
1024x768 59.9
800x600 59.9
848x480 59.7
720x480 59.7
640x480 59.4
S-video disconnected (normal left inverted right x axis y axis)

3.1. If you want to add a mode with resolution 1024X768, you can enter the following command: (The output is shown following.)

$ cvt 1920 1080

Sample output

# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

3.2. Now you need to create a modeline. Copy the modeline of the previous output to the place mode line

$ xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

3.3. Now you need to add the above mode using the following command

$ xrandr --addmode VGA-0 "1920x1080_60.00"

3.4. Here for VGA1 you have to use what ever that was there for $ xrandr output

$ xrandr --output VGA-0 --mode "1920x1080_60.00"

4. In this step we will save this changes permanently.

4.1. Edit the default file:

$sudo gedit /etc/gdm/Init/Default

4.2. Look for the following lines


4.3 Add the the following lines below them

xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode VGA-0 "1920x1080_60.00"
xrandr --output VGA-0 --mode "1920x1080_60.00"

No xorg.conf found in /etc/X11 (Ubuntu 10.04)

Xorg RandR 1.2

How change display resolution settings using xrandr