-   Linux - Hardware (
-   -   Docking Station + External Monitor with Laptop Lid Closed (

0ddba11 08-20-2007 02:46 PM

Docking Station + External Monitor with Laptop Lid Closed
Evening all...

I thought I would firstly share a bit of knowledge and then ask how to improve it.

After installing the Nvidia drivers on my Dell XPS M1710 running Feisty, my laptop would boot up with the External monitor working, but then as soon as GDM starts it turns off. Opening the lid of my laptop revealed that it had infact reverted to the laptop panel.

It took me bloomin' ages to find out how to fix this but eventually got there, so here's what I did:

1. Started up the Laptop off the dock and logged in
2. Placed laptop on the dock and ran:

sudo nvidia-settings
3. Clicked on 'X Server Display Configuration'
4. Clicked on 'Detect Displays'
5. Clicked on the disabled display and made a mental note of the device name for the external monitor which is in brackets (in my case DFP-2)
6. Clicked on Save to X Configuration File
7. Clicked on Quit
8. Edited the device section of my /etc/X11/xorg.conf file as per the following:

Section "Device"
    Identifier    "Videocard0"
    Driver        "nvidia"
    VendorName    "NVIDIA Corporation"
    BoardName      "GeForce Go 7900 GTX"
    Option        "UseDisplayDevice" "DFP-2"

9. Saved it and quit

Now when GDM / X starts on the dock it uses the external monitor, and when it starts off the dock it uses the laptop display panel giving a warm(ish) dock / undock setup so long as you are prepared to restart X using CTRL + ALT + BACKSPACE

So now, what I would love to do is somehow write a dock / undock script to set this but without having to restart GDM / X, but have no idea if that's possible?


safulop 08-31-2007 03:27 PM

What if lid can't be open?
Hi there,

thanks for the helpful hints since I have a similar setup and problem, but uh, you mention asking Nvidia configuration to "detect displays" while your laptop was on the dock.

I presume you were using the laptop screen while asking it to detect the external monitor. That was how you imported the settings.

Now, my docking station cannot be used unless the laptop lid is closed. So, there is no way for me to communicate with Linux using the laptop screen while it is docked with the external monitor.

Anything to suggest?



0ddba11 09-01-2007 03:00 AM

Yes I was using the laptop screen to detect the external display.

Try unplugging the screen from the back of the dock and plugging it straight into the laptop while undocked I think the display device will have the same name when docked, after all, the docking station is merely a 'pass through' for the ports on your laptop.

If your laptop has DVI and VGA outputs, use the same type that you will be connecting to on the docking station because monitors connected to VGA ports seem to have the name CRT-X and those connected to DVI ports have the name DFP-X

Failing that you could try a few different device names:
For DVI Ports It Could Be: DFP-0 (Although this is more likely your laptop display) / DFP-1 / DFP-2
For VGA Ports It Could Be: CRT-0 / CRT-1 / CRT-2

DFP-0 will more than likely be your laptop screen.

The next version of Ubuntu (I'm running 7.04) will supposedly have better hotplug support for monitors which will hopefully make this all go away, and I'm also hoping it will eliminate the need to restart X when docking / undocking.

0ddba11 09-01-2007 03:18 AM

Now that I'm up and out of bed, I've been able to do a bit of testing and I can confirm that the Display Device name is the same whether docked or undocked (for me at least)

I tried plugging a monitor into the VGA port of my laptop and ran nvidia-settings, it detected the display as CRT-0.
I then sat my laptop on the dock, plugged the same display into the dock's VGA port and ran nvidia-settings, and it still see's it as CRT-0.

Hope this helps!

GrueMaster 09-02-2007 12:04 PM

I'm sure there is a way for udev to detect dock status of some type. If that could be detected, it would be a simple matter of writing a udev script that ran xrandr to get the new information, then ran it again with the appropriate settings.


dep 05-26-2010 04:36 PM

Hello everyone. Sorry to resurrect this thread, but it was the most relevant I could find. Specifically:


Originally Posted by GrueMaster (Post 2878748)
I'm sure there is a way for udev to detect dock status of some type. If that could be detected, it would be a simple matter of writing a udev script

Has anyone actually done this? I, too, have a docking station and a laptop, and would be very pleased to find a way to avoid manually setting the active monitors every time I dock my computer.

I found this promising guide:
In Ubuntu 10.04, the udevinfo command should be replaced with udevadm info. I found out that my /sys/devices/platform has dock.0, dock.1 and dock.2, of which dock.0 and dock.1 show ATTR{docked}=="1" when I'm docked. The guide then goes on to describe the scripts, which is where I got stuck: they use xrandr (also suggested in this thread). However, I would like to use a TwinView mode when docked (I have two external monitors connected to my docking station), and it is my understanding that xrandr does not work with TwinView modes.

How should I go about writing a script that enables TwinView on my external monitors when I dock, and falls back on the laptop display when I undock?

GrueMaster 05-26-2010 04:56 PM

Switching between normal & twinview modes requires an X restart, so your script would have to copy from preconfigured xorg.conf files and request the user to restart X (note that this does not require a full reboot).

All times are GMT -5. The time now is 01:21 PM.