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,78 @@ 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 ] && [ -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." exit 0 fi +auto_select_modes() +{ + panelsize=`$VBETOOL vbecall panelsize` + panelsize_success="$?" + + if [ ! $panelsize_success ] ; 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." + 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` + echo "$bios_list" | grep -q "^Mode $panelsize" && exit 0 + #echo 'Correct panel-size is already listed, skipping' + + # 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. + 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 mode + $PROG $m $(echo $resolution | tr , ' ') + done +} + set -e case "$1" in - start) + start|restart|force-reload) echo -n "Starting $DESC: " - $PROG $MODE $XRESO $YRESO $BIT + if [ "$MODE" = "auto" -a -x "$VBETOOL" ] ; 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 ] && [ -z "$MODE" -o -z "$XRESO" -o -z "$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,10 @@ +915resolution (0.5-1ubuntu2panelid1) dapper; urgency=low + + * Use 'vbetool' to get the native panel resolution from the hardware + if the configuration file is set to 'DETECT' + + -- Paul Sladen Mon, 13 Mar 2006 19:25:21 +0000 + 915resolution (0.5-1ubuntu2) dapper; urgency=low * Run 915resolution on acpi resume (Malone #31156)