report-video 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/sh
  2. #note, this is the original report-video script, builtin to Woof.
  3. #TaZoc has written a more advanced version, available as a pet pkg (sys-info).
  4. #121128 BK complete rewrite.
  5. #130127 internationalised.
  6. #130207 don570: a translation was missing.
  7. #130214 remove scanpci. add "vga" test.
  8. #130215 a module may get loaded, then attempted loaded again, then unloaded, 1st load still there.
  9. export TEXTDOMAIN=report-video
  10. export OUTPUT_CHARSET=UTF-8
  11. . /etc/DISTRO_SPECS
  12. GRAPHICSCHIP="`lspci | grep -i -E 'graphic|video|display|vga' | cut -f 2- -d ' '`" #130214
  13. if [ "$GRAPHICSCHIP" = "" ];then
  14. if [ -f /tmp/ddcprobe.txt ];then
  15. GRAPHICSCHIP="`cat /tmp/ddcprobe.txt | grep -E '^oem: |^product: '`"
  16. else
  17. GRAPHICSCHIP="`ddcprobe | grep -E '^oem: |^product: '`"
  18. fi
  19. fi
  20. [ -z "$GRAPHICSCHIP" ] && GRAPHICSCHIP=" unknown"
  21. XSERVER="$(readlink /usr/bin/X)"
  22. echo "$(gettext 'VIDEO REPORT:') ${DISTRO_NAME}, $(gettext 'version') ${DISTRO_VERSION}" > /tmp/report-video
  23. echo "
  24. $(gettext 'Chip description:')
  25. $GRAPHICSCHIP" >> /tmp/report-video
  26. if [ "$XSERVER" = "Xorg" ];then
  27. if [ -f /etc/X11/xorg.conf ];then
  28. sPTN='/^Section "Screen"/,/^$/p' #this is a multi-line block find expression.
  29. reqVIDEODEPTH="$(sed -n "$sPTN" /etc/X11/xorg.conf | tr '\t' ' ' | tr -s ' ' | grep '^[^#][ \t]*Depth ' | cut -f 3 -d ' ')"
  30. reqVIDEORES="$(sed -n "$sPTN" /etc/X11/xorg.conf | tr '\t' ' ' | tr -s ' ' | grep '^[^#][ \t]*Modes .*#screen0modes' | cut -f 2 -d '"')" #'geany.
  31. echo "
  32. Requested by /etc/X11/xorg.conf:" >> /tmp/report-video
  33. [ "$reqVIDEORES" ] && echo " $(gettext 'Resolution (widthxheight, in pixels): ')${reqVIDEORES}" >> /tmp/report-video
  34. [ "$reqVIDEODEPTH" ] && echo " $(gettext 'Depth (bits, or planes): ')${reqVIDEODEPTH}" >> /tmp/report-video
  35. REQMODS="$(grep '^[^#][ \t]*Load ' /etc/X11/xorg.conf | cut -f 2 -d '"' | tr '\n' ' ')" #'geany
  36. [ "$REQMODS" ] && echo " $(gettext 'Modules requested to be loaded: ')${REQMODS}" >> /tmp/report-video
  37. DISABLEMODS="$(grep '^[^#][ \t]*Disable ' /etc/X11/xorg.conf | cut -f 2 -d '"' | tr '\n' ' ')" #'geany
  38. [ "$DISABLEMODS" ] && echo " $(gettext 'Modules requested to not be loaded: ')${DISABLEMODS}" >> /tmp/report-video
  39. #this section is normally commented out...
  40. sPTN='/^Section "Device"/,/^$/p' #this is a multi-line block find expression.
  41. reqDRIVER="$(sed -n "$sPTN" /etc/X11/xorg.conf | tr '\t' ' ' | tr -s ' ' | grep '^[^#][ \t]*Driver ' | cut -f 2 -d '"' | tr '\n' ' ')" #'geany
  42. [ "$reqDRIVER" ] && echo " $(gettext 'Drivers requested to be loaded: ')${reqDRIVER}" >> /tmp/report-video
  43. else
  44. echo "
  45. $(gettext 'NOTE: there is no /etc/X11/xorg.conf configuration file.')" >> /tmp/report-video
  46. fi
  47. fi
  48. VIDEODRIVER=""; ALLMODS=""
  49. if [ "$XSERVER" = "Xorg" ];then
  50. echo "
  51. $(gettext 'Probing Xorg startup log file (/var/log/Xorg.0.log):')" >> /tmp/report-video
  52. LOADED="$(grep 'Loading .*/xorg/modules/drivers/.*_drv.so' /var/log/Xorg.0.log | rev | cut -f 1 -d '/' | rev | cut -f 1 -d '_' | tr '\n' ' ')"
  53. for ALOADED in $LOADED
  54. do
  55. aPTN="UnloadModule: \"$ALOADED\""
  56. bPTN="LoadModule: \"$ALOADED\""
  57. #130215 Xorg loaded noauveau, then tried to load it again, failed, then unloaded, so count them...
  58. CNTload=`grep "$bPTN" /var/log/Xorg.0.log | wc -l`
  59. CNTunload=`grep "$aPTN" /var/log/Xorg.0.log | wc -l`
  60. [ $CNTload -eq 0 ] && continue
  61. [ $CNTunload -ge $CNTload ] && continue
  62. VIDEODRIVER="$ALOADED"
  63. break
  64. done
  65. [ "$VIDEODRIVER" ] && echo " $(gettext 'Driver loaded (and currently in use):') ${VIDEODRIVER}" >> /tmp/report-video
  66. ALLLOADED="$(grep 'LoadModule: ' /var/log/Xorg.0.log | rev | cut -f 1 -d '/' | rev | cut -f 2 -d '"' | sort -u | tr '\n' ' ')" #'geany
  67. for ALOADED in $ALLLOADED
  68. do
  69. [ "$ALOADED" = "$VIDEODRIVER" ] && continue
  70. aPTN="UnloadModule: \"$ALOADED\""
  71. bPTN="LoadModule: \"$ALOADED\""
  72. #130215 Xorg loaded noauveau, then tried to load it again, failed, then unloaded, so count them...
  73. CNTload=`grep "$bPTN" /var/log/Xorg.0.log | wc -l`
  74. CNTunload=`grep "$aPTN" /var/log/Xorg.0.log | wc -l`
  75. [ $CNTload -eq 0 ] && continue
  76. [ $CNTunload -ge $CNTload ] && continue
  77. ALLMODS="${ALLMODS} ${ALOADED}"
  78. done
  79. echo " $(gettext 'Loaded modules:')${ALLMODS}" >> /tmp/report-video
  80. fi
  81. if [ "$XSERVER" = "Xorg" ];then
  82. echo "
  83. $(gettext 'Actual rendering on monitor:')" >> /tmp/report-video
  84. if [ "`which xdpyinfo`" ]; then
  85. XDPYINFO="$(xdpyinfo)"
  86. VIDEORES="$(echo "$XDPYINFO" | grep ' dimensions: ' | sed -e 's%dimensions: %%' | tr -s ' ' | head -n 1)"
  87. echo " $(gettext 'Resolution: ')$VIDEORES" >> /tmp/report-video
  88. VIDEODEPTH="$(echo "$XDPYINFO" | grep 'depth of root window:' | sed -e 's%depth of root window:%%' | tr -s ' ' | head -n 1)"
  89. echo " $(gettext 'Depth: ')$VIDEODEPTH" >> /tmp/report-video
  90. else
  91. if [ "`which xrandr`" ]; then
  92. XRANDR="$(xrandr | grep '*' | head -n 1)"
  93. echo " $(gettext 'Resolution:') $(echo "$XRANDR" | tr -s ' ' | cut -f 2 -d ' ')" >> /tmp/report-video
  94. else
  95. echo " $(gettext 'unknown')" >> /tmp/report-video
  96. fi
  97. fi
  98. fi
  99. cat /tmp/report-video
  100. echo
  101. echo "$(gettext '...the above also recorded in /tmp/report-video')" #130207