Ubuntu On Sony Vaio FW Series

Tips & Tricks related to Sony Vaio FW series laptops

HDMI/VGA display detection solution

with 2 comments

Here is my solution about second display detection before login screen. First of all I configured xorg for one screen only with Catalyst Control Center (CCC) and saved xorg.conf as xorg.conf.mono in /etc/X11. Then I connect second monitor to HDMI and reconfigures xorg for double screen with Xinerama enabled and saved xorg.conf as xorg.conf.dual in /etc/X11.

The only way I’ve found to detect another display on HDMI/VGA port is by reading xorg log file after it loads (/var/log/Xorg.0.log). If display connected through HDMI there is “DFP1 connected” line present and “DFP1 disconnected” if not. The same is for VGA except that DFP1 should be changed to CRT1 I guess.

Ok, I need system to load xorg then read log file then select right config file (xorg.conf.mono/xorg.conf.dual) and put it as /etc/xorg.conf and restart xorg. This actions needs to be done before GDM loads because I don’t need any screen flickering with login screen 🙂

There is such script (/etc/gdm/Init/Default) which GDM runs before loading for initializing. I wrote a little script for actions I need and put it on top of just before <code>PATH=/usr/bin:$PATH</code> line /etc/gdm/Init/Default.

Here it is:

ISMULTI=`/bin/cat /var/log/Xorg.0.log | /bin/grep -c 'DFP1 connected'`

if [ "$ISMULTI" != "1" ] ; then
    /bin/cp /etc/X11/xorg.conf.mono /etc/X11/xorg.conf
    if [ ! -f "$ISMULTI_MUTEX" ] ; then
        /usr/bin/touch "$ISMULTI_MUTEX"
        /usr/bin/killall Xorg
        /bin/rm "$ISMULTI_MUTEX"
    /bin/cp /etc/X11/xorg.conf.dual /etc/X11/xorg.conf
    if [ ! -f "$ISMULTI_MUTEX" ] ; then
        /usr/bin/touch "$ISMULTI_MUTEX"
        /usr/bin/killall Xorg
        /bin/rm "$ISMULTI_MUTEX"

Now when booting with second display connected, I got two enabled displays on login screen ready and vise versa.

Written by egaistek

December 6, 2009 at 20:19

Posted in Vaio

2 Responses

Subscribe to comments with RSS.

  1. Nice!

    In my case I had to use /bin/grep -c ‘Connected Display1: CRT on primary DAC’ instead with my VGA monitor


    December 11, 2009 at 02:01

  2. Hey egaistek!

    I have a CW series Vaio. I’m running 9.10 and I need a little help. I have the same brightness problem as the FW laptops. I have no control over brightness and I was wondering if you knew of a fix for the CW series. Thanks.


    December 16, 2009 at 18:30

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: