[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] determine resolution with xdpyinfo instead of xrandr



> > I have seen xrandr fail on some systems (e.g. Asus K401J) with the
> > following error message:
> > 
> > xrandr: Output Unknown-2 is not disconnected but has no modes
> 
> can you reproduce this with squeeze and sid?

Finally I found the time to test this with sid. Fortunately, the issue is not 
reproduceable with sid but I still feel uncomfortable to rely on xrandr after 
being hit by this bug.

> +#################################################################
> +# xrandr failed on Asus K401J with error message:               #
> +# xrandr: Output Unknown-2 is not disconnected but has no modes #
> +# therefore we use now xdpyinfo (see below)                     #
> +#################################################################
> 
> doesn't belong into the code, but into the commit message.

When someone else starts to work on this code I doubt that (s)he will work 
through all commit messages but only look at the source code. Therefore I 
would leave this info as a comment in the source. I consider detailled source 
code commentation a good thing.

> rather than commenting out, you want to replace things.

dito.

> useless use of grep (awk has grep built-in with //). you might want to
> trim some other things too, and add a depends to the package containing
> xdpyinfo.

Thanks for the grep/awk hint. I attached an updated patch.

Ronny

-- 
Ronny Standtke                 Fachhochschule Nordwestschweiz
Dozent Medienpädagogik / ICT   Pädagogische Hochschule
Telefon: +41 32 627 92 47      Obere Sternengasse 7
Mobil  : +41 79 786 81 82      4502 Solothurn
diff --git a/debian/control b/debian/control
index b183393..a619108 100644
--- a/debian/control
+++ b/debian/control
@@ -11,6 +11,7 @@ Vcs-Git: git://live.debian.net/git/live-startscripts.git
 
 Package: live-startscripts
 Architecture: all
+Depends: x11-utils
 Suggests: armagetronad, billard-gl, chromium, enigma, foobillard, gcompris, glest, neverball, neverputt, pathological, pingus, planetpenguin-racer, stellarium, tomatoes, trigger, wesnoth, xmoto
 Recommends: rsync
 Description: Debian Live application startscripts
diff --git a/functions/resolution.sh b/functions/resolution.sh
index 673c81d..f33ee4b 100755
--- a/functions/resolution.sh
+++ b/functions/resolution.sh
@@ -1,9 +1,19 @@
 #!/bin/sh
 
-_RESOLUTION="$(xrandr)"
+#################################################################
+# xrandr failed on Asus K401J with error message:               #
+# xrandr: Output Unknown-2 is not disconnected but has no modes #
+# therefore we use now xdpyinfo (see below)                     #
+#################################################################
+#_RESOLUTION="$(xrandr)"
+#
+#read x x x x x x x _RESOLUTION_X x _RESOLUTION_Y x << EOF
+#${_RESOLUTION}
+#EOF
+#
+#_RESOLUTION_Y="${_RESOLUTION_Y%,}"
 
-read x x x x x x x _RESOLUTION_X x _RESOLUTION_Y x << EOF
-${_RESOLUTION}
-EOF
-
-_RESOLUTION_Y="${_RESOLUTION_Y%,}"
+#################################################################
+# this version with with xdpyinfo seems to be more reliable     #
+#################################################################
+eval $(LC_ALL=C; xdpyinfo | awk '/dimensions/ {print $2}' | awk -Fx '{print "_RESOLUTION_X=" $1 " _RESOLUTION_Y=" $2}')

Reply to: