On Sat, 27 Mar 2010, Juha Heinanen wrote:

> when i boot my 1101ha without external monitor connected, and then
> connect it after boot, xrand only shows the internal Screen 0 "default"
> monitor. nothing changes, if i press Fn-F8 key although acli_listen
> reports
>
> $ acpi_listen
> video/switchmode VMOD 00000080 00000000
> hotkey ASUS010:00 00000031 00000001
> video/switchmode VMOD 00000080 00000000
> hotkey ASUS010:00 00000032 00000002
> video/switchmode VMOD 00000080 00000000
> hotkey ASUS010:00 00000030 00000002
> video/switchmode VMOD 00000080 00000000
> hotkey ASUS010:00 00000031 00000002
>
> if i boot 1101ha so that external monitor is connected, i first get the
> bios screen on both external and internal monitor, but grub screen
> appears only on the external monitor and the internal monitor gets
> turned off.  if i then boot linux, only external monitor is found and
> the internal one stays turned off.
>
> does anyone know how to make 1101ha detect both monitors at the same
> time?

Reason is /etc/acpi/actions/vga-toggle.sh, which is triggerd by that
button, does not have any notion of what VGA and LVDS is, as:

        # xrandr -q

returns (in my case):

        Screen 0: minimum 800 x 600, current 1368 x 768, maximum 1368 x 768
        default connected 1368x768+0+0 0mm x 0mm
           1366x768        0.0
           1024x768        0.0
           800x600        61.0
           1368x768        0.0*

vga-toggle.sh is parsing the output from 'xrandr -q' for the VGA and LVDS
strings, does not do error ckecks and using empty strings for screen names
attempts to switch screens, like in:

        xrandr --output $VGA --off --output $LVDS --auto

The attached patch will at least give you a hint (in /var/log/syslog)
about what's going on.  The patch cleans up some parts of the script too.

Another problem is that the 'eeepc-acpi-scripts' package, uses
'/usr/bin/xrandr' in '/etc/acpi/actions/vga-toggle.sh' script but does not
depend on package 'x11-xserver-utils'.


Cheers,

-- 
Cristian
diff --git a/etc/acpi/actions/vga-toggle.sh b/etc/acpi/actions/vga-toggle.sh
index ffb0a9b..b831c32 100755
--- a/etc/acpi/actions/vga-toggle.sh
+++ b/etc/acpi/actions/vga-toggle.sh
@@ -1,43 +1,60 @@
 #!/bin/sh
 
 # do nothing if package is removed
-PKG=eeepc-acpi-scripts
-FUNC_LIB=/usr/share/$PKG/functions.sh
-DEFAULT=/etc/default/$PKG
-[ -e "$FUNC_LIB" ] || exit 0
+pkg=eeepc-acpi-scripts
+func_lib=/usr/share/$pkg/functions.sh
+default=/etc/default/$pkg
+logit="logger -t${0##*/}[$$]"
 
-if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
-. $FUNC_LIB
+VGA=
+LVDS=
 
-# return: 0 on disconnect, 1 on connected vga, 2 else
+[ -r $func_lib ] || {
+    $logit -p ERR -- failed to source $func_lib; broken $pkg package
+    exit 1
+}
+
+[ ! -r "$default" ] || . $default
+. $func_lib
+
+# return: 0 on disconnect, 1 on connected vga, else 2
 # set VGA (and LVDS) to the output name, VGA or VGA1 (LVDS or LVDS1)
 getvga_status(){
-    STATUSTEXT="$( xrandr -q )"
-    STATUSLINE=$( echo "$STATUSTEXT" | grep ^VGA | head -n1 )
-    STATUS=$( echo "$STATUSLINE" | cut -d ' ' -f 2,3 )
-    VGA=$( echo "$STATUSLINE" | cut -d ' ' -f 1 )
-    LVDS=$( echo "$STATUSTEXT" | grep ^LVDS | head -n1 | cut -d ' ' -f 1 )
-    case "$STATUS" in
-    disconnected*)
-        return 0
-        ;;
-    connected\ \(*)
-        return 1
-        ;;
-    *)
-        return 2
-        ;;
+    local statustext statusline status
+
+    statustext=$(xrandr -q)
+    statusline=$(echo "$statustext" | grep ^VGA | head -n1)
+    status=$(echo "$statusline" | cut -d ' '  -f 2,3)
+    VGA=$(echo "$statusline" | cut -d ' ' -f 1)
+    LVDS=$(echo "$statustext" | grep ^LVDS | head -n1 | cut -d ' '  -f 1)
+
+    case $status in
+	disconnected*)
+            ;;
+	connected\ \(*)
+            return 1
+            ;;
+	*)
+            return 2
+            ;;
     esac
 }
 
 detect_x_display
-getvga_status;
-# handle return value
-case $? in
-    1)
-        xrandr --output $VGA ${VGA_ON:---auto} --output $LVDS ${LVDS_OFF:---off}
-        ;;
-    *)
-        xrandr --output $VGA --off --output $LVDS --auto
-esac
+getvga_status
 
+if [ "$VGA" ] && [ "$LVDS" ]; then
+    # handle getvga_status return value
+    case $? in
+	1)
+            xrandr --output $VGA ${VGA_ON:---auto} \
+		   --output $LVDS ${LVDS_OFF:---off}
+            ;;
+	*)
+            xrandr --output $VGA --off --output $LVDS --auto
+	    ;;
+    esac
+else
+    $logit -p ERR "VGA '$VGA' and/or LVDS '$LVDS' missing"
+    exit 1
+fi
_______________________________________________
Debian-eeepc-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-eeepc-devel

Reply via email to