summaryrefslogtreecommitdiffstats
path: root/initrd
diff options
context:
space:
mode:
authorFelix Endres2006-04-11 02:16:01 +0200
committerFelix Endres2006-04-11 02:16:01 +0200
commit93bbaa9c3c20f01b5cd03e8a35e0c5ead937651e (patch)
treeaed039b99c57043d5331d70574e10d402e859388 /initrd
parentRecorrected an error message (diff)
downloadcore-93bbaa9c3c20f01b5cd03e8a35e0c5ead937651e.tar.gz
core-93bbaa9c3c20f01b5cd03e8a35e0c5ead937651e.tar.xz
core-93bbaa9c3c20f01b5cd03e8a35e0c5ead937651e.zip
Some bugfixes and improved robustness against bad ddcprobe output
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@178 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd')
-rwxr-xr-xinitrd/initrd-stuff/bin/screenres30
1 files changed, 23 insertions, 7 deletions
diff --git a/initrd/initrd-stuff/bin/screenres b/initrd/initrd-stuff/bin/screenres
index 97aaa005..182a7694 100755
--- a/initrd/initrd-stuff/bin/screenres
+++ b/initrd/initrd-stuff/bin/screenres
@@ -21,15 +21,29 @@
## For CRTs determine recommended screen modes ####################################################
# enable debugging in higher debug levels
+[ -z "$DEBUGLEVEL" ] && DEBUGLEVEL=3
[ $DEBUGLEVEL -gt 1 ] && DEBUG="yes"
+#Define some default output values if the script fails to find better values:
+default_horiz_freq_khz="63.5"
+default_recommended_screen_modes='"1024x768" "800x600" "640x480"'
+
+
+
calculate_max_horizontal_freq () {
- highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)" .*/\1/p'`
+ highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)".*/\1/p'`
freq_for_highest_res=`sed -n /$highest_resolution'/s/[^@]*@\([0-9]\{2,3\}\).*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p`
if [ -z "$freq_for_highest_res" ]; then
#Search for a number followed by the term "Hz" in the same line as the highest resolution
freq_for_highest_res=`sed -n /$highest_resolution'/s/.*[^a-zA-Z0-9]\([0-9]\{2,3\}\)[ \t]*[Hh][Zz].*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p`
fi
+ [ -n "$DEBUG" ] && echo " # Vertical Frequency for highest resolution.: $freq_for_highest_res"
+ if [ -z "$freq_for_highest_res" ]; then
+ [ -n "$DEBUG" ] && echo "Vertical Frequency not available. Calculation not possible. Return default value."
+ horiz_freq_khz=$default_horiz_freq_khz
+ return
+ fi
+
highest_res_line_count=` echo $highest_resolution | sed -n 's/.*[0-9]*x//p'`
[ -n "$DEBUG" ] && echo " # of lines in highest res.: $highest_res_line_count"
horiz_freq_khz=$(( $highest_res_line_count * $freq_for_highest_res / 950)) # 950 = 0,95 * 1000 (invisible range * Kilohertz)
@@ -106,8 +120,8 @@ failed=`sed -n '/edid.*failed/Ip' ${tmp_ddcprobe_output}`
if [ -n "$failed" ]; then
echo "Error: Display seems to be incapable of providing DDC Information"
# Print Defaults OPTIMIZEME: The defaults could be command line parameters
- echo 'Recommended Screen Modes: "1024x768" "800x600" "640x480"'
- echo "Vertical Frequency Range (kHz): 31.5-63.5"
+ echo "Recommended Screen Modes: $default_recommended_screen_modes"
+ echo "Vertical Frequency Range (kHz): 31.5-$default_horiz_freq_khz"
echo "Horizontal Frequency Range (Hz): 60-90"
exit 1;
fi
@@ -115,11 +129,13 @@ screen_size_in_qcm=$((`sed -n "s/[Ss]creen.*[Ss]ize[^0-9]*\([0-9]*\)[^0-9]*\([0-
max_pixels=$((`echo "\`sed -n '/edid/I,$s/.*[ \t]\([0-9]\{3,4\}\)x\([0-9]\{3,4\}\).*/\2 * \1/p' ${tmp_ddcprobe_output}|sort -rn| sed -n 1p\`"`))
manufacturing_year=`sed -n 's/manufact.*\([12][90][0-9][0-9]\).*/\1/Ip' ${tmp_ddcprobe_output}`
-if [ -z $screen_size_in_qcm ] || [ -z $manufacturing_year ] || [ -z $max_pixels ] ; then
+[ -n "$DEBUG" ] && echo "Maximal Resolution: $max_pixels"
+# 640x400 (below)
+if [ -z $screen_size_in_qcm ] || [ -z $manufacturing_year ] || [ 256000 -gt $max_pixels ] ; then
echo "Error: Display seems to be incapable of providing all relevant DDC Information"
# Print Defaults OPTIMIZEME: The defaults could be command line parameters
- echo 'Recommended Screen Modes: "1024x768" "800x600" "640x480"'
- echo "Vertical Frequency Range (kHz): 31.5-63.5"
+ echo "Recommended Screen Modes: $default_recommended_screen_modes"
+ echo "Vertical Frequency Range (kHz): 31.5-$default_horiz_freq_khz"
echo "Horizontal Frequency Range (Hz): 60-90"
exit 1;
fi
@@ -179,7 +195,7 @@ echo "Supported Screen Modes: $screen_resolutions"
frequency_ranges=`sed '/[Rr][Aa][Nn][Gg][Ee]/!d;s/[^0-9]*\([1-9][0-9]\)[ \t]*-[ \t]*\([1-9][0-9]*\)[^0-9]*\([1-9][0-9]*\)[ \t]*-[ \t]*\([1-9][0-9]*\).*/\1-\2 \3-\4/' ${tmp_ddcprobe_output}`
set -- $frequency_ranges # split into $1 und $2
-if [ -z "$frequency_ranges" ]; then
+if [ -z "$frequency_ranges" ] && [ $tft_probability -lt 50 ]; then
calculate_max_horizontal_freq # gives us $horiz_freq_khz
horiz_freq_range="31.5-$horiz_freq_khz"
else horiz_freq_range=$1