Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 09-18-09, 10:32 AM   #1
brianfinley
Registered User
 
Join Date: Sep 2009
Posts: 6
Default How do I switch from DFP-0 to DFP-1 from the command line?

I've tried using nvidia-settings from the command line, but have been unsuccessful. I've tried a number of options that seem like they would work, but don't. Key in my problem is that DFP-0 and DFP-1 have different resolutions.

Every time I sit down to work from my notebook at my desk, I go through the nvidia-settings GUI, which is intuitive, but cumbersome when done again and again. In case it helps, I've attached two screenshots of nvidia-settings indicating the two states I need to switch between.

How do I make it happen via the command line?

Thanks!
Attached Thumbnails
Click image for larger version

Name:	DFP-0 Primary.png
Views:	186
Size:	74.3 KB
ID:	38214  Click image for larger version

Name:	DFP-1 Primary.png
Views:	158
Size:	75.4 KB
ID:	38215  
brianfinley is offline   Reply With Quote
Old 09-18-09, 11:06 AM   #2
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

Try this:
$ nvidia-settings -a SwitchToDisplays=`nvidia-settings -tq ProbeDisplays`
I don't recall offhand whether that changes the resolution too. You may need to use the xrandr command line tool for that.

Another option is to configure two MetaModes in xorg.conf, one that uses a mode on DFP-0 and the NULL mode on DFP-1, and another with the roles reversed. Then you can switch between the two with xrandr.
AaronP is offline   Reply With Quote
Old 09-18-09, 11:09 AM   #3
jumjum77
Registered User
 
Join Date: Mar 2009
Posts: 13
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

I have a launcher on my panel to this script that toggles the output.
Use: gksudo <scriptname> in the launcher.

Code:
#!/bin/bash
if [[ `grep DFP-0 /etc/X11/xorg.conf` ]]; then
 sed -i s'/DFP-0/DFP-1/' /etc/X11/xorg.conf
else
 sed -i s'/DFP-1/DFP-0/' /etc/X11/xorg.conf
fi
jumjum77 is offline   Reply With Quote
Old 09-22-09, 09:30 AM   #4
brianfinley
Registered User
 
Join Date: Sep 2009
Posts: 6
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

But, after doing this, a restart of X is required, right?

I need to switch without restarting X.
brianfinley is offline   Reply With Quote
Old 09-22-09, 09:49 AM   #5
brianfinley
Registered User
 
Join Date: Sep 2009
Posts: 6
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

Aaron,

Thanks for the suggestions. The first one gets me part-way there -- it enables TwinView, thus enabling DFP-1. However, it leaves DFP-1 at the resolution of DFP-0 (as you said it might), but it also leaves DFP-0 enabled.

I'm trying to figure out how to get nvidia-settings to enable DFP-1, disable DFP-0, and auto-set it's resolution.
brianfinley is offline   Reply With Quote
Old 09-22-09, 09:56 AM   #6
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

The nvidia-settings command line tool won't change resolutions. When you're using the GUI, it uses the RandR extension to do that. To do the same thing from the command line, you need to use the xrandr tool.
AaronP is offline   Reply With Quote
Old 09-22-09, 09:59 AM   #7
brianfinley
Registered User
 
Join Date: Sep 2009
Posts: 6
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

Aha!

I'm closer now. "nvidia-settings -tq ProbeDisplays" returns "0x00030000" when both display devices are connected. Because it's a bitmap value, 0x00020000 represents DFP-1, and 0x00010000 represents DFP-0.

Now, I can do this to switch to the desktop display:
nvidia-settings -a SwitchToDisplays=0x00020000

and this to switch to the laptop display:
nvidia-settings -a SwitchToDisplays=0x00010000

Now, all I need to do is get the resolution to auto-set for each display...
brianfinley is offline   Reply With Quote
Old 09-22-09, 11:04 AM   #8
brianfinley
Registered User
 
Join Date: Sep 2009
Posts: 6
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

Now that I'm able to enable one display device or the other, how do I invoke 'nvidia-auto-select' from the command line to auto-detect and select the proper resolution for the active display device?
brianfinley is offline   Reply With Quote

Old 09-22-09, 12:57 PM   #9
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

You might not be able to... you need to add a metamode with that resolution to the RandR mode pool, which you can't do with the command line utility, I think. You may want to give a program called "disper" a try -- it's supposed to be able to do all of the stuff you need.
AaronP is offline   Reply With Quote
Old 09-30-09, 11:36 AM   #10
brianfinley
Registered User
 
Join Date: Sep 2009
Posts: 6
Default Re: How do I switch from DFP-0 to DFP-1 from the command line?

AaronP -- Thanks!

Disper is exactly what I've been looking for. I was able to download and build it for my Ubuntu notebook quite easily:
Quote:
cd /tmp
wget http://ppa.launchpad.net/wvengen/ppa...r_0.2.3.tar.gz
tar -xvzf disper_0.2.3.tar.gz
cd trunk
fakeroot dpkg-buildpackage
sudo dpkg -i /tmp/disper_0.2.3_all.deb
Thanks again!
brianfinley is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:50 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.