[Debian-eeepc-devel] [PATCH] vga-toggle: Add support for KMS
Santi
santi at agolina.net
Sat Jun 13 22:20:11 UTC 2009
When KMS (kernel mode setting) is used the output names have
a number in the end (VGA1 and LVDS1).
---
Hi,
at the end I haven't quoted shell variable to follow how it is quoted
in other scripts.
debian/changelog | 4 ++++
etc/acpi/actions/vga-toggle.sh | 12 +++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index b4e60be..7146860 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,10 @@ eeepc-acpi-scripts (1.1.1) unstable; urgency=low
[ Raphael Geissert ]
* Allow fine-grained control over the lid-closing action.
+ [ Santi Béjar]
+ * Add support for KMS in vga-toggle: when KMS (kernel mode setting) is
+ used the output names have a number in the end (VGA1 and LVDS1).
+
-- Darren Salt <linux at youmustbejoking.demon.co.uk> Mon, 25 May 2009 11:25:50 +0100
eeepc-acpi-scripts (1.1.0) unstable; urgency=low
diff --git a/etc/acpi/actions/vga-toggle.sh b/etc/acpi/actions/vga-toggle.sh
index 4321520..cf34456 100755
--- a/etc/acpi/actions/vga-toggle.sh
+++ b/etc/acpi/actions/vga-toggle.sh
@@ -10,8 +10,14 @@ if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
. $FUNC_LIB
# return: 0 on disconnect, 1 on connected vga, 2 else
+# set VGA (and LVDS) to the output name, VGA or VGA1 (LVDS or LVDS1)
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 )
+ # To not call xrandr again
+ NUM=${VGA##VGA}
+ LVDS=LVDS$NUM
case "$STATUS" in
disconnected*)
return 0
@@ -30,9 +36,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