Problem with video output switching

From ThinkWiki
Revision as of 20:28, 25 February 2008 by Gumbyx84 (Talk | contribs) (With the fglrx driver)
Jump to: navigation, search

Affected Models

Problem Description

External video output is not working, or it is not possible, using the FN-F7 key, to switch between the LCD and the external monitor in the following way:

LCD --> external Monitor--> both -->LCD

However cloning is possible for the Intel chipsets, see below.

At least as of Fedora 8 with intel chipset the following works: Sample Fn-F7 script

Problems with Intel chipsets

Disabling the internal LCD (e.g. when using an external Monitor) doesn't seem to work reliably.

  • For Xorg 7.022 one can clone the LCD display to an external monitor, adding the following lines to the Device section in the xorg.conf file:
Section "Device"
 Identifier	"Generic Video Card"
 Driver		"i810"
 Option          "Clone" "true"
 Option          "MonitorLayout" "CRT,LFP"

however you can not switch between these screens as described above, once you use FN-F7 the cloned display is lost.

  • i810switch doesn't have any effect. After disabling the LCD it is still on (but the status display of i810switch claims that is is switched off).
  • The following works with Fedora Core 6 on an X60s and CentOS 5 on X60: i810switch 0.6.5 with the patch found on http://thpinfo.com/2006/patches/i810switch_macbook_support.patch can switch between LCD and CRT (and initially CRT is off) (NOTE: The first hunk of this patch does not apply to the source, just remove it, it is unnecessary). This patch makes i810switch recognize the i915 chipset. It should thus be doable to use this with an ACPI event/action to do FnF7 switching. After installing i810switch and its i810rotate script and the missing ibm-acpi kernel module I did the following to achieve just that:

In /etc/rc.local:

modprobe ibm_acpi
echo enable,0x084c > /proc/acpi/ibm/hotkey

in /etc/acpi/events/videoswitch.conf:

event=ibm/hotkey HKEY 00000080 00001007
action=/etc/acpi/actions/video-rotate.sh

Make sure the event code is correct. If acpid doesn't seem to recognise the event, try to recopy it from acpi log.

in /etc/acpi/actions/video-rotate.sh

#!/bin/bash
exec /usr/sbin/i810rotate
  • With ibm-acpi, # echo lcd_disable >/proc/acpi/ibm/video works, but # echo lcd_enable >/proc/acpi/ibm/video doesn't work - so one can't enable it anymore after disabling it. (the strange thing is that when switching to a console with ctrlaltF1 the LCD display is used for it, so there must be some way to enable it but I can't find out how to control this in X). I've tried this with version 0.8 and version 0.11 of ibm-acpi.
    • FnF7 lets me enable the internal LCD after I disabled it with # echo lcd_disable >/proc/acpi/ibm/video on my X41 but it corrupts the crt out

Problems with ATI chipsets

  • It is a known issue of xorgs radeon driver that FnF7 doesn't work.

The # radeontool light off and # radeontool dac off commands will disable the LCD and CRT if they're been enabled before in the X server, but the corresponding # radeontool light on and # radeontool dac on will not work if the displays have were not enabled when the X server started. Also note that turing off the CRT using this command will not reduce power consumption, nor allow fglrx to enable power saving modes.

You might try the following: Hit Ctrl+Alt+F1 to switch to a console, hit Fn+F7 to switch video, hit Alt+F7 to switch back to X.


  • Similar problems exist with XFree86 4.3 and its radeon driver

You can switch the display off after switching to tty1 (STRG+ALT+F1) by

 * pressing FN+F7 or
 * executing echo crt_disable > /proc/acpi/ibm/video as root

You cannot do this under X11. The display is always on under X11. I tried

 * echo auto_disable > /proc/acpi/ibm/video
 * echo crt_disable > /proc/acpi/ibm/video
 * echo lcd_disable > /proc/acpi/ibm/video
 * pressing FN+F7

but none of the above had any effect. If you switch the display off, then start X or switch to it, the display will be activated automatically.

With the radeon driver

