On Mon, Sep 13, 2004 at 04:50:18PM -0400, Jay Berkenbilt wrote:
> > The X Strike Force, including Fabio Massimo Di Nitto (our XFree86 package
> > release manager) and myself are trying to see to it that 4.3.0.dfsg.1-8
> > makes it into sarge.
> >
> > Some changes for -7 were deferred to -8 due to the massive number of
> > changes in -7.
>
> Thanks for the update, and for mentioning trying to get -8 into
> Sarge. I noticed that the bug wasn't fixed for -7 and that it had
> been pushed to -8 in the to do list along with several other debconf
> changes. If you're interested in help with testing, please let me
> know and I'll see what I can do. Thanks for all you do and for
> finding the time to keep me informed through all of it.
Please let me know what you think of the following logic. It includes your
patch, along with some other enhancements as well as better instrumentation
and internal documentation.
I have committed this to the XSF SVN XFree86 repo's debconf-overhaul branch
as revision 1858.
configure_monitor () {
# syntax: configure_monitor
#
# Ask debconf questions that determine the contents of the "Monitor" section
# of the XF86Config-4 file.
local default_horiz_sync default_identifier default_vert_refresh \
edid_dump edid_horiz_sync edid_id edid_vert_refresh func
# $DEFAULT_MODES is global; keep it that way, because we need its value in
# other functions, like configure_display_modes_and_depth().
func="configure_monitor"
# Validate function arguments.
if [ -n "$*" ]; then
warn "$func(): called with bogus arguments $@"
fi
set_db_priority "high"
default_horiz_sync="28-50"
default_vert_refresh="43-75"
db_fget xserver-xfree86/config/monitor/identifier seen
if [ "$RET" = "false" ]; then
trace "$func(): xserver-xfree86/config/monitor/identifier has not been seen"
fi
db_get xserver-xfree86/config/monitor/identifier
trace "$func(): xserver-xfree86/config/monitor/identifier is already set to" \
"\"$RET\""
# The horiz-sync and vert-refresh questions may have answers even though they
# haven't been seen; autodetection, pre-loading, and the simple and medium
# selection methods can fill them in.
db_fget xserver-xfree86/config/monitor/horiz-sync seen
if [ "$RET" = "false" ]; then
trace "$func(): xserver-xfree86/config/monitor/horiz-sync has not been seen"
fi
db_get xserver-xfree86/config/monitor/horiz-sync
trace "$func(): xserver-xfree86/config/monitor/horiz-sync is already set to" \
"\"$RET\""
db_fget xserver-xfree86/config/monitor/vert-refresh seen
if [ "$RET" = "false" ]; then
trace "$func(): xserver-xfree86/config/monitor/vert-refresh has not been" \
"seen"
fi
db_get xserver-xfree86/config/monitor/vert-refresh
trace "$func(): xserver-xfree86/config/monitor/vert-refresh is already set" \
"to \"$RET\""
# if configuring for the first time, ask if user wants to autodetect
if [ -z "$RECONFIGURE" ]; then
if which get-edid >/dev/null 2>&1; then
auto_answer db_input "$PRIORITY" xserver-xfree86/autodetect_monitor \
"false"
db_get xserver-xfree86/autodetect_monitor
if [ "$RET" = "true" ]; then
set +e
edid_dump=$( (get-edid | parse-edid) 2>/dev/null)
set -e
if [ $? -eq 0 ]; then
# quite crude
edid_id=$(echo "$edid_dump" | grep Identifier | cut -f2 -d\")
if [ -n "$edid_id" ]; then
trace "$func(): get-edid reports monitor identifier of \"$edid_id\""
default_identifier="$edid_id"
else
trace "$func(): got null monitor identifier from get-edid"
fi
# even cruder
edid_horiz_sync=$(echo "$edid_dump" | grep HorizSync \
| awk '{print $2}')
edid_vert_refresh=$(echo "$edid_dump" | grep VertRefresh \
| awk '{print $2}')
# get-edid may succeed but be unable to return info anyway
if [ -n "$edid_horiz_sync" ]; then
trace "$func(): get-edid reports horizonal sync of" \
"\"$edid_horiz_sync\""
default_horiz_sync="$edid_horiz_sync"
else
trace "$func(): get-edid returned blank hsync"
fi
if [ -n "$edid_vert_refresh" ]; then
trace "$func(): get-edid reports vertical refresh of" \
"\"$edid_vert_refresh\""
default_vert_refresh="$edid_vert_refresh"
else
trace "$func(): get-edid returned blank vrefresh"
fi
else
trace "$func(): get-edid returned an error"
fi
else
trace "$func(): user declined monitor autodetection"
fi
else
trace "$func(): could not autodetect monitor frequencies; get-edid not" \
"found"
fi
else
trace "$func(): not prompting for monitor autodetection; reconfiguring"
fi
# priority of xserver-xfree86/config/monitor/identifier
set_db_priority "low"
# monitor identifier; try to set a sensible default
if [ -z "$default_identifier" ]; then
# fall back to some language-specific generic text
# TODO: make this a read-only debconf template
case "${LC_ALL:-${LC_MESSAGES:-$LANG}}" in
ca_*) default_identifier="Monitor genèric" ;;
da_*) default_identifier="Standard Skærm" ;;
de_*) default_identifier="Standardbildschirm" ;;
es_*) default_identifier="Monitor genérico" ;;
fr_*) default_identifier="Écran générique" ;;
# gl
it_*) default_identifier="Monitor Generico" ;;
# ja
# nl
pt_BR) default_identifier="Monitor Genérico" ;;
# ru
# sv
*) default_identifier="Generic Monitor" ;;
esac
fi
# this question requires input validation
MAY_BE_NULL= auto_answer validate_string_db_input "$PRIORITY" \
xserver-xfree86/config/monitor/identifier "$default_identifier"
# Set priority of xserver-xfree86/config/monitor/selection-method based on
# whether or not we were able to retrieve the monitor's sync ranges via EDID.
#
# If we did get monitor sync range information via EDID, pre-answer the
# selection method with "Advanced". Otherwise, ask the user if the monitor is
# an LCD.
if [ -n "$edid_horiz_sync" ] && [ -n "$edid_vert_refresh" ]; then
trace "$func(): \$edid_horiz_sync: \"$edid_horiz_sync\";" \
"\$edid_vert_refresh: \"$edid_vert_refresh\"; setting question" \
"priority to low"
set_db_priority "low"
db_subst xserver-xfree86/config/monitor/selection-method default "Advanced"
else
trace "$func(): at least of one of hsync \"$edid_horiz_sync\" or vrefresh" \
"\"$edid_vert_refresh\" is null; setting question priority to medium"
set_db_priority "medium"
# Flat panels are more and more common, so set the selection method default
# to "Medium".
db_subst xserver-xfree86/config/monitor/selection-method default "Medium"
# Ask whether the monitor is an LCD, and eliminate the "Simple" selection
# method from the list of choices if it is.
auto_answer db_input "$PRIORITY" xserver-xfree86/config/monitor/lcd "false"
db_get xserver-xfree86/config/monitor/lcd
trace "$func(): xserver-xfree86/config/monitor/lcd is $RET"
if [ "$RET" = "true" ]; then
db_subst xserver-xfree86/config/monitor/selection-method choices \
"Medium, Advanced"
else # not an LCD
db_subst xserver-xfree86/config/monitor/selection-method choices \
"Simple, Medium, Advanced"
fi
fi
trace "$func(): question priority for monitor selection method and related" \
"questions is $PRIORITY"
run db_input "$PRIORITY" xserver-xfree86/config/monitor/selection-method
db_get xserver-xfree86/config/monitor/selection-method
trace "$func(): using \"$RET\" selection method"
case "$RET" in
Simple)
run db_input "$PRIORITY" xserver-xfree86/config/monitor/screen-size
db_go
db_get xserver-xfree86/config/monitor/screen-size
trace "$func(): screen size is \"$RET\""
case "$RET" in
'Up to 14 inches (355 mm)')
db_set xserver-xfree86/config/monitor/horiz-sync "28-33"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="640x480"
;;
'15 inches (380 mm)')
db_set xserver-xfree86/config/monitor/horiz-sync "28-50"
db_set xserver-xfree86/config/monitor/vert-refresh "43-75"
DEFAULT_MODES="800x600, 640x480"
;;
'17 inches (430 mm)')
db_set xserver-xfree86/config/monitor/horiz-sync "30-70"
db_set xserver-xfree86/config/monitor/vert-refresh "50-160"
DEFAULT_MODES="1024x768, 800x600, 640x480"
;;
'19-20 inches (480-510 mm)')
db_set xserver-xfree86/config/monitor/horiz-sync "30-100"
db_set xserver-xfree86/config/monitor/vert-refresh "50-160"
DEFAULT_MODES="1152x864, 1024x768, 800x600, 640x480"
;;
'21 inches (530 mm) or more')
db_set xserver-xfree86/config/monitor/horiz-sync "30-130"
db_set xserver-xfree86/config/monitor/vert-refresh "50-160"
DEFAULT_MODES="1280x960, 1152x864, 1024x768, 800x600, 640x480"
;;
esac
;;
Medium)
run db_input "$PRIORITY" xserver-xfree86/config/monitor/mode-list
db_go
db_get xserver-xfree86/config/monitor/mode-list
trace "$func(): mode selected from list is \"$RET\""
# The mode and range information below is adapted from the built-in
# modeline definitions in the XFree86 source tree; specifically
# xc/programs/Xserver/hw/xfree86/etc/vesamodes and
# xc/programs/Xserver/hw/xfree86/etc/extramodes. The rule of thumb is to
# set the sync ranges based on the hsync and vrefresh values used by the
# selected mode, plus a little bit of "headroom" to allow other modes to
# be used (as long as they don't push the hardware much harder than the
# selected one) and a margin of error (e.g., if the video driver or video
# card overdrives the monitor just a little bit).
case "$RET" in
"640x480 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "28-33"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="640x480"
;;
"640x480 @ 72Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "28-38"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="640x480"
;;
"800x600 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "28-38"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="800x600"
;;
"800x600 @ 72Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "28-48"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="800x600"
;;
"800x600 @ 85Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-54"
db_set xserver-xfree86/config/monitor/vert-refresh "50-85"
DEFAULT_MODES="800x600"
;;
"832x624 @ 75Hz")
# This is a Macintosh (m68k and OldWorld PowerPC) mode.
db_set xserver-xfree86/config/monitor/horiz-sync "30-50"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="832x624"
;;
"1024x768 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "28-49"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="1024x768"
;;
"1024x768 @ 70Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-57"
db_set xserver-xfree86/config/monitor/vert-refresh "43-72"
DEFAULT_MODES="1024x768"
;;
"1024x768 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-60"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1024x768"
;;
"1152x768 @ 54.8Hz")
# This is a 15" PowerBook G4 mode; its video hardware (LCD) was also
# capable of 896x600 and 720x480 pixels at a 3:2 aspect ratio and
# 1024x768, 800x600, and 640x480 pixels at a 4:3 aspect ratio, so give
# its horizontal and vertical ranges a little more "headroom" than
# that required by this specific mode to accomodate the others.
db_set xserver-xfree86/config/monitor/horiz-sync "30-50"
db_set xserver-xfree86/config/monitor/vert-refresh "50-72"
DEFAULT_MODES="1152x768"
;;
"1152x864 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-68"
db_set xserver-xfree86/config/monitor/vert-refresh "50-85"
DEFAULT_MODES="1152x864"
;;
"1280x960 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-60"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1280x960"
;;
"1280x960 @ 85Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-92"
db_set xserver-xfree86/config/monitor/vert-refresh "50-85"
DEFAULT_MODES="1280x960"
;;
"1280x1024 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-65"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1280x1024"
;;
"1400x1050 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-67"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1400x1050"
;;
"1400x1050 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-85"
db_set xserver-xfree86/config/monitor/vert-refresh "50-80"
DEFAULT_MODES="1400x1050"
;;
"1600x1024 @ 85Hz")
# This is an SGI 1600SW mode.
db_set xserver-xfree86/config/monitor/horiz-sync "30-70"
db_set xserver-xfree86/config/monitor/vert-refresh "50-90"
DEFAULT_MODES="1600x1024"
;;
"1600x1200 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-75"
db_set xserver-xfree86/config/monitor/vert-refresh "50-85"
DEFAULT_MODES="1600x1200"
;;
"1600x1200 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-94"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1600x1200"
;;
"1600x1200 @ 85Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-107"
db_set xserver-xfree86/config/monitor/vert-refresh "50-85"
DEFAULT_MODES="1600x1200"
;;
"1792x1344 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-107"
db_set xserver-xfree86/config/monitor/vert-refresh "50-85"
DEFAULT_MODES="1792x1344"
;;
"1792x1344 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-84"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1792x1344"
;;
"1856x1392 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-87"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1856x1392"
;;
"1856x1392 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-113"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1856x1392"
;;
"1920x1440 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-90"
db_set xserver-xfree86/config/monitor/vert-refresh "50-75"
DEFAULT_MODES="1920x1440"
;;
"1920x1440 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-130"
db_set xserver-xfree86/config/monitor/vert-refresh "60-160"
DEFAULT_MODES="1920x1440"
;;
"1920x1440 @ 85Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-130"
db_set xserver-xfree86/config/monitor/vert-refresh "60-160"
DEFAULT_MODES="1920x1440"
;;
"2048x1536 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-100"
db_set xserver-xfree86/config/monitor/vert-refresh "60-85"
DEFAULT_MODES="2048x1536"
;;
"2048x1536 @ 75Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-125"
db_set xserver-xfree86/config/monitor/vert-refresh "60-100"
DEFAULT_MODES="2048x1536"
;;
"2048x1536 @ 85Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "30-140"
db_set xserver-xfree86/config/monitor/vert-refresh "60-160"
DEFAULT_MODES="2048x1536"
;;
*)
internal_error "$func(): no handler for" \
"xserver-xfree86/config/monitor/mode-list value" \
"\"$RET\""
;;
esac
;;
Advanced)
auto_answer validate_monitor_frequency_db_input "$PRIORITY" \
xserver-xfree86/config/monitor/horiz-sync "$default_horiz_sync"
auto_answer validate_monitor_frequency_db_input "$PRIORITY" \
xserver-xfree86/config/monitor/vert-refresh "$default_vert_refresh"
;;
esac
db_get xserver-xfree86/config/monitor/horiz-sync
trace "$func(): horizontal sync configured to \"$RET\""
db_get xserver-xfree86/config/monitor/vert-refresh
trace "$func(): vertical refresh configured to \"$RET\""
}
--
G. Branden Robinson | It just seems to me that you are
Debian GNU/Linux | willfully entering an arse-kicking
branden@debian.org | contest with a monstrous entity
http://people.debian.org/~branden/ | that has sixteen legs and no arse.
Attachment:
signature.asc
Description: Digital signature