LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   NVidia / Ubuntu auto-detect / select external monitor (https://www.linuxquestions.org/questions/linux-newbie-8/nvidia-ubuntu-auto-detect-select-external-monitor-931089/)

JohnLocke 02-24-2012 12:33 PM

NVidia / Ubuntu auto-detect / select external monitor
 
I have a laptop on a docking station and would like, when docked, for the laptop to recognize the external monitor and use just that monitor. When off the docking station, it should (obviously) use just the laptop screen.

If I set it up so that the laptop screen is disabled, it does auto-recognize the external monitor, but unsurprisingly, when disconnected from the dock, does not come back to the screen.

When I set it up as twinview or separate xview (problematic if it isn't connected), the laptop seems to think the external monitor is always there, and will allow programs to start up on that (disconnected) monitor.

Any way to set this automatically? I'm using Nvidia's X Server Settings gui and have installed the nvidia drivers, and I'm using Ubuntu 11.10.

Every thread I've seen is from 2009 or before and hasn't had a solution. Any thoughts?

bmarx 02-25-2012 12:05 PM

You may want to have a look at xrandr:

http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

JohnLocke 02-27-2012 03:56 PM

Quote:

Originally Posted by bmarx (Post 4611829)
You may want to have a look at xrandr:

http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

Looks like this might be the right track. Going to have to mess with it a while to figure it out (my first attempt made the machine unbootable ... whoops ... as in, hung on boot).

JohnLocke 02-27-2012 04:43 PM

Ok ... I'm trying to follow the above xrandr information, but not getting anywhere. Here's the output ... maybe someone can point me in the right direction:

The generated xorg.conf file from X -configure (which I replaced /etc/X11/xorg.conf with and then restarted):
Code:

Section "ServerLayout"
        Identifier    "X.org Configured"
        Screen      0  "Screen0" 0 0
        Screen      1  "Screen1" RightOf "Screen0"
        Screen      2  "Screen2" RightOf "Screen1"
        Screen      3  "Screen3" RightOf "Screen2"
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        ModulePath  "/usr/lib/xorg/modules"
        FontPath    "/usr/share/fonts/X11/misc"
        FontPath    "/usr/share/fonts/X11/cyrillic"
        FontPath    "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath    "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath    "/usr/share/fonts/X11/Type1"
        FontPath    "/usr/share/fonts/X11/100dpi"
        FontPath    "/usr/share/fonts/X11/75dpi"
        FontPath    "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
        FontPath    "built-ins"
EndSection

Section "Module"
        Load  "record"
        Load  "dri2"
        Load  "extmod"
        Load  "dri"
        Load  "dbe"
        Load  "glx"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option            "Protocol" "auto"
        Option            "Device" "/dev/input/mice"
        Option            "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier  "Monitor0"
        VendorName  "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Monitor"
        Identifier  "Monitor1"
        VendorName  "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Monitor"
        Identifier  "Monitor2"
        VendorName  "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Monitor"
        Identifier  "Monitor3"
        VendorName  "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option    "SWcursor"                  # [<bool>]
        #Option    "HWcursor"                  # [<bool>]
        #Option    "NoAccel"                    # [<bool>]
        #Option    "ShadowFB"                  # [<bool>]
        #Option    "VideoKey"                  # <i>
        #Option    "WrappedFB"                  # [<bool>]
        #Option    "GLXVBlank"                  # [<bool>]
        #Option    "ZaphodHeads"                # <str>
        #Option    "PageFlip"                  # [<bool>]
        Identifier  "Card0"
        Driver      "nouveau"
        BusID      "PCI:1:0:0"
EndSection

Section "Device"
        Identifier  "Card1"
        Driver      "nvidia"
        BusID      "PCI:1:0:0"
  Option "monitor1" "Monitor1"
  Option "monitor2" "Monitor2"
  Option "monitor3" "Monitor3"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option    "ShadowFB"                  # [<bool>]
        #Option    "Rotate"                    # <str>
        #Option    "fbdev"                      # <str>
        #Option    "debug"                      # [<bool>]
        Identifier  "Card2"
        Driver      "fbdev"
        BusID      "PCI:1:0:0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option    "ShadowFB"                  # [<bool>]
        #Option    "DefaultRefresh"            # [<bool>]
        #Option    "ModeSetClearScreen"        # [<bool>]
        Identifier  "Card3"
        Driver      "vesa"
        BusID      "PCI:1:0:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device    "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                Viewport  0 0
                Depth    1
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    4
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    8
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    15
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    16
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    24
        EndSubSection
EndSection

Section "Screen"
        Identifier "Screen1"
        Device    "Card1"
        Monitor    "Monitor1"
        SubSection "Display"
                Viewport  0 0
                Depth    1
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    4
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    8
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    15
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    16
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    24
        EndSubSection
EndSection

Section "Screen"
        Identifier "Screen2"
        Device    "Card2"
        Monitor    "Monitor2"
        SubSection "Display"
                Viewport  0 0
                Depth    1
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    4
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    8
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    15
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    16
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    24
        EndSubSection
EndSection

Section "Screen"
        Identifier "Screen3"
        Device    "Card3"
        Monitor    "Monitor3"
        SubSection "Display"
                Viewport  0 0
                Depth    1
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    4
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    8
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    15
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    16
        EndSubSection
        SubSection "Display"
                Viewport  0 0
                Depth    24
        EndSubSection
EndSection

And the output of xrandr -q
Code:


xrandr: Failed to get size of gamma for output default
Screen 0: minimum 320 x 175, current 1920 x 1080, maximum 1920 x 1080
default connected 1920x1080+0+0 0mm x 0mm
  1920x1080      50.0*    51.0    52.0    53.0 
  1680x1050      54.0 
  1600x1024      55.0 
  1440x900      56.0 
  1400x1050      57.0 
  1360x768      58.0    59.0 
  1280x1024      60.0    61.0 
  1280x960      62.0 
  1152x864      63.0    64.0    65.0    66.0    67.0    68.0 
  1024x768      69.0    70.0    71.0    72.0    73.0    74.0 
  960x720        75.0 
  960x600        76.0 
  960x540        77.0 
  928x696        78.0 
  896x672        79.0    80.0 
  840x525        81.0    82.0    83.0    84.0    85.0 
  832x624        86.0 
  800x600        87.0    88.0    89.0    90.0    91.0    92.0    93.0    94.0    95.0    96.0 
  800x512        97.0 
  720x450        98.0 
  720x400        99.0 
  700x525      100.0    101.0    102.0    103.0 
  680x384      104.0    105.0 
  640x512      106.0    107.0    108.0 
  640x480      109.0    110.0    111.0    112.0    113.0    114.0 
  640x400      115.0 
  640x350      116.0 
  576x432      117.0    118.0    119.0    120.0    121.0    122.0    123.0 
  512x384      124.0    125.0    126.0    127.0    128.0 
  416x312      129.0 
  400x300      130.0    131.0    132.0    133.0    134.0 
  360x200      135.0 
  320x240      136.0    137.0    138.0    139.0 
  320x200      140.0 
  320x175      141.0

I have two monitors plugged in. One via the laptop's VGA port and one via the dock that it's sitting in (there's actually two DVI ports there, but I'm only using one). Makes no difference to this output whether I'm in the dock or not. The other monitor, and the only one displaying anything is the laptop screen.

thoughts?


All times are GMT -5. The time now is 12:31 PM.