You can force the radeon driver to enable both CRT and LCD using Option "MonitorLayout" "LVDS,CRT" in the "Device" section of /etc/X11/xorg.conf.

With new versions of the radeon drivers that include Xorg RandR 1.2 support, you can fully control all outputs using the xrandr utility.

With the fglrx driver

Output switching with the Closed-Source ati-driver works: Just use # aticonfig --query-monitor and e.g. # aticonfig --enable-monitor...". You can use those two commands in a script, and bind them to FnF7. Or use Option "ForceMonitors" "lvds,crt1" in /etc/X11/xorg.conf.


Alternative solution: fglrx 8.28.8 will recognize FnF7 directly, if the key is enabled. This obviates the need for scripts which call aticonfig. To enable the hotkey, issue the command # echo enable,0xffff >/proc/acpi/ibm/hotkey. You'll want to have this run both at boot time, and after resume (on my T43, the hotkey mask is reset on resume). For Ubuntu, I've put a script with the command in both the /etc/acpi/resume.d, and /etc/acpi/start.d directories.

NOTE: This command will not enable video output swtiching on a T60p running Ubuntu 7.10. Executing this command will cause problem with the volume control keys and a few of the function keys (Ex. FN-F5 will no longer toggle Bluetooth).


Using kubuntu 7.04 with xorg-driver-fglrx 7.1.0-8.34.8+2.6.20.5-16.29, fglrx failed to recognise FnF7. However the following scripts can be used with acpi. Tested on a T42p.

  • /etc/acpi/events/ibmvideobtn
 # /etc/acpi/events/ibmvideobtn
 # This is called when the user presses the video button.
 event=ibm/hotkey HKEY 00000080 00001007
 action=/etc/acpi/ibm-video.sh
  • /etc/acpi/ibm-video.sh
 #!/bin/sh

 # ACPI Scripts run as root, but the display will not allow access
 # from other users.
 # Lookup the X process for :0, find the -auth command line option,
 # extract the name of the authority file and use this file
 # to gain access to the DISPLAY
 export XAUTHORITY=`ps -ef | grep /usr/bin/X | grep :0 | grep -v grep | \
   awk -F' -' '{for (i=1; i<=NF; i++) if (substr($i, 0, 4)=="auth") print $i}' \
   | awk '{print $2}'`

 export DISPLAY=:0

 # Query current monitor setup
 # Expect output from aticonfig such as:
 #   Connected monitors: crt1, lvds
 #   Enabled monitors: crt1
 #
 current=`aticonfig --query-monitor | tail -1 | awk -F: '{print $2}' | cut -c2-`

 # Cycle round to next monitor setup.
 # We loop through these settings
 # 1. CRT
 # 2. LCD
 # 3. CRT and LCD
 echo Current video: $current
 
 case $current in
   crt1)
     echo Switching to LCD
     aticonfig --enable-monitor=lvds
     ;;
   lvds)
     echo Switching to both LCD and CRT
     aticonfig --enable-monitor=crt1,lvds
     ;;
   "crt1, lvds")
     echo Switching to CRT
     aticonfig --enable-monitor=crt1
     ;;
   *)
     # Unexpected current monitor, change to internal LCD
     echo Unknown current mode, switching to LCD
     aticonfig --enable-monitor=lvds
 esac

With the VESA driver

I have fixed the problem on my T42 by switching to the generic VESA driver in xorg.conf, and rebooting, as mentioned on the xorg bug page above. None of the other solutions worked.

Related Links

Solutions

BIOSHotKeys

Try adding

Option "BiosHotKeys" "on"

to "Device" selection in /etc/xorg.conf. For some reason, this is not the default, and will cause xorg to ignore the BIOS's request to switch modes! This fixes the problem for an X22, with xorg 6.9.0.

It fixed this problem for a X31 with xorg 7.1.1 too, but as the CRT is the primary display in some Thinkpads (like in the X31), you can not switch back to the LCD (or both) if xorg has started with the CRT only or both mode, because it sets the resolution and or refresrate to high for the LCD.