[ltp] switching output on t61 (nvidia quadro 140 NVS)

Andreas Jellinghaus linux-thinkpad@linux-thinkpad.org
Tue, 2 Sep 2008 17:42:28 +0200


Hi Lenz,

> FWIW, I have now commited your attached files to a Bazaar repo and
> pushed it to Launchpad:
>
> https://code.launchpad.net/~lenzgr/+junk/switch-display
>
> I'd be glad to give you permissions to commit into this one directly,
> in case you plan to further improve it.

feel free to do so. see also launchpad.net bug 263887 where I posted
the code too and wrote things I found out.

the good: switching video output works for me.
the bad: but I need to switch resolutions too, need to figure out
  how to do that.
the ugly: how do I run some command from acpid? action= worked
for me the first time, because acpid was restarted in a sudo shell
(which retained XAUTHORITY HOME and DISPLAY I think).

normal acpid doesn't have these environment variables, so I would
need to set DISPLAY=:0 myself (should be ok as a default), and
XAUTHORITY - hmm, where is the magic cookie set by kdm/xdm/gdm?
it seems it is /var/run/xauth/<some file>, setting that to XAUTHORITY
works for me.

I thought nvidia-settings is non-free like the binary only nvidia driver,
but later I found out it is open source under GPL. thus I convertet
my small little tool into a patch for it and send it to the author
of nvidia-settings and the linux-bugs@nvidia.com address to show
them what I did so far and asking for help with the resolution change
(it would be soo easy with XRandR 1.2 ... but well).

> You first would have to figure out if acpid or some other process
> catches this event. AFAIK you can also configure the X Server if it
> should listen to these events or not, but I have not looked into that
> closely yet. I prefer switching via the commandline :)

no idea about the x server either. but I found the acpi event and the
config file in /etc/acpi/events and changed action=/bin/true to my
command. need to add a hack for DISPLAY and XAUTHORITY next.

> Good idea! A shell script using "kdialog" would be a simple first step
> solution for this.

I guess the dialog is easy, the hard part is getting the current state
of the nvidia driver configuration, and restoring it if the new mode
is not confirmed to work. nvidia-settings should have all that code
already I think, so adding more functionality to it might be best.

Regards, Andreas