Difference between revisions of "Problem with video output switching"

From ThinkWiki
Jump to: navigation, search
(Problems with ATI chipsets: No problems with fglrx)
(Related Links)
 
(38 intermediate revisions by 18 users not shown)
Line 1: Line 1:
 
==Affected Models==
 
==Affected Models==
*ThinkPad {{T40}}, {{T40p}}, {{T41}}, {{T41p}}, {{T42}}, {{T42p}}, {{T43}}, {{T43p}}
+
*ThinkPad {{T40}}, {{T40p}}, {{T41}}, {{T41p}}, {{T42}}, {{T42p}}, {{T43}}, {{T43p}}, {{T60}}, {{T61}}
*ThinkPad {{X23}}, {{X41}}
+
*ThinkPad {{R61}}
 +
*ThinkPad {{X22}}, {{X23}}, {{X31}}, {{X41}}, {{X60}}, {{X60s}}
  
 
==Problem Description==
 
==Problem Description==
It is not possible, using the FN-F7 key, to switch between the LCD and the external monitor in the following way
+
External video output is not working, or it is not possible, using the {{key|Fn}}{{key|F7}} key, to switch between the LCD and the external monitor in the following way:
 
  LCD --> external Monitor--> both -->LCD
 
  LCD --> external Monitor--> both -->LCD
however ''cloning'' is possible for the Intel chipsets, see below.
+
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===
 
===Problems with Intel chipsets===
Line 17: Line 20:
 
   Option          "Clone" "true"
 
   Option          "Clone" "true"
 
   Option          "MonitorLayout" "CRT,LFP"
 
   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.
