diff -u 915resolution-0.5/debian/control 915resolution-0.5/debian/control --- 915resolution-0.5/debian/control +++ 915resolution-0.5/debian/control @@ -11,6 +11,7 @@ Replaces: 855resolution Conflicts: 855resolution Provides: 855resolution +Recommends: vbetool (>> 0.5-1) Description: resolution modify tool for Intel graphic chipset 915resolution is a tool to modify the video BIOS of the 800 and 900 series Intel graphics chipsets. This includes the 845G, diff -u 915resolution-0.5/debian/915resolution.init 915resolution-0.5/debian/915resolution.init --- 915resolution-0.5/debian/915resolution.init +++ 915resolution-0.5/debian/915resolution.init @@ -2,41 +2,84 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin PROG=/usr/sbin/915resolution +VBETOOL=/usr/sbin/vbetool NAME=915resolution DESC=915resolution +CONFIG=/etc/default/915resolution test -x $DAEMON || exit 0 # Include 915resolution defaults if available -if [ -f /etc/default/915resolution ] ; then - . /etc/default/915resolution +if [ -f "$CONFIG" ] ; then + . "$CONFIG" fi -if [ "$MODE" = "" ] || [ "$XRESO" = "" ] || [ "$YRESO" = "" ] ; then +if [ "$MODE" = auto -a \! -x "$VBETOOL" ] \ + || [ "$MODE" != auto -a \( -z "$MODE" -o -z "$XRESO" -o -z "$YRESO" \) ] ; then echo "*** Your 915resolution hasn't been configured! ***" echo "Please read /usr/share/doc/915resolution/README.Debian and define" - echo "MODE, XRESO, and YRESO." + echo "MODE, XRESO, and YRESO or install the 'vbetool' package." exit 0 fi +auto_select_modes() +{ + if [ ! -x "$VBETOOL" ] || ! panelsize=`$VBETOOL vbecall panelsize` ; then + echo "*** Your 915resolution was not automatically configured! ***" + echo "Please read /usr/share/doc/915resolution/README.Debian then define" + echo "MODE, XRESO, and YRESO manually in $CONFIG or install 'vbetool'." + exit 1 + fi + + # If the native panel-size is already in the BIOS mode list, we + # don't have to do anything, yippee! + bios_list=`$PROG -l` + if echo "$bios_list" | grep -q "^Mode .* $panelsize" ; then + #echo 'Correct panel-size is already listed, skipping' + return + fi + + # For want of a better approach to selecting modelines for stealing;... + # this expression grabs us the highest *numbered* mode in each + # bit-depth that the BIOS already lists. + # + # An argh for using the highest mode-number, rather than the + # highest resolution is that if we've already reprogrammed the + # mode to be a lower resolution it will no longer be the highest. + # If this has changed over a suspend cycle, that consequences + # might not be so good. -Paul Sladen + target_modes=`echo "$bios_list" | awk '/^Mode [^T]/{sub(",","",$4); print $5,$4,$2}' | tac | sort -n -u | cut -d' ' -f3` + + for m in $target_modes ; do + # The 'tr' converts '1024x768' -> '1024' '768' + # and the bitdepth is missed off because we have one of each depth + $PROG $m $(echo $panelsize | tr x ' ') + done +} + set -e case "$1" in - start) + start|restart|force-reload) echo -n "Starting $DESC: " - $PROG $MODE $XRESO $YRESO $BIT + if [ "$MODE" = "auto" ] ; then + auto_select_modes + else + $PROG $MODE $XRESO $YRESO $BIT + fi echo "$NAME." ;; stop) #echo -n "Stopping $DESC: " #echo "$NAME." ;; - restart|force-reload) - #echo -n "Stopping $DESC: " - #echo "$NAME." - echo -n "Starting $DESC: " - $PROG $MODE $XRESO $YRESO $BIT - echo "$NAME." - ;; +# Move this to 'start' so there is only one code-path +# restart|force-reload) +# #echo -n "Stopping $DESC: " +# #echo "$NAME." +# echo -n "Starting $DESC: " +# $PROG $MODE $XRESO $YRESO $BIT +# echo "$NAME." +# ;; *) N=/etc/init.d/$NAME # echo "Usage: $N start" >&2 diff -u 915resolution-0.5/debian/49-915-resolution-set.sh 915resolution-0.5/debian/49-915-resolution-set.sh --- 915resolution-0.5/debian/49-915-resolution-set.sh +++ 915resolution-0.5/debian/49-915-resolution-set.sh @@ -2,7 +2,7 @@ if [ -x /usr/sbin/915resolution ]; then . /etc/default/915resolution - if [ "$MODE" != "" ] && [ "$XRESO" != "" ] && [ "$YRESO" != "" ]; then + if [ "$MODE" = auto ] || [ -n "$MODE" -a -n "$XRESO" -a -n "$YRESO" ] ; then /etc/init.d/915resolution start; fi fi diff -u 915resolution-0.5/debian/915resolution.default 915resolution-0.5/debian/915resolution.default --- 915resolution-0.5/debian/915resolution.default +++ 915resolution-0.5/debian/915resolution.default @@ -2,9 +2,12 @@ # 915resolution default # # find free modes by /usr/sbin/915resolution -l -# and set it to MODE -# -MODE= +# and set it to MODE or set to 'MODE=auto' +# +# With 'auto' detection, the panel-size will be fetched from the VBE +# BIOS if possible and the highest-numbered mode in each bit-depth +# will be overwritten with the detected panel-size. +MODE=auto # # and set resolutions for the mode. # diff -u 915resolution-0.5/debian/changelog 915resolution-0.5/debian/changelog --- 915resolution-0.5/debian/changelog +++ 915resolution-0.5/debian/changelog @@ -1,3 +1,11 @@ +915resolution (0.5-1ubuntu2panelid2) dapper; urgency=low + + * Use 'vbetool' to get the native panel resolution from the hardware + if the configuration file is set with 'MODE=auto' and make this + the default. + + -- Paul Sladen Wed, 15 Mar 2006 18:34:06 +0000 + 915resolution (0.5-1ubuntu2) dapper; urgency=low * Run 915resolution on acpi resume (Malone #31156)