[Debian-eeepc-devel] [PATCH] vga-toogle: Add support for KMS

Santi santi at agolina.net
Sat Jun 13 14:03:54 UTC 2009


When KMS (kernel mode setting) is used the VGA output name is VGA1,
not VGA.
---
 etc/acpi/actions/vga-toggle.sh |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/etc/acpi/actions/vga-toggle.sh b/etc/acpi/actions/vga-toggle.sh
index 4321520..c1809e3 100755
--- a/etc/acpi/actions/vga-toggle.sh
+++ b/etc/acpi/actions/vga-toggle.sh
@@ -10,8 +10,11 @@ if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
 . $FUNC_LIB
 
 # return: 0 on disconnect, 1 on connected vga, 2 else
+# set VGA to the VGA output name (normally VGA or VGA1)
 getvga_status(){
-    STATUS=$( xrandr -q | grep VGA | cut -d ' ' -f 2,3 )
+    STATUSLINE=$( xrandr -q | grep VGA)
+    STATUS=$( echo $STATUSLINE | cut -d ' ' -f 2,3 )
+    VGA=$( echo $STATUSLINE | cut -d ' ' -f 1 )
     case "$STATUS" in
     disconnected*)
         return 0
@@ -30,9 +33,9 @@ getvga_status;
 # handle return value
 case $? in
     1)
-        xrandr --output VGA ${VGA_ON:---auto} --output LVDS ${LVDS_OFF:---off}
+        xrandr --output $VGA ${VGA_ON:---auto} --output LVDS ${LVDS_OFF:---off}
         ;;
     *)
-        xrandr --output VGA --off --output LVDS --auto
+        xrandr --output $VGA --off --output LVDS --auto
 esac
 
-- 
1.6.3




More information about the Debian-eeepc-devel mailing list