xinitrc_test 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. #Barry Kauler 2009
  3. #Called from Xorg Wizard, via xinit, testing a video mode.
  4. #091124 bug fixes, vert and horiz freqs did not display for vesa driver.
  5. #120202 rodin.s: internationalized.
  6. #120323 use real xmessage.
  7. export TEXTDOMAIN=xinitrc_test
  8. export TEXTDOMAINDIR=/usr/share/locale
  9. export OUTPUT_CHARSET=UTF-8
  10. . gettext.sh
  11. export LANGORG=$LANG
  12. LANG=C # i18n
  13. set -- `xvidtune -show` #'-display :0' not needed.
  14. CLOCKHZ=`dc $2 1000000 \* p`
  15. CLOCKHZINT=`echo -n "$CLOCKHZ" | cut -f 1 -d '.'`
  16. if [ $CLOCKHZINT -ne 0 ];then
  17. XTEST=$3
  18. YTEST=$7
  19. VRTEST=`dc $CLOCKHZ $6 \/ ${10} \/ p`
  20. HSTEST=`dc $CLOCKHZ $6 \/ 1000 \/ p`
  21. else
  22. #some video chips do not work with xvidtune.
  23. XRANDRINFO="`xrandr -q | grep '\*' | tr -s ' ' | grep '^ [0-9]' | head -n 1`"
  24. XTEST=`echo -n "$XRANDRINFO" | cut -f 2 -d ' ' | cut -f 1 -d 'x'`
  25. YTEST=`echo -n "$XRANDRINFO" | cut -f 2 -d ' ' | cut -f 2 -d 'x'`
  26. VRTEST=`echo -n "$XRANDRINFO" | cut -f 3 -d ' ' | cut -f 1 -d '*'`
  27. VRTESTINT=`echo -n "$VRTEST" | cut -f 1 -d '.'`
  28. #xrandr does not always return the vertical frequency...
  29. if [ $VRTESTINT -eq 0 -o ! $VRTEST ];then
  30. if [ "$MONCHOICES" = "" ];then #091124 exported from xorgwizard.
  31. mcPATTERN=" ${XTEST}x${YTEST}"'@'
  32. [ -f /tmp/ddcprobe.txt ] && VRTEST=`grep "$mcPATTERN" /tmp/ddcprobe.txt | tail -n 1 | cut -f 2 -d '@'` #091124
  33. else
  34. mcPATTERN='^'"${XTEST}x${YTEST}"'@'
  35. VRTEST=`echo "$MONCHOICES" | grep -m1 "$mcPATTERN" | cut -f 2 -d '@'`
  36. fi
  37. [ ! $VRTEST ] && VRTEST=60 #desparate last resort.
  38. fi
  39. # so we calc horiz freq theoretically...
  40. HSTEST=`gtf $XTEST $YTEST $VRTEST | head -n 2 | tail -n 1 | cut -f 1 -d ';' | cut -f 2 -d ':' | cut -f 2 -d ' '`
  41. fi
  42. #round off to two decimal places...
  43. HSTEST=`printf "%.2f" $HSTEST`
  44. VRTEST=`printf "%.2f" $VRTEST`
  45. echo "XTEST=$XTEST
  46. YTEST=$YTEST
  47. VRTEST=$VRTEST
  48. HSTEST=$HSTEST" > /tmp/xorgwizard_initrc_test_results #read by xorgwizard.
  49. LANG=$LANGORG # i18n
  50. XMESSAGEEXE='xmessage'
  51. [ -e /usr/X11R7/bin/xmessage ] && XMESSAGEEXE='/usr/X11R7/bin/xmessage'
  52. ${XMESSAGEEXE} -font "8x16" -center -timeout 60 -buttons "OK:10" -default OK "
  53. `eval_gettext \"Puppy Xorg Video Wizard: testing X
  54. If you can see this, then X is working!
  55. Current resolution: \\\${XTEST}x\\\${YTEST} pixels
  56. Horizontal sync frequency: \\\$HSTEST KHz
  57. Vertical refresh frequency: \\\$VRTEST Hz (times per second)
  58. Please click the 'OK' button, or if your mouse isn't working,
  59. just hit the ENTER key, or the combination CTRL-ALT-BACKSPACE.
  60. If you don't do anything, this test will timeout in 60 seconds.\"`"
  61. #when xmessage terminates, xinit should kill Xorg.
  62. ###END###