+
however you can not switch between these screens as described above, once you use {{key|Fn}}{{key|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 {{key|Fn}}{{key|F7}} switching. After installing i810switch and its i810rotate script and the missing [[ibm-acpi]] kernel module I did the following to achieve just that:
  
* 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).
+
In /etc/rc.local:
 +
modprobe ibm_acpi
 +
echo enable,0x084c > /proc/acpi/ibm/hotkey
  
* i855crt works see: http://stefan.desire.ch/howto/x41debian/ for details.
+
in /etc/acpi/events/videoswitch.conf:
 +
event=ibm/hotkey HKEY 00000080 00001007
 +
action=/etc/acpi/actions/video-rotate.sh
  
* With [[ibm-acpi]], {{cmdroot|echo lcd_disable >/proc/acpi/ibm/video}} works, but {{cmdroot|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 {{key|ctrl}}{{key|alt}}{{key|F1}} 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]].
+
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
 +
 
 +
* i855crt works see: http://stefan.desire.ch/howto/x41debian/#graphics for details.
 +
 
 +
* With [[ibm-acpi]], {{cmdroot|echo lcd_disable >/proc/acpi/ibm/video}} works, but {{cmdroot|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 {{key|Ctrl}}{{key|Alt}}{{key|F1}} 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]].
 +
** {{key|Fn}}{{key|F7}} lets me enable the internal LCD after I disabled it with {{cmdroot|echo lcd_disable >/proc/acpi/ibm/video}} on my X41 but it corrupts the crt out
  
 
===Problems with ATI chipsets===
 
===Problems with ATI chipsets===
 
*It is a [http://bugs.freedesktop.org/show_bug.cgi?id=2000 known issue] of xorgs radeon driver that {{key|Fn}}{{key|F7}} doesn't work.
 
*It is a [http://bugs.freedesktop.org/show_bug.cgi?id=2000 known issue] of xorgs radeon driver that {{key|Fn}}{{key|F7}} doesn't work.
  
You can force the <tt>radeon</tt> driver to enable both CRT and LCD using <tt>Option "MonitorLayout" "LVDS,CRT"</tt> in the <tt>"Device"</tt> section of {{path|/etc/X11/xorg.conf}}. The analogous option for [[fglrx]] is <tt>Option "ForceMonitors" "lvds,crt1"</tt>
+
The {{cmdroot|radeontool light off}} and {{cmdroot|radeontool dac off}} commands will disable the LCD and CRT if they're been enabled before in the X server, but the corresponding {{cmdroot|radeontool light on}} and {{cmdroot|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 {{key|Ctrl}}{{key|Alt}}{{key|F1}} to switch to a console
 +
# Hit {{key|Fn}}{{key|F7}} to switch video
 +
# Hit {{key|Alt}}{{key|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 ({{key|Ctrl}}{{key|Alt}}{{key|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 <tt>radeon</tt> driver to enable both CRT and LCD using <tt>Option "MonitorLayout" "LVDS,CRT"</tt> in the <tt>"Device"</tt> section of {{path|/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 <tt>xrandr</tt> utility.
 +
 
 +
====With the fglrx driver====
 +
Output switching with the Closed-Source ati-driver works: Just use {{cmdroot|aticonfig --query-monitor}} and e.g. {{cmdroot |aticonfig  --enable-monitor..."}}. You can use those two commands in a script, and bind them to {{key|Fn}}{{key|F7}}. Or use  <tt>Option "ForceMonitors" "lvds,crt1"</tt> in {{path|/etc/X11/xorg.conf}}.
 +
 
 +
----
 +
 
 +
Alternative solution: {{path|fglrx}} 8.28.8 will recognize {{key|Fn}}{{key|F7}} directly, if the key is enabled. This obviates the need for scripts which call aticonfig. To enable the hotkey, issue the command {{cmdroot|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 {{path|/etc/acpi/resume.d}}, and {{path|/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 {{key|Fn}}{{key|F7}}.  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.
 +
 
 +
===Problems with NVidia chipsets===
  
The {{cmdroot|radeontool light off}} and {{cmdroot|radeontool dac off}} commands will disable the LCD and CRT if they're been enabled before in the X server, but the corresponding {{cmdroot|radeontool light on}} and {{cmdroot|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.
+
T61 with NVidia Quadro 140 NVS chipset also doesn't switch video output on Fn+F7 key
 +
(tested 2008-05-28 with Ubuntu 8.04 amd64 and nvidia proprietory driver).
  
You might try the following: Hit Ctrl+Alt+F1 to switch to a console, hit Fn+F7 to switch video, hit Ctrl+Alt+F7 to switch back to X.
+
If the nvidia proprietory driver is used: it includes a tool "nvidia-settings". With this
 +
tool you can enable the other output (select "configure" and "Twinhead" and then disable
 +
the first output to switch displays). Pressing "Apply" is enough, no need to save the config -
 +
which is best left with the save default (LVDS enabled).
  
====fglrx-Driver====
+
A simple command line tool to switch displays is here:
Output switching with the Closed-Source ati-driver works: Just use {{cmdroot|aticonfig --query-monitor}} and e.g. {{cmdroot |aticonfig  --enable-monitor..."}}. You can use those two commands in a script, and bind them to {{key|Fn}}{{key|F7}}
+
*[[Tool for nvidia video output switching]]
  
 
==Related Links==
 
==Related Links==
*https://bugs.freedesktop.org/show_bug.cgi?id=2000
+
* https://bugs.freedesktop.org/show_bug.cgi?id=2000
 +
* [[How_to_get_special_keys_to_work]]
  
 
==Solutions==
 
==Solutions==
None (yet).
+
 
 +
====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.

Latest revision as of 04:05, 31 October 2009

Affected Models

Problem Description

External video output is not working, or it is not possible, using the FnF7 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 FnF7 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:

  1. Hit CtrlAltF1 to switch to a console
  2. Hit FnF7 to switch video
  3. Hit AltF7 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 (CtrlAltF1) 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.

Problems with NVidia chipsets

T61 with NVidia Quadro 140 NVS chipset also doesn't switch video output on Fn+F7 key (tested 2008-05-28 with Ubuntu 8.04 amd64 and nvidia proprietory driver).

If the nvidia proprietory driver is used: it includes a tool "nvidia-settings". With this tool you can enable the other output (select "configure" and "Twinhead" and then disable the first output to switch displays). Pressing "Apply" is enough, no need to save the config - which is best left with the save default (LVDS enabled).

A simple command line tool to switch displays is here:

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.