xorgwizard 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813
  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2006,2007 www.puppylinux.com
  3. #2007 Lesser GPL licence v2 (/usr/share/doc/legal/lgpl-2.1.txt)
  4. ## Abused by Dougal, Feb 2007
  5. ## Update: March 16th: fixed "OK" button when testing X
  6. ## Update: April 15th: fixed problem with MONTYPES format, added touchpad code
  7. ## Update: April 16th: removed MONTYPES, using a case-structure to set params
  8. #v2.21 BK 9sept2007 bug fix: serial mouse setting was wrong.
  9. #v3.93 BK 1dec2007: updated for dingo.
  10. #v3.93 BK 2dec2007: bugfixes from Dougal and rerwin.
  11. #v3.94 BK 24dec2007: recognise Classmate PC laptop.
  12. #v3.95 BK 4jan2008: recognise eeepc laptop.
  13. #v3.95 BK 8jan2008: bug that caused xorgwizard to run at every boot.
  14. #v3.96 BK 22jan2008: special case submitted by rerwin.
  15. #v3.97 BK 2feb2008: improved detection of Classmate laptop.
  16. #v3.98 RE 7mar2008: added preferred mode parameter; corrected & added special cases submitted by rerwin.
  17. #v3.99 BK 15apr2008: have restored the xrandrshell utility to the main GUI menu.
  18. #v3.99 BK 15apr2008: workaround for xrandr and dual monitors.
  19. #v3.99 RE 7apr2008: improve user interface for any Xvesa-hanging video adapters.
  20. #v405 BK 22jul08: added support for 1024x600.
  21. #v408 BK k2.6.25.16 serial mouse driver now a module 'sermouse'.
  22. #v411 rerwin: mouse improvements.
  23. #v411 moved choosemousefunc() to /etc/rc.d/functions4puppy4, want call from rc.sysinit.
  24. #w000 path /usr/X11R7 no longer used.
  25. #w002 no longer offering xvesa.
  26. #w005 restored EXIT button in first dlg.
  27. #w007 fix X if it is not a symlink.
  28. #w019 april2009: restored Xvesa.
  29. #w460 fixed X test screen, proper exit.
  30. #w468 modify mouse detection message.
  31. #w478 fix prevent 2 instances of xwin, do not 'exec xwin'.
  32. #w480 bugfix, serial mouse choice lost if choose to tweak refresh.
  33. #w482 allow switch between intel_drv.so and i810OLD_drv.so.
  34. #091119 pizzasgood: patch for multiple monitors.
  35. #091125 if no Xvesa, do not display dlg that offers to choose it.
  36. #100109 fix yes/no labels in dlg, fix bug when switch to 'vesa' driver.
  37. #100113 choose alternate video drivers.
  38. #100215 now have xgamma-gui.
  39. #100328 different xorg.conf0 for xorg 7.3.
  40. #100329,100330 first window offer vesa.
  41. #100401 offer alternate drivers in first window.
  42. #100430 handle commercial nvidia driver. improve Choose button.
  43. #100501 monitor probe returns random 'manufacture' data from one of my monitors.
  44. #100510 fix column alignment.
  45. #100516 TazOC: nvidia module loading fix.
  46. #100603 Jemimah: support Elantech touchpads.
  47. #100708 fix for when all three nv, nouveau, nvidia drivers present, choose just one.
  48. #100820 Xvesa present, improve dialogs if choose Xorg.
  49. #100820 for intel video, mplayer needs 'Option "LinearAlloc" "6144"' in xorg.conf.
  50. #100902 fix switching between choosing 'intel' and 'i810' drivers.
  51. #101224 added LANG=C in call to xinitrc_test.
  52. #110505 support sudo for non-root user.
  53. #110701 synaptics stuff seems to clash with xorg-server 1.10.1.
  54. #110701 bugfix for '%' char in /root/xorg.conf.new.
  55. #110806 correction, changed 1360x768 to 1366x768.
  56. #110814 01micko: convert script from gtkdialog2 to gtkdialog3+.
  57. #110910 BK: gtkdialog3 (patriot-e version) syntax error, bump to gtkdialog4.
  58. #110911 'drivers-alternate' moved from /usr/lib/xorg/modules/ to /usr/lib/x/.
  59. #110927 fix touchpad setup.
  60. #111108 Karl Godt: fix for desktop drive icons getting drawn in wrong place after change resolution.
  61. #120129 jemimah: add Option "SHMConfig" "on".
  62. #120130 rodin.s: i18n internationalise script. BK: note, edited all changes manually, as script from rodin.s had some differences.
  63. #120131 rodin.s: added a couple more translations.
  64. #120213 /var/local/pup_event_icon_change_flag path changed from /tmp (see /sbin/clean_desk_icons)
  65. #120213 rodin.s: removed LANG=C prefix when run xinitrc_test.
  66. #120226 01micko: bugfix, call new script 'nouveau_unload'.
  67. #120301 it seems have to reload console font after exit from X.
  68. #120318 correctly set keyboard layout, model and variant.
  69. #120323 partial replace 'xmessage' with 'pupmessage'.
  70. #120723 BOOT_DISABLEXORGWIZARD variable in /etc/rc.d/BOOTCONSTRAINED. refer 3builddistro, also xwin.
  71. #130201 01micko: support "modesetting_drv.so" xorg driver installed to /usr/lib/x/drivers-alternate/
  72. #130427 new script xorgwizard-cli.
  73. #130504 no longer using nouveau_unload.
  74. #131229 zigbert: gui (gtkdialog) improvements.
  75. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  76. #130427 new script replaces this one...
  77. if [ ! $DISPLAY ];then
  78. XORGVER="`Xorg -version 2>&1 | grep '^X Window System Version' | rev | cut -f 1 -d ' ' | rev`" #ex: 1.3.0
  79. [ ! "$XORGVER" ] && XORGVER="`Xorg -version 2>&1 | grep '^X\.Org X Server' | rev | cut -f 1 -d ' ' | rev`"
  80. if vercmp $XORGVER ge 1.11.0; then
  81. exec xorgwizard-cli
  82. fi
  83. fi
  84. export TEXTDOMAIN=xorgwizard
  85. export OUTPUT_CHARSET=UTF-8
  86. . gettext.sh
  87. mkdir -p /usr/lib/x/drivers-backup
  88. mkdir -p /var/local/xorg #100902
  89. . /etc/DISTRO_SPECS #120723
  90. . /etc/rc.d/BOOTCONSTRAINED #120723
  91. if [ ! $DISPLAY ];then #120723
  92. if [ "$BOOT_DISABLEXORGWIZARD" = "yes" ];then #120723 refer /etc/rc.d/BOOTCONSTRAINED and 3builddistro.
  93. echo
  94. echo "Sorry, the text-mode Xorg Wizard is disabled for this build of Puppy."
  95. exit
  96. fi
  97. fi
  98. alternate_driver_func() { #100401 100708
  99. REPLACEDDRV=""
  100. mv -f /usr/lib/x/drivers-backup/* /usr/lib/xorg/modules/drivers/ 2>/dev/null
  101. SUBSTDRV="$1" #alternative driver in /usr/lib/x/drivers-alternate
  102. case $SUBSTDRV in
  103. intel)
  104. REPLACEDDRV="i810"
  105. [ ! -h /usr/lib/xorg/modules/drivers/i810_drv.so ] && mv -f /usr/lib/xorg/modules/drivers/i810_drv.so /usr/lib/x/drivers-alternate/
  106. mv -f /usr/lib/x/drivers-alternate/intel_drv.so /usr/lib/xorg/modules/drivers/
  107. [ ! -e /usr/lib/xorg/modules/drivers/i810_drv.so ] && [ -h /var/local/xorg/i810_drv.so ] && mv -f /var/local/xorg/i810_drv.so /usr/lib/xorg/modules/drivers/ #100902
  108. #100330 restore, see i810 case below...
  109. if [ -d /usr/lib/x/drivers-alternate/intel ];then #100330 see my xf86-video-i810_xorg73 pet pkg.
  110. mkdir -p /usr/lib/x/drivers-alternate/i810
  111. for ONEXFILE in `find /usr/lib/x/drivers-alternate/intel -type f | sed -e 's%/usr/lib/x/drivers-alternate/intel/%%' | tr '\n' ' '`
  112. do
  113. ONEXDIR="`dirname $ONEXFILE`"
  114. [ "$ONEXDIR" = "." ] && ONEXDIR=""
  115. mkdir -p /usr/lib/x/drivers-alternate/i810/$ONEXDIR
  116. cp -a -f /$ONEXFILE /usr/lib/x/drivers-alternate/i810/$ONEXDIR #swap them
  117. cp -a -f /usr/lib/x/drivers-alternate/intel/$ONEXFILE /$ONEXDIR # "
  118. done
  119. fi
  120. ;;
  121. i810)
  122. REPLACEDDRV="intel"
  123. [ -h /usr/lib/xorg/modules/drivers/i810_drv.so ] && mv -f /usr/lib/xorg/modules/drivers/i810_drv.so /var/local/xorg/ #move aside old symlink. 100902
  124. mv -f /usr/lib/xorg/modules/drivers/intel_drv.so /usr/lib/x/drivers-alternate/
  125. mv -f /usr/lib/x/drivers-alternate/i810_drv.so /usr/lib/xorg/modules/drivers/
  126. if [ -d /usr/lib/x/drivers-alternate/i810 ];then #100330 see my xf86-video-i810_xorg73 pet pkg.
  127. mkdir -p /usr/lib/x/drivers-alternate/intel #100330
  128. for ONEXFILE in `find /usr/lib/x/drivers-alternate/i810 -type f | sed -e 's%/usr/lib/x/drivers-alternate/i810/%%' | tr '\n' ' '`
  129. do
  130. ONEXDIR="`dirname $ONEXFILE`"
  131. [ "$ONEXDIR" = "." ] && ONEXDIR=""
  132. mkdir -p /usr/lib/x/drivers-alternate/intel/$ONEXDIR
  133. cp -a -f /$ONEXFILE /usr/lib/x/drivers-alternate/intel/$ONEXDIR #swap them
  134. cp -a -f /usr/lib/x/drivers-alternate/i810/$ONEXFILE /$ONEXDIR # "
  135. done
  136. fi
  137. ;;
  138. nv)
  139. mv -f /usr/lib/x/drivers-alternate/nv_drv.so /usr/lib/xorg/modules/drivers/
  140. if [ -f /usr/lib/xorg/modules/drivers/nouveau_drv.so ];then
  141. REPLACEDDRV="nouvea"
  142. mv -f /usr/lib/xorg/modules/drivers/nouveau_drv.so /usr/lib/x/drivers-alternate/
  143. fi
  144. if [ -f /usr/lib/xorg/modules/drivers/nvidia_drv.so ];then #100430
  145. REPLACEDDRV2="nvidia"
  146. mv -f /usr/lib/xorg/modules/drivers/nvidia_drv.so /usr/lib/x/drivers-alternate/
  147. rmmod nvidia #100516
  148. fi
  149. ;;
  150. nouveau)
  151. mv -f /usr/lib/x/drivers-alternate/nouveau_drv.so /usr/lib/xorg/modules/drivers/
  152. if [ -f /usr/lib/xorg/modules/drivers/nv_drv.so ];then
  153. REPLACEDDRV="nv"
  154. mv -f /usr/lib/xorg/modules/drivers/nv_drv.so /usr/lib/x/drivers-alternate/
  155. fi
  156. if [ -f /usr/lib/xorg/modules/drivers/nvidia_drv.so ];then
  157. REPLACEDDRV2="nvidia"
  158. mv -f /usr/lib/xorg/modules/drivers/nvidia_drv.so /usr/lib/x/drivers-alternate/
  159. rmmod nvidia
  160. fi
  161. ;;
  162. nvidia)
  163. mv -f /usr/lib/x/drivers-alternate/nvidia_drv.so /usr/lib/xorg/modules/drivers/
  164. if [ -f /usr/lib/xorg/modules/drivers/nv_drv.so ];then
  165. REPLACEDDRV="nv"
  166. mv -f /usr/lib/xorg/modules/drivers/nv_drv.so /usr/lib/x/drivers-alternate/
  167. fi
  168. if [ -f /usr/lib/xorg/modules/drivers/nouveau_drv.so ];then
  169. REPLACEDDRV2="nouvea"
  170. mv -f /usr/lib/xorg/modules/drivers/nouveau_drv.so /usr/lib/x/drivers-alternate/
  171. fi
  172. modprobe nvidia
  173. ;;
  174. modesetting) #130201 01micko.
  175. REPLACEDDRV=""
  176. [ -f /usr/lib/x/drivers-alternate/modesetting_drv.so ] && mv -f /usr/lib/x/drivers-alternate/modesetting_drv.so /usr/lib/xorg/modules/drivers/
  177. ;;
  178. *) #100430 get rid of all drivers except chosen one.
  179. REPLACEDDRV=""
  180. mv -f /usr/lib/xorg/modules/drivers/* /usr/lib/x/drivers-backup/
  181. [ -h /usr/lib/x/drivers-backup/i810_drv.so ] && mv -f /usr/lib/x/drivers-backup/i810_drv.so /var/local/xorg/ #100902
  182. [ -f /usr/lib/x/drivers-backup/$SUBSTDRV ] && cp -f /usr/lib/x/drivers-backup/$SUBSTDRV /usr/lib/xorg/modules/drivers/
  183. [ -f /usr/lib/x/drivers-alternate/$SUBSTDRV ] && cp -f /usr/lib/x/drivers-alternate/$SUBSTDRV /usr/lib/xorg/modules/drivers/
  184. ;;
  185. esac
  186. if [ "$REPLACEDDRV" -o "$REPLACEDDRV2" ];then
  187. REPLACEDDRV0="${REPLACEDDRV}${REPLACEDDRV2}"
  188. XMSG1="`eval_gettext \"NOTICE: The '\\\${REPLACEDDRV0}' driver has been removed, so when Xorg probes the video hardware, it should instead use '\\\${SUBSTDRV}'.
  189. TECHNICAL NOTE: '\\\${REPLACEDDRV0}' has been moved to /usr/lib/x/drivers-alternate and if you ever want to manually get it back so that Xorg can use it, move it to /usr/lib/xorg/modules/drivers. Note that there may also be one or more directories inside /usr/lib/x/drivers-alternate with library files needed for the alternate drivers.
  190. Press ENTER key to continue...\"`"
  191. if [ "$REPLACEDDRV" -a "$REPLACEDDRV2" ];then
  192. XMSG1="`eval_gettext \"NOTICE: The '\\\${REPLACEDDRV}' and '\\\${REPLACEDDRV2}' drivers have been removed, so when Xorg probes the video hardware, it should instead use '\\\${SUBSTDRV}'.
  193. TECHNICAL NOTE: '\\\${REPLACEDDRV}' and '\\\${REPLACEDDRV2}' have been moved to /usr/lib/x/drivers-alternate and if you ever want to manually get them back so that Xorg can use them, move them to /usr/lib/xorg/modules/drivers. Note that there may also be one or more directories inside /usr/lib/x/drivers-alternate with library files needed for the alternate drivers.
  194. Press ENTER key to continue...\"`"
  195. fi
  196. dialog --title "$(gettext 'Xorg Video Wizard')" --msgbox "${XMSG1}" 0 0
  197. fi
  198. #restart wizard after return.
  199. } #end alternate_driver_func
  200. # redirect errors to file (to help debug):
  201. exec 2>/tmp/xorgwizard-errors.log
  202. PSFND="`ps`"
  203. CURRENTX="`readlink /usr/bin/X`"
  204. if [ "$CURRENTX" = "" ];then #w007 fix if not a symlink.
  205. ln -snf Xorg /usr/bin/X
  206. CURRENTX='Xorg'
  207. fi
  208. #110701 improve logic...
  209. XORGVER="`Xorg -version 2>&1 | grep '^X Window System Version' | rev | cut -f 1 -d ' ' | rev`" #ex: 1.3.0
  210. [ ! "$XORGVER" ] && XORGVER="`Xorg -version 2>&1 | grep '^X\.Org X Server' | rev | cut -f 1 -d ' ' | rev`"
  211. #100328 determine version of Xorg...
  212. if [ -f /etc/X11/xorg.conf0XORG73 ];then
  213. if vercmp $XORGVER lt 1.5.0; then #110701
  214. if [ -f /etc/X11/xorg.conf0XORG73 ];then
  215. #xorg 7.3 needs a different file...
  216. mv -f /etc/X11/xorg.conf0XORG73 /etc/X11/xorg.conf0
  217. fi
  218. fi
  219. fi
  220. . /etc/rc.d/functions4puppy4 #v411 has choosemousefunc().
  221. XKEYMAP='us'
  222. RETVALS="`keymap-set --xopt`"
  223. eval "$RETVALS" #ex: XKBMODEL="pc102", XKBLAYOUT="us", XKBVARIANT=""
  224. [ "$XKBLAYOUT" = "" ] && XKBLAYOUT='us'
  225. [ "$XKBMODEL" = "" ] && XKBMODEL='pc102'
  226. if [ "$BOOT_DISABLEXORGWIZARD" = "yes" ];then #120723 refer /etc/rc.d/BOOTCONSTRAINED and 3builddistro.
  227. XORGPRELIM_XML="$(gettext 'The behaviour of Xorg is controlled by a configuration file, /etc/X11/xorg.conf. This was generated auto-matically at the first boot, but you may now edit it manually.')"
  228. XORGWIZ_XML=""
  229. else
  230. XORGPRELIM_XML="$(gettext 'The behaviour of Xorg is controlled by a configuration file, /etc/X11/xorg.conf. You have a choice here, either to completely reconstruct the /etc/X11/xorg.conf file, or to modify the existing file.')"
  231. XORGWIZ_XML='
  232. <hbox border-width="7" space-expand="true" space-fill="true">
  233. <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext '<b>XorgWizard</b> completely reconstructs the /etc/X11/xorg.conf file, and X must not be running to do this. A reboot is required, and the Wizard will run in text mode, before X is launched.
  234. NOTE: You can also run XorgWizard manually, without rebooting, by exiting from X to the commandline (see Shutdown menu) then run xorgwizard.')'"</label></text>
  235. <vbox space-expand="false" space-fill="false">
  236. <button>
  237. '"`/usr/lib/gtkdialog/xml_button-icon graphics_xorg.svg big`"'
  238. <action>EXIT:11</action>
  239. </button>
  240. </vbox>
  241. </hbox>
  242. <hseparator></hseparator>'
  243. fi
  244. MAIN1='
  245. <window title="'$(gettext 'Xorg Video Wizard')'">
  246. <vbox space-expand="true" space-fill="true">
  247. <notebook labels="'$(gettext 'Screen')'|'$(gettext 'Advanced')'" space-expand="true" space-fill="true">
  248. <vbox space-expand="true" space-fill="true">
  249. <frame '$(gettext 'Screen tuning')'>
  250. '"`/usr/lib/gtkdialog/xml_info fixed graphics.svg 60 "$(gettext '<b>Screen tuning</b> depends on the loaded video/graphics driver, so if correct resolution is not there, check the advanced tab...')"`"'
  251. <hbox border-width="7" space-expand="true" space-fill="true">
  252. <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext '<b>Change screen resolution</b>
  253. How many vertical and horizontal pixels fits your screen.')'"</label></text>
  254. <vbox space-expand="false" space-fill="false">
  255. <button>
  256. '"`/usr/lib/gtkdialog/xml_button-icon screen_resolution.svg big`"'
  257. <action>EXIT:18</action>
  258. </button>
  259. </vbox>
  260. </hbox>
  261. <hseparator></hseparator>
  262. <hbox border-width="7" space-expand="true" space-fill="true">
  263. <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext '<b>Monitor gamma calibration</b>
  264. This will adjust the monitor colors, including screen brightness.')'"</label></text>
  265. <vbox space-expand="false" space-fill="false">
  266. <button>
  267. '"`/usr/lib/gtkdialog/xml_button-icon screen_calibration.svg big`"'
  268. <action>EXIT:17</action>
  269. </button>
  270. </vbox>
  271. </hbox>
  272. <hseparator></hseparator>
  273. <hbox border-width="7" space-expand="true" space-fill="true">
  274. <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext '<b>X/Y correction</b>
  275. If the screen is displaced or the width/height are wrong. This will modify the existing xorg.conf file. <b>Use with caution!</b>')'"</label></text>
  276. <vbox space-expand="false" space-fill="false">
  277. <button>
  278. '"`/usr/lib/gtkdialog/xml_button-icon screen_xy.svg big`"'
  279. <action>EXIT:13</action>
  280. </button>
  281. </vbox>
  282. </hbox>
  283. </frame>
  284. </vbox>
  285. <vbox space-expand="true" space-fill="true">
  286. <frame '$(gettext 'Manage xorg.conf')'>
  287. '"`/usr/lib/gtkdialog/xml_info fixed graphics.svg 60 "${XORGPRELIM_XML}"`"'
  288. '${XORGWIZ_XML}'
  289. <hbox border-width="7" space-expand="true" space-fill="true">
  290. <text xalign="0" use-markup="true" space-expand="true" space-fill="true"><label>"'$(gettext 'You can <b>manually edit</b> /etc/X11/xorg.conf, but note that you will need to exit from X afterward then restart X (see Shutdown menu). Click button to edit:')'"</label></text>
  291. <vbox space-expand="false" space-fill="false">
  292. <button>
  293. '"`/usr/lib/gtkdialog/xml_button-icon edit.svg big`"'
  294. <action>EXIT:15</action>
  295. </button>
  296. </vbox>
  297. </hbox>
  298. </frame>
  299. </vbox>
  300. </notebook>
  301. <hbox space-expand="false" space-fill="false">
  302. <button space-expand="false" space-fill="false">
  303. <label>'$(gettext "Quit")'</label>
  304. '"`/usr/lib/gtkdialog/xml_button-icon quit`"'
  305. <action>EXIT:quit</action>
  306. </button>
  307. </hbox>
  308. </vbox>
  309. </window>'
  310. #do this code block if X is running...
  311. if [ ! "`echo -n "$PSFND" | grep "\\.xinitrc"`" = "" ];then
  312. . /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
  313. RETSTR="`echo "$MAIN1" | gtkdialog --stdin`"
  314. RETVAL="`echo "$RETSTR" | grep '^EXIT=' | cut -f 2 -d '"'`" #'geany
  315. case $RETVAL in
  316. 11) #XorgWizard.
  317. . /etc/DISTRO_SPECS #120226 01micko fix for boot to desktop
  318. [ "$DISTRO_XORG_AUTO" = "yes" ] && sed -i "s/^DISTRO_XORG_AUTO='yes'/DISTRO_XORG_AUTO='no'/" /etc/DISTRO_SPECS #120226 temporary, fixes xorgwizard gui bug
  319. mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.prev 2>/dev/null
  320. [ -e /usr/bin/Xvesa ] && ln -sf Xvesa /usr/bin/X
  321. NEXTWM="`cat /etc/windowmanager`"
  322. echo -n "$NEXTWM" > /etc/windowmanager #this makes change permanent.
  323. echo -n "$NEXTWM" > /tmp/wmexitmode.txt
  324. echo -n "ICONWIPE" >/var/local/pup_event_icon_change_flag #111108 Karl Godt: in case Xvesa selects different resolution. 120213 path changed from /tmp (see /sbin/clean_desk_icons)
  325. sync
  326. exec killall X
  327. ;;
  328. 12) #xorgconfig
  329. xorgcfg
  330. pupmessage -bg "#ff8080" -center -title "xorgcfg" "$(gettext 'Changes to /etc/X11/xorg.conf will only take effect after X is restarted.')
  331. $(gettext 'Click OK button to restart X...')"
  332. exec restartwm
  333. ;;
  334. 13) #xvidtune
  335. pupmessage -bg violet -title "$(gettext 'Xvidtune IMPORTANT HELP')" "`gettext \"If you click the 'Show' button, the adjusted settings will be what
  336. you want permanently. After hitting the 'Quit' button, you will be
  337. given one last chance not to make the change permanent.\"`
  338. $(gettext 'Thus:')
  339. `gettext \"'Show' to record the settings (for later inclusion into xorg.conf)\"`
  340. `gettext \"'Quit' to exit Xvidtune.\"`
  341. $(gettext 'Please note that Xvidtune does not work with all video hardware, meaning
  342. that changing the settings will cause no change on the screen.')" &
  343. XMSGPID=$!
  344. MODELINE0="`xvidtune | grep '^"[0-9]'`" #'geanyfix.
  345. pupkill $XMSGPID
  346. if [ ! "$MODELINE0" = "" ];then
  347. xmessage -bg orange -title "$(gettext 'Xvidtune: Modeline')" -buttons Write:10,Quit:11 "$(gettext 'The new modeline is:')
  348. $MODELINE0
  349. $(gettext 'Note, you will have to restart X for it to take effect. If it messes')
  350. `gettext \"up X, edit from commandline 'mp /etc/X11/xorg.conf' and comment-out\"`
  351. `gettext \"the 'UseModes' line (do not delete it) in the Monitor section.\"`
  352. `gettext \"To insert this into /etc/X11/xorg.conf, click 'Write' button...\"`
  353. `gettext \"To exit without changing xorg.conf, click 'Quit' button...\"`"
  354. if [ $? -eq 10 ];then
  355. PATTERNA="s/.*#modes0modeline0/ ModeLine $MODELINE0 #modes0modeline0/g"
  356. cat /etc/X11/xorg.conf | sed -e "$PATTERNA" > /tmp/xorg.conf.new
  357. sync
  358. cat /tmp/xorg.conf.new | sed -e 's/#.*UseModes/UseModes/g' > /etc/X11/xorg.conf
  359. sync
  360. fi
  361. fi
  362. exit
  363. ;;
  364. 15) #edit xorg.conf
  365. exec defaulttexteditor /etc/X11/xorg.conf
  366. ;;
  367. 17) #xgamma-gui
  368. exec xgamma-gui
  369. ;;
  370. 18) #resolution changer
  371. exec xrandrshell
  372. ;;
  373. esac
  374. exit
  375. fi
  376. #come here when X is not running, completely rebuild xorg.conf...
  377. if [ -f /etc/X11/xorg.conf ];then
  378. mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
  379. fi
  380. #comes here first time boot puppy, or whenever bootup
  381. #and xorg.conf has been removed.
  382. #need to create xorg.conf so that at subsequent boots, xwin will not run xorgwizard...
  383. cp /etc/X11/xorg.conf0 /etc/X11/xorg.conf
  384. if [ ! $1 ];then #100430
  385. mv -f /usr/lib/x/drivers-backup/* /usr/lib/xorg/modules/drivers/ 2>/dev/null
  386. fi
  387. MSGwelcome="$(gettext 'Welcome to the Puppy Video Wizard!')
  388. "
  389. #100401 if xorgwizard started with any passed param, bypass initial window...
  390. if [ ! $1 ];then
  391. if [ "`which Xvesa`" != "" ];then #091125
  392. MSGwelcome="" #100820
  393. #If video adapter would hang Xvesa, tell user and allow only Xorg.
  394. if [ -s /tmp/ddcprobeoem.txt ] || grep -q -f /etc/xorgoverrides /tmp/ddcprobe.txt 2>/dev/null;then #Xvesa hanger encountered
  395. dialog --colors --title "$(gettext 'Puppy Video Wizard')" --yes-label "Xorg" --no-label "$(gettext 'Commandline')" --yesno "$(gettext 'Welcome to the Puppy Video Wizard!
  396. Puppy has two X servers (to run Puppy in graphics mode):')
  397. $(gettext 'Xvesa: A very small and simple "Kdrive" X server.')
  398. $(gettext 'Xorg: A very large and sophisticated X server, with many hardware-
  399. specific drivers for optimum performance (note: there is also
  400. a generic driver named "vesa", not the same as Xvesa!)')
  401. \Z1$(gettext 'Your video hardware would cause Xvesa to freeze Puppy, so your options are to use Xorg or exit to the command prompt.')\Z0
  402. $(gettext 'It is recommended that you choose the <Xorg> button now, but some
  403. quirky video hardware does not work with Xorg, in which case you must operate from the command line. Make sure you have at least 96 MB of RAM+swap, for Xorg to function.')
  404. $(gettext 'Press ENTER for Xorg...')
  405. $(gettext 'Press TAB (or right-arrow) key then ENTER key to use the command line...')\Zn" 0 0
  406. [ ! $? -eq 0 ] && exit
  407. else #normal video adapter
  408. #offer to drop out to Xvesa...
  409. dialog --colors --title "$(gettext 'Puppy Video Wizard')" --yes-label "Xorg" --no-label "Xvesa" --yesno "$(gettext 'Welcome to the Puppy Video Wizard!
  410. Puppy has two X servers (to run Puppy in graphics mode):')
  411. $(gettext 'Xvesa: A very small and simple "Kdrive" generic X server.')
  412. $(gettext 'Xorg: A very large and sophisticated X server, with many hardware-
  413. specific drivers for optimum performance (note: there is also
  414. a generic driver named "vesa", not the same as Xvesa!)')
  415. $(gettext 'Xvesa works flawlessly on most video hardware, simple to configure,
  416. but one major disadvantage is that screen refresh rate is fixed.
  417. Also, Xvesa has limited support for input devices, and lacks features
  418. like hardware-acceleration (video may be jerky on slow PCs).')
  419. $(gettext 'It is recommended that you choose the <Xorg> button now, but some
  420. quirky video hardware does not work with Xorg, in which case you can
  421. run this Wizard again and choose the <Xvesa> button.')
  422. $(gettext 'Press ENTER for Xorg...')
  423. $(gettext 'Press TAB (or right-arrow) key then ENTER key for Xvesa...')\Zn" 0 0
  424. STATUS=$? #v3.99
  425. [ $STATUS -eq -1 ] && exit #v3.99 ESC to exit, same as above dialogs
  426. if [ $STATUS -eq 1 ];then #v3.99 Xvesa selected
  427. ln -sf Xvesa /usr/bin/X #Xvesa is now the default X server.
  428. #when start xorgwizard from commandline, it messes up xorg.conf...
  429. if [ -f /etc/X11/xorg.conf ];then
  430. if [ -f /etc/X11/xorg.conf.bak ];then
  431. #basic test to see that file has right stuff in it...
  432. if ! grep -F -q 'VertRefresh' /etc/X11/xorg.conf ;then
  433. cp -f /etc/X11/xorg.conf.bak /etc/X11/xorg.conf
  434. fi
  435. fi
  436. fi
  437. #....Xvesa Wizard will run automatically if no /etc/videomode.
  438. exit #w478
  439. fi
  440. fi #v3.99
  441. fi
  442. #100820 did not choose Xvesa, or no Xvesa, now offer Xorg choices...
  443. FCHOOSE='nouveau'
  444. [ -f /usr/lib/xorg/modules/drivers/i810_drv.so ] && FCHOOSE='i810'
  445. [ -f /usr/lib/x/drivers-alternate/i810_drv.so ] && FCHOOSE='i810'
  446. case $FCHOOSE in #100820
  447. i810)
  448. MSGchoose="$(gettext 'EX: There are two drivers for Intel video, "intel" and "i810" and it may
  449. be necessary to choose one now as probe of the wrong one may hang the PC.')"
  450. ;;
  451. *)
  452. MSGchoose="$(gettext 'EX: There are two drivers for Nvidia video, "nv" and "nouveau" and it may
  453. be necessary to choose one now as probe of the wrong one may hang the PC.')"
  454. ;;
  455. esac
  456. dialog --colors --extra-button --title "$(gettext 'Puppy Video Wizard')" --ok-label "$(gettext 'Probe')" --cancel-label "vesa" --extra-label "$(gettext 'Choose')" --yesno "${MSGwelcome}`gettext \"'Xorg' (or just 'X') is software that will run Puppy in graphics mode,
  457. that is, display a desktop with windows, mouse, etc. Xorg has a dozen
  458. or so drivers for specific video hardware, and if you choose the <Probe>
  459. button then the Wizard will attempt to determine the correct driver for
  460. your video hardware.\"`
  461. `gettext \"With some hardware there is no specific driver, or maybe there is one
  462. but it doesn't work (or doesn't work properly), in which case you can
  463. fall back to the generic 'vesa' driver. The Wizard will offer to fall
  464. back to the vesa driver later, but if you know already that you have
  465. to use vesa, then you may choose it now...\"`
  466. $(gettext 'If you know that some other driver works, <Choose> will select it now.')
  467. ${MSGchoose}
  468. $(gettext 'Press ENTER key to probe for correct hardware-specific driver...')
  469. $(gettext 'Or, TAB then ENTER to choose another driver...')
  470. $(gettext 'Or, TAB, TAB then ENTER to select the generic vesa driver...')" 0 0
  471. STATUS=$?
  472. [ $STATUS -lt 0 ] && exit
  473. ALLDRIVERS="`ls -1 /usr/lib/xorg/modules/drivers | grep 'so$'`"
  474. if [ $STATUS -eq 0 ];then #Probe selected
  475. if [ "$ALLDRIVERS" = "vesa_drv.so" ];then
  476. cp -a -f --remove-destination /usr/lib/x/drivers-backup/* /usr/lib/xorg/modules/drivers/
  477. rm -f /usr/lib/x/drivers-backup/*
  478. fi
  479. else
  480. if [ $STATUS -eq 3 ];then #100401 choose. 100430 improved... 100820 improved...
  481. #Type the name of the one you want to use and press ENTER:" 0 0 2>/tmp/tagchosendrv.txt
  482. ALLDRVLIST="`ls -1 /usr/lib/xorg/modules/drivers /usr/lib/x/drivers-alternate /usr/lib/x/drivers-backup 2>/dev/null | grep -E '^[a-zA-Z0-9].*_drv.so' | cut -f 1 -d '_' | sort -u | tr '\n' ' '`"
  483. drvLIST=""
  484. for ONEDRV in $ALLDRVLIST
  485. do
  486. if [ -h /usr/lib/xorg/modules/drivers/$ONEDRV_drv.so ];then #ignore hyperlinks
  487. continue
  488. fi
  489. case $ONEDRV in
  490. ati|radeon|radeonhd|r128|mach64)
  491. drvLIST="${drvLIST}
  492. ${ONEDRV} \"ATI\""
  493. ;;
  494. nv|nouveau|nvidia)
  495. drvLIST="${drvLIST}
  496. ${ONEDRV} \"Nvidia\""
  497. ;;
  498. intel|i810|i740)
  499. drvLIST="${drvLIST}
  500. ${ONEDRV} \"Intel\""
  501. ;;
  502. rendition)
  503. drvLIST="${drvLIST}
  504. ${ONEDRV} \"Rendition/Micron\""
  505. ;;
  506. amd)
  507. drvLIST="${drvLIST}
  508. ${ONEDRV} \"AMD\""
  509. ;;
  510. apm)
  511. drvLIST="${drvLIST}
  512. ${ONEDRV} \"Alliance ProMotion\""
  513. ;;
  514. ark)
  515. drvLIST="${drvLIST}
  516. ${ONEDRV} \"Ark Logic\""
  517. ;;
  518. ast)
  519. drvLIST="${drvLIST}
  520. ${ONEDRV} \"ASPEED Technology\""
  521. ;;
  522. chips)
  523. drvLIST="${drvLIST}
  524. ${ONEDRV} \"Chips and Technologies\""
  525. ;;
  526. cirrus)
  527. drvLIST="${drvLIST}
  528. ${ONEDRV} \"Cirrus Logic\""
  529. ;;
  530. cyrix)
  531. drvLIST="${drvLIST}
  532. ${ONEDRV} \"Cyrix MediaGX\""
  533. ;;
  534. geode)
  535. drvLIST="${drvLIST}
  536. ${ONEDRV} \"AMD Geode GX/LX\""
  537. ;;
  538. glide)
  539. drvLIST="${drvLIST}
  540. ${ONEDRV} \"Glide2x\""
  541. ;;
  542. glint)
  543. drvLIST="${drvLIST}
  544. ${ONEDRV} \"GLINT/Permedia/3Dlabs\""
  545. ;;
  546. i128)
  547. drvLIST="${drvLIST}
  548. ${ONEDRV} \"Number 9 I128\""
  549. ;;
  550. imstt)
  551. drvLIST="${drvLIST}
  552. ${ONEDRV} \"Integrated Micro Solutions\""
  553. ;;
  554. mga)
  555. drvLIST="${drvLIST}
  556. ${ONEDRV} \"Matrox\""
  557. ;;
  558. neomagic)
  559. drvLIST="${drvLIST}
  560. ${ONEDRV} \"Neomagic\""
  561. ;;
  562. newport)
  563. drvLIST="${drvLIST}
  564. ${ONEDRV} \"Newport\""
  565. ;;
  566. nsc)
  567. drvLIST="${drvLIST}
  568. ${ONEDRV} \"National Semiconductor\""
  569. ;;
  570. openchrome)
  571. drvLIST="${drvLIST}
  572. ${ONEDRV} \"VIA/S3G UniChrome/Chrome\""
  573. ;;
  574. rdc)
  575. drvLIST="${drvLIST}
  576. ${ONEDRV} \"RDC Vortex86mx\""
  577. ;;
  578. s3|s3virge|savage)
  579. drvLIST="${drvLIST}
  580. ${ONEDRV} \"S3\""
  581. ;;
  582. siliconmotion)
  583. drvLIST="${drvLIST}
  584. ${ONEDRV} \"Silicon Motion\""
  585. ;;
  586. sis|xgi|xgixp)
  587. drvLIST="${drvLIST}
  588. ${ONEDRV} \"SIS and XGI\""
  589. ;;
  590. tdfx)
  591. drvLIST="${drvLIST}
  592. ${ONEDRV} \"3Dfx\""
  593. ;;
  594. tga)
  595. drvLIST="${drvLIST}
  596. ${ONEDRV} \"TGA\""
  597. ;;
  598. trident)
  599. drvLIST="${drvLIST}
  600. ${ONEDRV} \"Trident\""
  601. ;;
  602. tseng)
  603. drvLIST="${drvLIST}
  604. ${ONEDRV} \"Tseng Labs\""
  605. ;;
  606. voodoo)
  607. drvLIST="${drvLIST}
  608. ${ONEDRV} \"Voodoo\""
  609. ;;
  610. vesa)
  611. drvLIST="${drvLIST}
  612. ${ONEDRV} \"VESA generic driver\""
  613. ;;
  614. ztv)
  615. drvLIST="${drvLIST}
  616. ${ONEDRV} \"AMD Geode\""
  617. ;;
  618. *)
  619. drvLIST="${drvLIST}
  620. ${ONEDRV} ${ONEDRV}"
  621. ;;
  622. esac
  623. done
  624. drvLIST="`echo "$drvLIST" | sort --key=2 --field-separator=" " | tr '\n' ' '`"
  625. drvDLG="dialog --title \"$(gettext 'Xorg Video Wizard')\" --menu \"$(gettext 'Choose an Xorg driver (down-arrow or up-arrow then ENTER):')\" 0 0 0 ${drvLIST}"
  626. eval $drvDLG 2>/tmp/tagchosendrv.txt
  627. if [ $? -eq 0 ];then
  628. CHOSENDRV="`cat /tmp/tagchosendrv.txt`"
  629. alternate_driver_func $CHOSENDRV
  630. exec xorgwizard $CHOSENDRV ###RESTART### note, passed param causes bypass of the initial window.
  631. else
  632. exec xorgwizard ###RESTART###
  633. fi
  634. else #Vesa selected
  635. mv -f /usr/lib/xorg/modules/drivers/* /usr/lib/x/drivers-backup/
  636. cp -f /usr/lib/x/drivers-backup/vesa_drv.so /usr/lib/xorg/modules/drivers/
  637. fi
  638. fi
  639. fi
  640. #resolution changer uses this. it must be removed here...
  641. rm -f /etc/xrandrindex 2> /dev/null
  642. ln -sf Xorg /usr/bin/X
  643. # Dougal: moved echo to below xorg probing, since loop isn't slow anymore...
  644. clear
  645. echo -en "\\033[1;35m" #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
  646. echo -n "$(gettext 'Probing video hardware, please wait...')"
  647. echo -e "\\033[0;39m"
  648. #autoprobe...
  649. Xorg -configure > /tmp/xorgprobe.txt 2>&1
  650. #... config in /root/xorg.conf.new
  651. ###############################END BIG ITERATION###########################
  652. ## My (Dougal) alternate code:
  653. ######################################################################
  654. # Rather than pipe data to "while read", I use "here document" (at bottom),
  655. #+ so that the loop doesn't run in a subshell -- hence variables
  656. #+ (like HORIZSYNC0) are retained after the loop has ended...
  657. while read ASECTION
  658. do
  659. # this (outer) loop recieves a line containing **an entire section**
  660. # filter out entire sections we don't want
  661. case $ASECTION in
  662. *Section?\"Screen\"*)
  663. break #Screen section is created further down.
  664. ;;
  665. *Section?\"Files\"*|*Section?\"Module\"*|*Section?\"ServerFlags\"*)
  666. continue #these sections pre-created in /etc/X11/xorg.conf0
  667. ;;
  668. esac
  669. # Params are retained for the entire ASECTION loop.
  670. # I use TEMPSECTION since BASH is slow with file i/o -- so echo
  671. #+ only once for each section.
  672. # Tabs at beginning of lines are lost when reading, so I add them
  673. #+ where appropriate (i.e. before every line except for Section borders).
  674. #+ ("\n"=newline ; "\t"=tab)
  675. IDENTIFIER="" ; XSECTION="" ; TEMPSECTION=""
  676. while read ALINE
  677. do
  678. case "$ALINE" in
  679. EndSection*) #120318 improved...
  680. if [ "$XSECTION" = "InputDevice" -a "$IDENTIFIER" = "Keyboard0" ] ; then
  681. TEMPSECTION="$TEMPSECTION
  682. Option \"XkbRules\" \"xorg\"
  683. Option \"XkbModel\" \"${XKBMODEL}\"
  684. Option \"XkbLayout\" \"${XKBLAYOUT}\" #xkeymap0"
  685. if [ "$XKBVARIANT" ];then
  686. TEMPSECTION="$TEMPSECTION
  687. Option \"XkbVariant\" \"$XKBVARIANT\""
  688. fi
  689. elif [ "$XSECTION" = "Monitor" -a "$IDENTIFIER" = "Monitor0" ] ; then
  690. TEMPSECTION="$TEMPSECTION
  691. HorizSync HORIZSYNC0
  692. VertRefresh VERTREFRESH0
  693. #UseModes \"Modes0\" #monitor0usemodes
  694. Option \"PreferredMode\" \"PREFERREDMODE0\"
  695. $ALINE
  696. Section \"Modes\"
  697. Identifier \"Modes0\"
  698. #modes0modeline0
  699. EndSection"
  700. #v3.98 rerwin - added preferredmode line, after usemodes line.
  701. continue # we added the line before the "Modes" section, so continue
  702. fi
  703. TEMPSECTION="$TEMPSECTION\n$ALINE"
  704. continue # just added line -- no need to get to bottom
  705. ;;
  706. Section?\"*) XSECTION=${ALINE%\"*} ; XSECTION=${XSECTION##*\"}
  707. TEMPSECTION="\n$ALINE"
  708. continue # just added line -- no need to get to bottom
  709. ;;
  710. *Identifier*) IDENTIFIER=${ALINE%\"*} ; IDENTIFIER=${IDENTIFIER##*\"}
  711. ;;
  712. *\"ZAxisMapping\"*) continue
  713. ;;
  714. *HorizSync*[0-9]*) set -- $ALINE ; HORIZSYNC0="$2$3$4" ; continue
  715. ;;
  716. *VertRefresh*[0-9]*) set -- $ALINE ; VERTREFRESH0="$2$3$4" ; continue
  717. ;;
  718. *Option*\"Protocol\"?\"auto\"*)
  719. case "`cat /etc/mousedevice 2>/dev/null`" in
  720. input/mice) TEMPSECTION="$TEMPSECTION
  721. Option \"Protocol\" \"IMPS/2\" #mouse0protocol"
  722. continue
  723. ;;
  724. *ttyS*) TEMPSECTION="$TEMPSECTION
  725. Option \"Protocol\" \"Microsoft\" #mouse0protocol"
  726. continue
  727. ;;
  728. *) TEMPSECTION="$TEMPSECTION
  729. Option \"Protocol\" \"auto\" #mouse0protocol"
  730. continue
  731. ;;
  732. esac
  733. ;;
  734. */dev/mouse*|*/dev/input/mice*) #v2.21
  735. TEMPSECTION="$TEMPSECTION\n\t$ALINE"
  736. case "`cat /etc/xextraoptions`" in
  737. *2button*) BLA="" ;;
  738. *) BLA="#" ;;
  739. esac
  740. TEMPSECTION="$TEMPSECTION
  741. ${BLA}Option \"Emulate3Buttons\"
  742. ${BLA}Option \"Emulate3Timeout\" \"50\""
  743. if [ "`cat /etc/mousebuttons`" = "5" ] ; then #scrollwheel
  744. BLA=""
  745. else
  746. BLA="#"
  747. fi
  748. TEMPSECTION="$TEMPSECTION
  749. ${BLA}Option \"ZAxisMapping\" \"4 5\" #scrollwheel"
  750. continue # we added the line at the beginning
  751. ;;
  752. esac
  753. if [ "$XSECTION" = "Device" -a "$IDENTIFIER" = "Card0" ] ; then
  754. FBODY=${ALINE%\"*} ; FBODY=${FBODY##*\"}
  755. case "$ALINE" in
  756. *Driver*) CARD0DRIVER="$FBODY" ; ALINE="$ALINE #card0driver" ;;
  757. *VendorName*) CARD0VENDOR="$FBODY" ;;
  758. *BoardName*) CARD0BOARD="$FBODY" ;;
  759. *Screen1*Right?Of*Screen0*) ALINE="#$ALINE" ;;
  760. esac
  761. fi
  762. #091119 Comment out any lines for screens beside Screen0
  763. ALINE="$(echo "$ALINE" | sed 's/\s*Screen\s*[1-9]*\s*"Screen[1-9]"/#&/')"
  764. # add line to section (if we've come this far...)
  765. TEMPSECTION="$TEMPSECTION\n\t$ALINE"
  766. done <<_END2
  767. $(echo "$ASECTION" | tr '%' '\n')
  768. _END2
  769. echo -e "$TEMPSECTION" | sed -e 's/_PERCENTCHAR_/%/g' >> /etc/X11/xorg.conf #110701
  770. sync
  771. done <<_END1
  772. $(cat /root/xorg.conf.new | sed -e 's/%/_PERCENTCHAR_/g' | tr '\n' '%' | sed 's/EndSection/EndSection\n/g' )
  773. _END1
  774. ###################################################################
  775. #v2.21 quick hack...
  776. sed -e 's%/dev/input/mice%/dev/mouse%' /etc/X11/xorg.conf >/tmp/xorgconfmousefix
  777. mv -f /tmp/xorgconfmousefix /etc/X11/xorg.conf
  778. #echo "Probing the video card and monitor..."
  779. #code below is not distinguishing multiple cards/monitors...
  780. HORIZSYNC="$HORIZSYNC0"
  781. VERTREFRESH="$VERTREFRESH0"
  782. #want to choose a resolution and color-depth...
  783. ##sometimes get bogus '1x' or '0x' pixel horiz resolution...
  784. ddcprobe >/tmp/ddcprobe.txt
  785. #weird (ddcprobe is very weird), on some hardware, edid monitor probe fails
  786. #every alternate run of ddcprobe...
  787. case "`cat /tmp/ddcprobe.txt`" in *edidfail*)
  788. sleep 1
  789. ddcprobe >/tmp/ddcprobe.txt
  790. ;;
  791. esac
  792. #v3.93 rerwin: For some Tecra and Portege laptops, avoid an Xvesa hang by skipping "listmodes"
  793. #v3.96 added trident line...
  794. #v3.98 added more CYBER lines & corrected case
  795. XVESALISTOK="yes"
  796. TIMINGOK="yes"
  797. if [ -s /tmp/ddcprobeoem.txt ];then #v3.99 begin
  798. if [ ! -f /etc/xorgoverrides ] || ! grep -q -f /tmp/ddcprobeoem.txt /etc/xorgoverrides;then
  799. echo "`cat /tmp/ddcprobeoem.txt`" >> /etc/xorgoverrides #append new signature if user canceled out from hung Xvesa
  800. sync
  801. fi
  802. fi
  803. if [ -f /etc/xorgoverrides ] && grep -q -f /etc/xorgoverrides /tmp/ddcprobe.txt;then #v3.99 end
  804. XVESALISTOK="no" #'Xvesa -listmodes' hangs.
  805. TIMINGOK="no" #ddcprobe returns incomplete 'timing:' info (res's missing).
  806. [ "`grep 'mode: 640x480x64k' /tmp/ddcprobe.txt`" = "" ] && echo 'mode: 640x480x64k' >> /tmp/ddcprobe.txt
  807. [ "`grep 'mode: 640x480x16m' /tmp/ddcprobe.txt`" = "" ] && echo 'mode: 640x480x16m' >> /tmp/ddcprobe.txt
  808. [ "`grep 'mode: 800x600x64k' /tmp/ddcprobe.txt`" = "" ] && echo 'mode: 800x600x64k' >> /tmp/ddcprobe.txt
  809. [ "`grep 'mode: 800x600x16m' /tmp/ddcprobe.txt`" = "" ] && echo 'mode: 800x600x16m' >> /tmp/ddcprobe.txt
  810. [ "`grep 'mode: 1024x768x64k' /tmp/ddcprobe.txt`" = "" ] && echo 'mode: 1024x768x64k' >> /tmp/ddcprobe.txt
  811. [ "`grep 'mode: 1024x768x16m' /tmp/ddcprobe.txt`" = "" ] && echo 'mode: 1024x768x16m' >> /tmp/ddcprobe.txt
  812. fi #v3.93 end
  813. #v3.97 improved method: CM=Classmate, 915=chip 10=generation#...
  814. [ "`dmidecode -s bios-version | grep '^CM91510'`" != "" ] && echo 'timing: 800x480@60' >> /tmp/ddcprobe.txt
  815. #v3.95 recognise more special screens...
  816. DMIDECODE="`dmidecode`"
  817. #recognise EeePC Asus laptop...
  818. [ "`echo "$DMIDECODE" | grep 'Product Name: 701'`" != "" ] && [ "`echo "$DMIDECODE" | grep 'Serial Number: EeePC'`" != "" ] && echo 'timing: 800x480@60' >> /tmp/ddcprobe.txt
  819. #modes supported by card...
  820. CARDCHOICES=""
  821. if [ -e /usr/bin/Xvesa -a "$XVESALISTOK" = "yes" ];then #format of each line: 1024x768x16
  822. echo -e $(gettext '\nIf initialization freezes here, press ctrl-c and type "xorgwizard",\nselect "Xorg", choose monitor type and choose video mode.') #v3.99
  823. grep '^oem:' /tmp/ddcprobe.txt > /tmp/ddcprobeoem.txt #v3.99 current adapter signature
  824. Xvesa -listmodes 2>&1 | cut -f 2 -d ' ' | grep --extended-regexp 'x16$|x24$' | sort --field-separator=x --numeric-sort > /tmp/Xmodes.txt
  825. rm /tmp/ddcprobeoem.txt #v3.99 didn't hang in Xvesa, so delete signature
  826. else
  827. #the vesa 'mode:' lines returned by ddcprobe are very limited...
  828. grep '^mode:' /tmp/ddcprobe.txt | grep -E 'x64k|x16m'| cut -f 2 -d ' ' | sed -e 's/x64k/x16/g ; s/x16m/x24/g' > /tmp/Xmodes.txt
  829. fi
  830. sync
  831. CARDCHOICES="`cat /tmp/Xmodes.txt`"
  832. #frequencies supported by monitor...
  833. #Xorg probe may already have got this information...
  834. if [ "$HORIZSYNC" = "" -o "$VERTREFRESH" = "" ];then
  835. #one or both no good, so set both no good...
  836. HORIZSYNC=""
  837. VERTREFRESH=""
  838. else
  839. #both have values, but are they 'valid'? Xorg probe sometimes returns bogus values...
  840. BOGUSVAL="no"
  841. for ONEVAL in `echo -n "$HORIZSYNC" | tr '\-' ' ' | tr ',' ' ' | tr -s ' '`
  842. do
  843. [ ${ONEVAL%.*} -lt 10 ] && BOGUSVAL="yes"
  844. [ ${ONEVAL%.*} -gt 200 ] && BOGUSVAL="yes"
  845. done
  846. for ONEVAL in `echo -n "$VERTREFRESH" | tr '\-' ' ' | tr ',' ' ' | tr -s ' '`
  847. do
  848. [ ${ONEVAL%.*} -lt 10 ] && BOGUSVAL="yes"
  849. [ ${ONEVAL%.*} -gt 200 ] && BOGUSVAL="yes"
  850. done
  851. if [ "$BOGUSVAL" = "yes" ];then
  852. #one or both no good, so set both no good...
  853. HORIZSYNC=""
  854. VERTREFRESH=""
  855. fi
  856. fi
  857. MONCHOICES=""
  858. MONCUTXY=""
  859. if [ "$TIMINGOK" = "yes" ];then #v3.93
  860. #modes supported by monitor... format of each line: 1024x768@75
  861. #get too many weird resolutions, maybe better just only allow these...
  862. MONCHOICES="`grep -F 'timing:' /tmp/ddcprobe.txt | grep -E -v 'Apple|8514A|Mac II|\(XGA2\)' | grep -E ' 640x480@| 800x480@| 800x600@| 1024x600@| 1024x768@| 1280x768@| 1280x800@| 1280x1024@| 1366x768@| 1400x1050@| 1440x900@| 1600x900@| 1600x1200@| 1680x1050@| 1920x1080@| 1920x1200@' | cut -f 2 -d ' ' | sort -u`"
  863. #no, better if reject known weird resolutions...
  864. #...no, ddcprobe is buggy, returns random resolutions, cannot screen all out!
  865. MONCUTXY="`echo "$MONCHOICES" | cut -f 1 -d '@' | sort -u`" #each line: 1024x768
  866. fi
  867. #if Xorg probe failed to determine monitor freq, try ddcprobe...
  868. if [ "$HORIZSYNC" = "" -o "$VERTREFRESH" = "" ];then
  869. MONFREQ="`grep -F 'monitorrange:' /tmp/ddcprobe.txt | cut -f 2-10 -d ' '`"
  870. HORIZSYNC="`echo -n "$MONFREQ" | cut -f 1 -d ','`"
  871. VERTREFRESH="`echo -n "$MONFREQ" | cut -f 2 -d ',' | tr -d ' '`"
  872. fi
  873. #ddcprobe on my laptop returns one 'timing:' line but no 'monitorrange:', so
  874. #can fall back to calculating freqs...
  875. if [ ! "$MONCHOICES" = "" ];then
  876. ##hmmm, maybe always use the freqs of the 'timing:' lines rather than the
  877. ##'monitorrange:' as it always seems to be too high...
  878. if [ "$HORIZSYNC" = "" -o "$VERTREFRESH" = "" ];then
  879. UHORIZSYNC=32 #start with mediocre values.
  880. UVERTREFRESH=60 # /
  881. LHORIZSYNC=30 # /
  882. LVERTREFRESH=56 # /
  883. for ONECH in $MONCHOICES #format: 1024x768@75
  884. do
  885. ONEVERT=${ONECH#*@}
  886. ONEX=${ONECH%x*}
  887. ONEY=${ONECH#*x} ; ONEY=${ONEY%@*}
  888. ONEHORIZ=`gtf $ONEX $ONEY $ONEVERT | grep -o 'hsync:.*' | cut -f 2 -d ' ' | cut -f 1 -d '.'`
  889. [ $ONEVERT -lt $LVERTREFRESH ] && LVERTREFRESH=$ONEVERT
  890. [ $ONEHORIZ -gt $UHORIZSYNC ] && UHORIZSYNC=$ONEHORIZ
  891. #it seems ddcprobe truncates any fractional part off vertrefresh...
  892. ONEVERT=`expr $ONEVERT + 1`
  893. ONEHORIZ=`gtf $ONEX $ONEY $ONEVERT | grep -o 'hsync:.*' | cut -f 2 -d ' ' | cut -f 1 -d '.'`
  894. [ $ONEVERT -gt $UVERTREFRESH ] && UVERTREFRESH=$ONEVERT
  895. [ $ONEHORIZ -lt $LHORIZSYNC ] && LHORIZSYNC=$ONEHORIZ
  896. done
  897. #v3.93 hmmm, above still can round down too much, add 2...
  898. UHORIZSYNC=`expr $UHORIZSYNC + 2`
  899. HORIZSYNC="${LHORIZSYNC}-${UHORIZSYNC}"
  900. VERTREFRESH="${LVERTREFRESH}-${UVERTREFRESH}"
  901. fi
  902. fi
  903. RECMODE="800x600x16" #default recommended mode.
  904. #if ddcprobe also failed, have to ask monitor type...
  905. if [ "$HORIZSYNC" = "" -o "$VERTREFRESH" = "" ];then #"" if monitor not plug-n-play.
  906. ## Dougal: (v2.16??) removed MONTYPES param, added case-structure below
  907. ## Dougal: modified formatting of list: old tag format used to give problems,
  908. ##+ since we had the same tag for different options! (eg. "h31.5-90v60")
  909. MONCHOICES=""
  910. MONCUTXY=""
  911. while [ 1 ];do
  912. #need a dialog, ask generic monitor type... 100510 fix column alignment...
  913. dialog --no-collapse --no-cancel --title "$(gettext 'Puppy Video Wizard')" --menu "`gettext \"Automatic probing of your monitor was unsuccessful, so you now need\nto choose from a list of generic monitor types.\nChoose the highest specification that describes your monitor.\nLCD: Liquid Crystal Display.\nCRT: Cathode Ray Tube (normal monitor).\nChoose \"Z\" if you have the monitor user manual, and it has the\nhorizontal and vertical frequency specifications.\nDOWN-ARROW to highlight choice, ENTER key to finish...\"`" 0 0 0 \
  914. "A" "h31.5v40-70 LCD Panel 640x480" \
  915. "B" "h31.5-37v40-70 LCD Panel 800x600" \
  916. "B2" "h31.5-90v60 LCD Panel 1024x600" \
  917. "C" "h31.5-48.5v40-70 LCD Panel 1024x768" \
  918. "D" "h31.5-90v60 LCD Panel 1280x800" \
  919. "E" "h31.5-67v50-75 LCD Panel 1280x1024" \
  920. "F" "h31.5-90v60 LCD Panel 1366x768" \
  921. "G" "h31.5-90v59-75 LCD Panel 1400x1050" \
  922. "H" "h31.5-100v59-75 LCD Panel 1440x900" \
  923. "I" "h31.5-90v60 LCD Panel 1600x1200" \
  924. "J" "h31.5-90v60 LCD Panel 1680x1050" \
  925. "K" "h30-68v67 LCD HDTV 1920x1080" \
  926. "L" "h31.5-90v60 LCD Panel 1920x1200" \
  927. "M" "h31.5v50-61 CRT 640x480" \
  928. "N" "h31.5-35v50-61 CRT 800x600 (old 14inch monitor)" \
  929. "O" "h31.5-48.5v56-72 CRT 1024x768 (basic 15inch monitor)" \
  930. "P" "h31.5-79v50-90 CRT 1280x1024 (basic 17inch monitor)" \
  931. "Q" "h31.5-90v50-90 CRT 1400x1050" \
  932. "R" "h31.5-94v50-90 CRT 1600x1200" \
  933. "Z" "$(gettext 'SELECT THIS IF YOU KNOW MONITOR FREQUENCY SPECS')" \
  934. 2>/tmp/taggen.txt
  935. CHOICE="`cat /tmp/taggen.txt 2>/dev/null`"
  936. [ "$CHOICE" = "" ] && continue
  937. ## Dougal: use case-structure for setting params -- safer than the old way
  938. ## (not sure why Barry only uses 16-bit, maybe worth improving?)
  939. case "$CHOICE" in
  940. A) # "h31.5v40-70 LCD Panel 640x480"
  941. RECMODE="640x480x16"
  942. HORIZSYNC="31.5"
  943. VERTREFRESH="40-70"
  944. ;;
  945. B) # "h31.5-37v40-70 LCD Panel 800x600"
  946. RECMODE="800x600x16"
  947. HORIZSYNC="31.5-37"
  948. VERTREFRESH="40-70"
  949. ;;
  950. B2) # "h31.5-90v60 LCD Panel 1024x600"
  951. RECMODE="1024x600x16"
  952. HORIZSYNC="31.5-90"
  953. VERTREFRESH="60"
  954. ;;
  955. C) # "h31.5-48.5v40-70 LCD Panel 1024x768"
  956. RECMODE="1024x768x16"
  957. HORIZSYNC="31.5-48.5"
  958. VERTREFRESH="40-70"
  959. ;;
  960. D) # "h31.5-90v60 LCD Panel 1280x800"
  961. RECMODE="1280x800x16"
  962. HORIZSYNC="31.5-90"
  963. VERTREFRESH="60"
  964. ;;
  965. E) # "h31.5-67v50-75 LCD Panel 1280x1024"
  966. RECMODE="1280x1024x16"
  967. HORIZSYNC="31.5-67"
  968. VERTREFRESH="50-75"
  969. ;;
  970. F) # "h31.5-90v60 LCD Panel 1366x768"
  971. RECMODE="1366x768x16"
  972. HORIZSYNC="31.5-90"
  973. VERTREFRESH="60"
  974. ;;
  975. G) # "h31.5-90v59-75 LCD Panel 1400x1050"
  976. RECMODE="1400x1050x16"
  977. HORIZSYNC="31.5-90"
  978. VERTREFRESH="59-75"
  979. ;;
  980. H) # "h31.5-100v59-75 LCD Panel 1440x900"
  981. RECMODE="1440x900x16"
  982. HORIZSYNC="31.5-100"
  983. VERTREFRESH="59-75"
  984. ;;
  985. I) # "h31.5-90v60 LCD Panel 1600x1200"
  986. RECMODE="1600x1200x16"
  987. HORIZSYNC="31.5-90"
  988. VERTREFRESH="60"
  989. ;;
  990. J) # "h31.5-90v60 LCD Panel 1680x1050"
  991. RECMODE="1680x1050x16"
  992. HORIZSYNC="31.5-90"
  993. VERTREFRESH="60"
  994. ;;
  995. K) # "h30-68v67 LCD HDTV 1920x1080"
  996. RECMODE="1920x1080x16"
  997. HORIZSYNC="30-68"
  998. VERTREFRESH="67"
  999. ;;
  1000. L) # "h31.5-90v60 LCD Panel 1920x1200"
  1001. RECMODE="1920x1200x16"
  1002. HORIZSYNC="31.5-90"
  1003. VERTREFRESH="60"
  1004. ;;
  1005. M) # "h31.5v50-61 CRT 640x480"
  1006. RECMODE="640x480x16"
  1007. HORIZSYNC="31.5"
  1008. VERTREFRESH="50-61"
  1009. ;;
  1010. N) # "h31.5-35v50-61 CRT 800x600 (old 14inch monitor)"
  1011. RECMODE="800x600x16"
  1012. HORIZSYNC="31.5-35"
  1013. VERTREFRESH="50-61"
  1014. ;;
  1015. O) # "h31.5-48.5v56-72 CRT 1024x768 (basic 15inch monitor)"
  1016. RECMODE="1024x768x16"
  1017. HORIZSYNC="31.5-48.5"
  1018. VERTREFRESH="56-72"
  1019. ;;
  1020. P) # "h31.5-79v50-90 CRT 1280x1024 (basic 17inch monitor)"
  1021. RECMODE="1280x1024x16"
  1022. HORIZSYNC="31.5-79"
  1023. VERTREFRESH="50-90"
  1024. ;;
  1025. Q) # "h31.5-90v50-90 CRT 1400x1050"
  1026. RECMODE="1400x1050x16"
  1027. HORIZSYNC="31.5-90"
  1028. VERTREFRESH="50-90"
  1029. ;;
  1030. R) # "h31.5-94v50-90 CRT 1600x1200"
  1031. RECMODE="1600x1200x16"
  1032. HORIZSYNC="31.5-94"
  1033. VERTREFRESH="50-90"
  1034. ;;
  1035. Z) # "SELECT THIS IF YOU KNOW MONITOR FREQUENCY SPECS"
  1036. dialog --title "$(gettext 'Xorg Video Wizard')" --inputbox "$(gettext 'Please enter the horizontal frequency range of the monitor, in KHz. An example is given:')" 0 0 "31.5-48.5" 2>/tmp/taghoriz.txt
  1037. dialog --title "$(gettext 'Xorg Video Wizard')" --inputbox "$(gettext 'Please enter the vertical frequency range of the monitor, in Hz. An example is given:')" 0 0 "56-72" 2>/tmp/tagvert.txt
  1038. HORIZSYNC="`cat /tmp/taghoriz.txt 2>/dev/null`"
  1039. VERTREFRESH="`cat /tmp/tagvert.txt 2>/dev/null`"
  1040. [ "$HORIZSYNC" = "" ] && continue
  1041. [ "$VERTREFRESH" = "" ] && continue
  1042. # comment out -- it's the default from above
  1043. #RECMODE="800x600x16"
  1044. ;;
  1045. esac
  1046. break
  1047. done
  1048. fi
  1049. #100406 loop back offer more modes if MONCHOICES inadequate...
  1050. while [ 1 ];do #more-monchoices-loop
  1051. #if have MONCHOICES, that's all i want to display (with warning if not in card list).
  1052. #if no MONCHOICES, then display card list only...
  1053. echo -n "" > /tmp/finalchoices.txt
  1054. if [ "$MONCHOICES" = "" ];then
  1055. for ONECHOICE in $CARDCHOICES
  1056. do
  1057. if [ "$RECMODE" = "$ONECHOICE" ];then
  1058. echo "$ONECHOICE \"$(gettext 'Unconfirmed MAXIMUM for monitor, OK for card')\" \\" >> /tmp/finalchoices.txt
  1059. else
  1060. echo "$ONECHOICE \"$(gettext 'Unconfirmed for monitor, OK for video card')\" \\" >> /tmp/finalchoices.txt
  1061. fi
  1062. done
  1063. for ONECHOICE in 640x480x16 800x600x16 1024x600x16 1024x768x16 1280x800x16 1280x1024x16 1366x768x16 1400x1050x16 1440x900x16 1600x1200x16 1680x1050x16 1920x1080x16 1920x1200x16 640x480x24 800x600x24 1024x600x24 1024x768x24 1280x800x24 1280x1024x24 1366x768x24 1400x1050x24 1440x900x24 1600x1200x24 1680x1050x24 1920x1080x24 1920x1200x24
  1064. do
  1065. case "$CARDCHOICES" in *$ONECHOICE*) ;; *) # we've done CARDCHOICES above
  1066. echo "$ONECHOICE \"$(gettext 'Unconfirmed for monitor, maybe NOT OK for card')\" \\" >> /tmp/finalchoices.txt ;;
  1067. esac
  1068. done
  1069. else
  1070. #decide on a default... (already 800x600x16 earlier) no, reset...
  1071. RECMODE=""
  1072. case "$MONCUTXY" in
  1073. *1024x768*) RECMODE="1024x768x16" ;;
  1074. *800x600*) RECMODE="800x600x16" ;;
  1075. esac
  1076. for ONECUTXY in $MONCUTXY #1024x768
  1077. do
  1078. for ONECHOICE in ${ONECUTXY}x16 ${ONECUTXY}x24
  1079. do
  1080. case "$CARDCHOICES" in
  1081. *$ONECHOICE*) echo "$ONECHOICE \"$(gettext 'OK for monitor, OK for video card')\" \\" >> /tmp/finalchoices.txt ;;
  1082. *) echo "$ONECHOICE \"$(gettext 'OK for monitor, maybe NOT OK for card')\" \\" >> /tmp/finalchoices.txt ;;
  1083. esac
  1084. done
  1085. done
  1086. fi
  1087. FINALCHOICES="`cat /tmp/finalchoices.txt | sort --field-separator=x --numeric-sort`" #v3.93 rerwin
  1088. if [ "$MONCHOICES" = "" ];then #100406
  1089. echo '#!/bin/sh' > /tmp/choosexmodedlg
  1090. echo -n "dialog --colors --extra-button --aspect 11 --default-item $RECMODE" >> /tmp/choosexmodedlg
  1091. echo ' --no-collapse --title "'$(gettext 'Puppy Video Wizard')'" --ok-label "OK" --extra-label "'$(gettext 'TEST')'" --cancel-label "'$(gettext 'EXIT')'" --menu "'$(gettext 'Please use the UP/DOWN ARROW keys to select a video mode. Choices are
  1092. shown in the format WidthxHeightxBits, where Width and Height are
  1093. screen resolution in pixels, 16/24 bits = 65,536/16,777,216 colors.')'
  1094. ' >> /tmp/choosexmodedlg
  1095. [ ! "$RECMODE" = "" ] && echo "`eval_gettext \"CANNOT DECIDE? ...\\\${RECMODE} is suggested as a good choice.\"`" >> /tmp/choosexmodedlg
  1096. echo '\Z1'$(gettext 'RECOMMENDATION: Choose <TEST> button to verify it works!')'\Z0' >> /tmp/choosexmodedlg
  1097. echo '
  1098. '$(gettext 'OK: Just press ENTER key to immediately use the selected mode...')'
  1099. '$(gettext 'TEST: TAB key then ENTER to test and debug the mode before using it...')'
  1100. '$(gettext 'EXIT: Exit to text-mode console, do not start X...')'\Zn" 0 0 0 \' >> /tmp/choosexmodedlg #'geanyfix
  1101. echo "$FINALCHOICES" >> /tmp/choosexmodedlg
  1102. echo ' 2>/tmp/tag.txt' >> /tmp/choosexmodedlg
  1103. echo 'exit $?' >> /tmp/choosexmodedlg
  1104. chmod 755 /tmp/choosexmodedlg
  1105. /tmp/choosexmodedlg
  1106. XAUTO=$? #=0 for automatic.
  1107. [ $XAUTO -ne 0 ] && [ $XAUTO -ne 3 ] && exit #drop out to console.
  1108. else
  1109. #offer more resolutions if MONCHOICES inadequate...
  1110. echo '#!/bin/sh' > /tmp/choosexmodedlg
  1111. echo -n "dialog --colors --extra-button --aspect 11 --default-item $RECMODE" >> /tmp/choosexmodedlg
  1112. echo ' --no-collapse --title "'$(gettext 'Puppy Video Wizard')'" --ok-label "OK" --extra-label "'$(gettext 'TEST')'" --cancel-label "'$(gettext 'MORE')'" --menu "'$(gettext 'Please use the UP/DOWN ARROW keys to select a video mode. Choices are
  1113. shown in the format WidthxHeightxBits, where Width and Height are
  1114. screen resolution in pixels, 16/24 bits = 65,536/16,777,216 colors.')'
  1115. ' >> /tmp/choosexmodedlg
  1116. [ "$RECMODE" != "" ] && echo "`eval_gettext \"CANNOT DECIDE? ...\\\${RECMODE} is suggested as a good choice.\"`" >> /tmp/choosexmodedlg
  1117. echo '\Z1'$(gettext 'RECOMMENDATION: Choose <TEST> button to verify it works!')'\Z0' >> /tmp/choosexmodedlg
  1118. echo '
  1119. '$(gettext 'NOTICE: If auto-probe has not detected a resolution that you know your monitor supports, click the <MORE> button to display more resolutions to choose from...')'' >> /tmp/choosexmodedlg
  1120. echo '
  1121. '$(gettext 'OK: Just press ENTER key to immediately use the selected mode...')'
  1122. '$(gettext 'TEST: TAB key then ENTER to test and debug the mode before using it...')'
  1123. '$(gettext 'MORE: Display more monitor resolutions to choose from...')'\Zn" 0 0 0 \' >> /tmp/choosexmodedlg #'geanyfix.
  1124. echo "$FINALCHOICES" >> /tmp/choosexmodedlg
  1125. echo ' 2>/tmp/tag.txt' >> /tmp/choosexmodedlg
  1126. echo 'exit $?' >> /tmp/choosexmodedlg
  1127. chmod 755 /tmp/choosexmodedlg
  1128. /tmp/choosexmodedlg
  1129. XAUTO=$? #=0 for automatic.
  1130. if [ $XAUTO -eq 1 ];then #MORE
  1131. MONCHOICES=""
  1132. continue #more-monchoices-loop
  1133. fi
  1134. [ $XAUTO -ne 0 ] && [ $XAUTO -ne 3 ] && exit #drop out to console. maybe pressed ESC.
  1135. fi
  1136. break
  1137. done #end more-monchoices-loop
  1138. CHOSENRES="`cat /tmp/tag.txt 2>/dev/null`"
  1139. [ "$CHOSENRES" = "" ] && CHOSENRES="800x600x16"
  1140. FINALDEPTH=${CHOSENRES##*x}
  1141. FINALXY=${CHOSENRES%x*}
  1142. #some monitors have a very high vertrefresh, and Xorg uses it, but it is too high...
  1143. #v2.13b2 was 95, make it 85...
  1144. ## Dougal: note that old code (line below) didn't work in my case: 50.0-160.0
  1145. ##+ seems like the ".0" gave it problems, so ended up with MAXVERT=""
  1146. #MAXVERT=`echo -n "$VERTREFRESH" | grep -o '[ -,][0-9]*$' | sed -e 's/^[ -,]//g'`
  1147. MAXVERT=${VERTREFRESH#*-} ; MAXVERT=${MAXVERT%.*}
  1148. if [ $MAXVERT -gt 85 ];then
  1149. VERTREFRESH=${VERTREFRESH/$MAXVERT/85}
  1150. else
  1151. #want to cut down rating on modern LCD panels also...
  1152. if [ $MAXVERT -gt 74 ] && [ $MAXVERT -lt 86 ];then
  1153. #and if manufactured in 2004 or later...
  1154. #(so older CRTs in this range maxvert 75-85 will get rejected)
  1155. if grep '^manufacture:' /tmp/ddcprobe.txt | grep -E -q ' 20[123][0-9]| 200[4-9]' ;then
  1156. let LCDMAXVERT=MAXVERT-4
  1157. VERTREFRESH=${VERTREFRESH/$MAXVERT/$LCDMAXVERT}
  1158. fi
  1159. fi
  1160. fi
  1161. #script also needs these max freqs later on...
  1162. MAXHORIZ=${HORIZSYNC#*-} #; MAXHORIZ=${MAXHORIZ%.*}
  1163. MINVERT=${VERTREFRESH%-*} #; MINVERT=${MINVERT%.*}
  1164. MINHORIZ=${HORIZSYNC%-*} #; MINHORIZ=${MINHORIZ%.*}
  1165. #now write the Screen section...
  1166. #091119 handle multiple screens... 100430 add metamodes entry...
  1167. SCREEN_LIST=$(grep -o '^[^a-zA-Z]*Screen[^"]*"Screen[0-9]\+"' /etc/X11/xorg.conf | grep -o 'Screen[0-9]\+' | grep -o '[0-9]\+')
  1168. SCRNSECTION=""
  1169. for i in $SCREEN_LIST; do
  1170. SCRNSECTION="$SCRNSECTION
  1171. Section \"Screen\"
  1172. Identifier \"Screen$i\"
  1173. Device \"Card$i\"
  1174. Monitor \"Monitor$i\"
  1175. DefaultDepth $FINALDEPTH
  1176. #Option \"metamodes\" \"${FINALXY}_60 +0+0\" #METAMODES_${i}
  1177. Subsection \"Display\"
  1178. Depth $FINALDEPTH
  1179. Modes \"${FINALXY}\"
  1180. EndSubsection
  1181. EndSection
  1182. "
  1183. done
  1184. echo "$SCRNSECTION" >> /etc/X11/xorg.conf
  1185. PREFERREDMODE=$FINALXY #v3.98 rerwin - set monitor preferred mode same as screen mode.
  1186. #horiz and vert sync ranges and preferred mode were found earlier but not written... v3.98
  1187. cp -f /etc/X11/xorg.conf /tmp/xorg.conf.tmp
  1188. sed -e "s/HORIZSYNC0/$HORIZSYNC/g ; s/VERTREFRESH0/$VERTREFRESH/g ; s/PREFERREDMODE0/$PREFERREDMODE/g" /tmp/xorg.conf.tmp >/etc/X11/xorg.conf #v3.98 rerwin - added update of preferredmode.
  1189. sync
  1190. #110927 improved touchpad code...
  1191. if [ "`grep -E 'Elantech|Alps|Synaptics' /proc/bus/input/devices`" ];then
  1192. cp -f /etc/X11/xorg.conf /etc/X11/xorg.conf-without-synaptic
  1193. if [ "`lsmod | grep '^evdev'`" == "" ];then
  1194. modprobe evdev
  1195. [ "`grep '^modprobe evdev' /etc/rc.d/rc.local`" == "" ] && echo "modprobe evdev" >> /etc/rc.d/rc.local
  1196. fi
  1197. # Where we want to insert new lines...
  1198. OLD1='Section "Module"'
  1199. OLD2='Section "ServerLayout"'
  1200. #110927 there may be two Monitor sections, need special once-only insertion...
  1201. #format: sed '1,/wrong pattern/s/wrong pattern/good pattern/' wrong.file
  1202. #see ref: http://www.suwald.com/linux-gnu/sed-howto.html
  1203. sed -i '1,/Section "Monitor"/s/Section "Monitor"/Section "Monitor" #sectionmonitor0/' /etc/X11/xorg.conf-without-synaptic
  1204. OLD3='Section "Monitor" #sectionmonitor0'
  1205. NEW1='Section "Module"\
  1206. Load "synaptics" #loadsynaptics'
  1207. NEW2='Section "ServerLayout"\
  1208. InputDevice "Synaptics Mouse" "AlwaysCore" #serverlayoutsynaptics'
  1209. if vercmp $XORGVER lt 1.10.0;then #110701
  1210. if grep -F -q 'Elantech' /proc/bus/input/devices ; then #100602 jemimah
  1211. NEW3='Section "InputDevice"\
  1212. Identifier "Synaptics Mouse"\
  1213. Driver "synaptics"\
  1214. Option "Device" "/dev/psaux"\
  1215. Option "Protocol" "auto-dev"\
  1216. Option "LeftEdge" "60"\
  1217. Option "RightEdge" "1070"\
  1218. Option "TopEdge" "90"\
  1219. Option "BottomEdge" "680"\
  1220. Option "Emulate3Buttons" "on"\
  1221. Option "MaxTapTime" "180"\
  1222. Option "MaxTapMove" "59"\
  1223. Option "VertScrollDelta" "20"\
  1224. Option "MinSpeed" "0.75"\
  1225. Option "MaxSpeed" "1.00"\
  1226. Option "AccelFactor" "0.16"\
  1227. Option "SHMConfig" "on"\
  1228. Option "VertEdgeScroll" "on"\
  1229. Option "TapButton1" "1"\
  1230. EndSection\
  1231. \
  1232. Section "Monitor" #sectionmonitor0'
  1233. fi
  1234. if grep -F -q 'Alps' /proc/bus/input/devices ; then #Dougal
  1235. NEW3='Section "InputDevice"\
  1236. Identifier "Synaptics Mouse"\
  1237. Driver "synaptics"\
  1238. Option "Device" "/dev/psaux"\
  1239. Option "Protocol" "auto-dev"\
  1240. Option "LeftEdge" "120"\
  1241. Option "RightEdge" "930"\
  1242. Option "TopEdge" "120"\
  1243. Option "BottomEdge" "650"\
  1244. Option "FingerLow" "14"\
  1245. Option "FingerHigh" "15"\
  1246. Option "MaxTapTime" "0"\
  1247. Option "MaxTapMove" "110"\
  1248. Option "VertScrollDelta" "20"\
  1249. Option "MinSpeed" "0.3"\
  1250. Option "MaxSpeed" "0.75"\
  1251. Option "AccelFactor" "0.030"\
  1252. Option "EdgeMotionMinSpeed" "200"\
  1253. Option "EdgeMotionMaxSpeed" "200"\
  1254. Option "UpDownScrolling" "1"\
  1255. Option "CircularScrolling" "1"\
  1256. Option "CircScrollDelta" "0.1"\
  1257. Option "CircScrollTrigger" "2"\
  1258. Option "SHMConfig" "on"\
  1259. EndSection\
  1260. \
  1261. Section "Monitor" #sectionmonitor0'
  1262. fi
  1263. if grep -F -q 'Synaptics' /proc/bus/input/devices ; then #kirk
  1264. NEW3='Section "InputDevice"\
  1265. Identifier "Synaptics Mouse"\
  1266. Driver "synaptics"\
  1267. Option "Device" "/dev/psaux"\
  1268. Option "Protocol" "auto-dev"\
  1269. Option "LeftEdge" "1700"\
  1270. Option "RightEdge" "5300"\
  1271. Option "TopEdge" "1700"\
  1272. Option "BottomEdge" "4200"\
  1273. Option "FingerLow" "25"\
  1274. Option "FingerHigh" "30"\
  1275. Option "MaxTapTime" "0"\
  1276. Option "MaxTapMove" "220"\
  1277. Option "VertScrollDelta" "100"\
  1278. Option "MinSpeed" "0.10"\
  1279. Option "MaxSpeed" "0.30"\
  1280. Option "AccelFactor" "0.0030"\
  1281. Option "SHMConfig" "on"\
  1282. #Option "Repeater" "/dev/ps2mouse"\
  1283. EndSection\
  1284. \
  1285. Section "Monitor" #sectionmonitor0'
  1286. fi
  1287. else #120129 jemimah: add Option "SHMConfig" "on"...
  1288. NEW3='Section "InputDevice"\
  1289. Identifier "Synaptics Mouse"\
  1290. Driver "synaptics"\
  1291. Option "SHMConfig" "on"\
  1292. EndSection\
  1293. \
  1294. Section "Monitor" #sectionmonitor0'
  1295. fi
  1296. sed "s%$OLD1%$NEW1% ; s%$OLD2%$NEW2% ;s%$OLD3%$NEW3%" /etc/X11/xorg.conf-without-synaptic >/etc/X11/xorg.conf
  1297. fi
  1298. #100820 for intel video, mplayer needs this...
  1299. zVIDEODRVR="`grep '#card0driver' /etc/X11/xorg.conf | cut -f 2 -d '"'`" #'geany
  1300. case $zVIDEODRVR in
  1301. intel|i810)
  1302. [ "`grep '"LinearAlloc" "6144"' /etc/X11/xorg.conf`" = "" ] && sed -i -e 's%#card0driver%#card0driver\n\tOption "LinearAlloc" "6144"%' /etc/X11/xorg.conf
  1303. ;;
  1304. esac
  1305. #v2.13 want a hardware profile so can bootup on different PCs...
  1306. PROFILECHIP="`grep -m1 '^oem: ' /tmp/ddcprobe.txt | cut -f 2-4 -d ' ' | tr ' ' '_' | sed -e 's/[^0-9a-zA-Z]/_/g'`"
  1307. ## Dougal: maybe add "^monitorname: "??
  1308. #v3.95 'eisa:' and 'id:' return fluctuating values on some PCs, so search in this order...
  1309. PROFILEMONITOR="`grep '^monitorid: ' /tmp/ddcprobe.txt | head -n 1 | cut -f 2 -d ':' | tr -d ' ' | sed -e 's/[^0-9a-zA-Z]/_/g'`"
  1310. [ "$PROFILEMONITOR" = "" ] && PROFILEMONITOR="`grep '^monitorname: ' /tmp/ddcprobe.txt | head -n 1 | cut -f 2 -d ':' | tr -d ' ' | sed -e 's/[^0-9a-zA-Z]/_/g'`"
  1311. [ "$PROFILEMONITOR" = "" ] && PROFILEMONITOR="`grep '^monitorrange: ' /tmp/ddcprobe.txt | head -n 1 | cut -f 2 -d ':' | tr -d ' ' | sed -e 's/[^0-9a-zA-Z]/_/g'`"
  1312. echo "#PuppyHardwareProfile=${PROFILECHIP}${PROFILEMONITOR}" >> /etc/X11/xorg.conf
  1313. #create a copy of xorg.conf with the profile in the filename...
  1314. cp -af /etc/X11/xorg.conf /etc/X11/xorg.conf.${PROFILECHIP}${PROFILEMONITOR}
  1315. #also write profile to the backup (used for tweaking vertrefresh)...
  1316. echo "#PuppyHardwareProfile=${PROFILECHIP}${PROFILEMONITOR}" >> /tmp/xorg.conf.tmp
  1317. #v2.12
  1318. #note, this code will have to go into 'xwin' also.
  1319. #video bios may not offer the chosen resolution if it is widescreen.
  1320. #for intel video there is a way to patch the video bios, but this
  1321. #has to be run at every boot...
  1322. if grep -F 'oem:' /tmp/ddcprobe.txt | grep -F -q 'Intel' ;then
  1323. MYXYRES=${CHOSENRES%x*}
  1324. if ! grep -q "$MYXYRES" /tmp/Xmodes.txt ;then
  1325. MYXRES=${CHOSENRES%%x*}
  1326. MYYRES=${CHOSENRES%x*} ; MYYRES=${MYYRES#*x}
  1327. #this is an app that patches video-bios, but in ram only...
  1328. 915resolution 38 $MYXRES $MYYRES
  1329. #...replaces mode 38 (1024x768).
  1330. #create something for xwin to eecute...
  1331. echo "915resolution 38 $MYXRES $MYYRES" > /etc/resolutionfix
  1332. fi
  1333. else
  1334. #in case plug usb or multisession-cd into different pc...
  1335. [ -f /etc/resolutionfix ] && rm -f /etc/resolutionfix
  1336. fi
  1337. [ $XAUTO -ne 0 ] && [ $XAUTO -ne 3 ] && exit #drop out to console.
  1338. #code here to test the video...
  1339. CHOSENVERT=""
  1340. while [ $XAUTO -ne 0 ];do #testloop
  1341. case "`cat /etc/mousedevice 2>/dev/null`" in #w468
  1342. tty*)
  1343. MOUSEMSG="
  1344. $(gettext 'Puppy thinks that you have a serial mouse. This type of mouse is
  1345. on ancient PCs. Most modern PCs use a usb or ps/2 mouse. If your
  1346. PC does not have a serial mouse, then you must choose the
  1347. <Change_mouse> button now.')"
  1348. ;;
  1349. *)
  1350. MOUSEMSG="
  1351. $(gettext 'Puppy thinks that you have a usb or ps/2 mouse. This is okay for
  1352. most cases, but some old computers have a serial mouse. If you have
  1353. an ancient PC that you know has a serial mouse, then you must choose
  1354. the <Change_mouse> button now.')"
  1355. ;;
  1356. esac
  1357. dialog --title "$(gettext 'Xorg Video Wizard')" --yes-label "$(gettext 'TEST_X_NOW')" --no-label "$(gettext 'Change_mouse')" --yesno "$(gettext 'Okay, just about to take the plunge.')
  1358. ${MOUSEMSG}
  1359. $(gettext 'After choosing <TEST_X_NOW> button, if the next screen shows a nice
  1360. dialog box, then X started okay. If the screen is blank or garbage,
  1361. then failure (In such a case, just press the ENTER key to terminate
  1362. the test, preferably within the 60 second test timeout).')
  1363. $(gettext 'IMPORTANT: If the ENTER key does not terminate the test, press the
  1364. combination CTRL-ALT-BACKSPACE (some odd old PCs may even require
  1365. you to press CTRL-ALT-BACKSPACE twice to terminate the test!)')
  1366. $(gettext 'Press ENTER key now to start X graphics mode (may take a few secs)...')
  1367. $(gettext 'TAB then ENTER to change the mouse (afterward will return here)...')" 0 0
  1368. if [ ! $? -eq 0 ];then
  1369. #change the mouse... (then go back up to above dialog)
  1370. choosemousefunc
  1371. #w480 bugfix, latter used if choose tweak refresh...
  1372. cp -f /etc/X11/xorg.conf /tmp/xorg.conf.tmp
  1373. continue
  1374. fi
  1375. #w460 test Xorg...
  1376. export MONCHOICES
  1377. xinit /usr/sbin/xinitrc_test -- /usr/bin/Xorg :0 #101224 added LANG=C. 120213 removed LANG=C prefix.
  1378. eval "`cat /tmp/xorgwizard_initrc_test_results`" #results from xinitrc_test
  1379. #...XTEST, YTEST, HSTEST, VRTEST.
  1380. load_consolefont #120301 it seems have to reload console font after exit from X.
  1381. if [ -e /usr/bin/Xvesa ];then
  1382. TWKMSG="$(gettext "Note: If you have tweaked away, to no avail, choose \"FINISHED\" and you
  1383. will get one final chance to fall back to using Xvesa.
  1384. Note: If display has only minor displacement or proportions error, run
  1385. (with care) Xvidtune module in Xorg Wizard within X (Setup menu).
  1386. Press ENTER if test was okay (or to fall back to Xvesa)...") "
  1387. else
  1388. TWKMSG="$(gettext 'Press ENTER key if test was okay...')"
  1389. fi
  1390. dialog --no-collapse --title "$(gettext 'Xorg Video Wizard')" --yes-label "$(gettext 'FINISHED')" --no-label "$(gettext 'Tweak')" --yesno "$(gettext 'Report on X test:')
  1391. `eval_gettext \"Resolution: \\\${XTEST}x\\\${YTEST} pixels\"`
  1392. `eval_gettext \"Horizontal frequency: \\\$HSTEST KHz\"`
  1393. `eval_gettext \"Refresh frequency: \\\$VRTEST Hz\"`
  1394. `eval_gettext \"Video driver: \\\$CARD0DRIVER\"`
  1395. $(gettext 'If you are reporting success, great, but if the display was not quite
  1396. right, say displaced or distorted, you now have the option of tweaking
  1397. various parameters, even choose a different video driver.
  1398. Ditto if testing X was an abysmal failure.')
  1399. ${TWKMSG}
  1400. $(gettext 'TAB then ENTER to tweak parameters & retest X...')" 0 0
  1401. if [ $? -eq 0 ];then
  1402. break
  1403. fi
  1404. #100113 alternate drivers...
  1405. #in quirky have 'drivers-alternate' folder but other builds may not, so create...
  1406. mkdir -p /usr/lib/x/drivers-alternate
  1407. [ -f /usr/lib/xorg/modules/drivers/i810OLD_drv.so ] && mv -f /usr/lib/xorg/modules/drivers/i810OLD_drv.so /usr/lib/x/drivers-alternate/i810_drv.so #puppy 431 has this.
  1408. [ ! -h /usr/lib/xorg/modules/drivers/i810_drv.so ] && [ -f /usr/lib/xorg/modules/drivers/i810_drv.so ] && [ -f /usr/lib/xorg/modules/drivers/intel_drv.so ] && mv -f /usr/lib/xorg/modules/drivers/i810_drv.so /usr/lib/x/drivers-alternate/
  1409. [ -f /usr/lib/xorg/modules/drivers/nv_drv.so ] && [ -f /usr/lib/xorg/modules/drivers/nouveau_drv.so ] && mv -f /usr/lib/xorg/modules/drivers/nouveau_drv.so /usr/lib/x/drivers-alternate/
  1410. EXTRABUTTON=""
  1411. EXTRALABEL=""
  1412. EXTRADRVMSG=""
  1413. case $CARD0DRIVER in
  1414. intel)
  1415. if [ -f /usr/lib/x/drivers-alternate/i810_drv.so ];then
  1416. TRYDRV='i810'
  1417. EXTRABUTTON='--extra-button'
  1418. EXTRALABEL='--extra-label Old_i810_driver'
  1419. EXTRADRVMSG="
  1420. $(gettext "ATTN: There is an older 'i810' Intel video driver that might work better...")"
  1421. fi
  1422. ;;
  1423. i810)
  1424. if [ -f /usr/lib/x/drivers-alternate/intel_drv.so ];then
  1425. TRYDRV='intel'
  1426. EXTRABUTTON='--extra-button'
  1427. EXTRALABEL='--extra-label New_intel_driver'
  1428. EXTRADRVMSG="
  1429. $(gettext "ATTN: There is an newer 'intel' Intel video driver that might work better...")"
  1430. fi
  1431. ;;
  1432. nv)
  1433. if [ -f /usr/lib/x/drivers-alternate/nvidia_drv.so ];then
  1434. TRYDRV='nvidia'
  1435. EXTRABUTTON='--extra-button'
  1436. EXTRALABEL='--extra-label Alt_nvidia_driver'
  1437. EXTRADRVMSG="
  1438. $(gettext "ATTN: There is an alternative 'nvidia' Nvidia video driver that might work better...")"
  1439. else
  1440. if [ -f /usr/lib/x/drivers-alternate/nouveau_drv.so ];then
  1441. TRYDRV='nouveau'
  1442. EXTRABUTTON='--extra-button'
  1443. EXTRALABEL='--extra-label Alt_nouveau_driver'
  1444. EXTRADRVMSG="
  1445. $(gettext "ATTN: There is an alternative 'nouveau' Nvidia video driver that might work better...")"
  1446. fi
  1447. fi
  1448. ;;
  1449. nouveau)
  1450. if [ -f /usr/lib/x/drivers-alternate/nv_drv.so ];then
  1451. TRYDRV='nv'
  1452. EXTRABUTTON='--extra-button'
  1453. EXTRALABEL='--extra-label Alternate_nv_driver'
  1454. EXTRADRVMSG="
  1455. $(gettext "ATTN: There is an alternative 'nv' Nvidia video driver that might work better...")"
  1456. fi
  1457. ;;
  1458. nvidia)
  1459. if [ -f /usr/lib/x/drivers-alternate/nv_drv.so ];then
  1460. TRYDRV='nv'
  1461. EXTRABUTTON='--extra-button'
  1462. EXTRALABEL='--extra-label Alternate_nv_driver'
  1463. EXTRADRVMSG="
  1464. $(gettext "ATTN: There is an alternative 'nv' Nvidia video driver that might work better...")"
  1465. fi
  1466. ;;
  1467. esac
  1468. if [ "$CARD0DRIVER" != "vesa" ];then #v2.11 100109 fix yes/no labels...
  1469. #current version of dialog in quirky has very annoying bug, --yes-label/no-label must be changed to --ok-label/cancel-label...
  1470. if [ "$EXTRABUTTON" = "" ];then #100113
  1471. dialog --no-collapse --title "$(gettext 'Xorg Video Wizard')" --yes-label "$(gettext 'Tweak_xorg.conf')" --no-label "Vesa_driver" --yesno "`eval_gettext \"Before continuing to tweaking xorg.conf, one other thing to consider.
  1472. Xorg has a dozen or so drivers for particular video hardware, which
  1473. optimises performance for the matching hardware, but sometimes a
  1474. driver does not work right or there is no exact driver to match the
  1475. hardware. The workaround for this is that Xorg has a generic driver
  1476. called 'vesa' (note, this is not the Xvesa X server!), that works with
  1477. most video hardware, but some performance may be lost.
  1478. The current driver being used by Xorg is '\\\${CARD0DRIVER}', and your video
  1479. vendor is: '\\\${CARD0VENDOR}'
  1480. board info: '\\\${CARD0BOARD}'
  1481. So, if you have already tried 'tweaking' or you know that the Xorg
  1482. '\\\${CARD0DRIVER}' driver does not work on your hardware, consider the
  1483. generic driver. Click <Vesa_driver> to change Xorg to using the
  1484. generic driver, otherwise press ahead and try tweaking...\"`" 0 0
  1485. else
  1486. dialog --no-collapse ${EXTRABUTTON} --title "$(gettext 'Xorg Video Wizard')" --ok-label "$(gettext 'Tweak_xorg.conf')" --cancel-label "Vesa_driver" ${EXTRALABEL} --yesno "`eval_gettext \"Before continuing to tweaking xorg.conf, one other thing to consider.
  1487. Xorg has a dozen or so drivers for particular video hardware, which
  1488. optimises performance for the matching hardware, but sometimes a
  1489. driver does not work right or there is no exact driver to match the
  1490. hardware. The workaround for this is that Xorg has a generic driver
  1491. called 'vesa' (note, this is not the Xvesa X server!), that works with
  1492. most video hardware, but some performance may be lost.
  1493. The current driver being used by Xorg is '\\\${CARD0DRIVER}', and your video
  1494. vendor is: '\\\${CARD0VENDOR}'
  1495. board info: '\\\${CARD0BOARD}'
  1496. So, if you have already tried 'tweaking' or you know that the Xorg
  1497. '\\\${CARD0DRIVER}' driver does not work on your hardware, consider the
  1498. generic driver. Click 'Vesa_driver' to change Xorg to using the
  1499. generic driver, otherwise press ahead and try tweaking...\\\${EXTRADRVMSG}\"`" 0 0
  1500. fi
  1501. RET2=$?
  1502. SUBSTDRV='vesa'
  1503. #100113 if change driver, really should probe again...
  1504. if [ $RET2 -eq 3 ];then
  1505. SUBSTDRV="$TRYDRV"
  1506. alternate_driver_func $SUBSTDRV #100401
  1507. exec xorgwizard $SUBSTDRV ###RESTART###
  1508. fi
  1509. if [ $RET2 -ne 0 ];then
  1510. APATTERN="s/.*#card0driver/ Driver \"${SUBSTDRV}\" #card0driver/"
  1511. sed -e "$APATTERN" /etc/X11/xorg.conf > /tmp/xorg.conf.tmp2
  1512. sync
  1513. cp -f /tmp/xorg.conf.tmp2 /etc/X11/xorg.conf
  1514. CARD0DRIVER="$SUBSTDRV" #100109
  1515. continue
  1516. fi
  1517. else #using xorg 'vesa' driver...
  1518. DRVSNUM="`ls -1 /usr/lib/xorg/modules/drivers | wc -l`"
  1519. #100330 offer to go back to probing all drivers...
  1520. if [ "$DRVSNUM" = "1" ];then
  1521. DRVSBKUP=`ls -1 /usr/lib/x/drivers-backup | wc -l`
  1522. if [ $DRVSBKUP -gt 1 ];then
  1523. dialog --no-collapse --title "$(gettext 'Xorg Video Wizard')" --yes-label "Vesa" --no-label "$(gettext 'Probe')" --yesno "
  1524. $(gettext 'Earlier you chose to use the Vesa driver and not probe for a hardware
  1525. -specific driver, but if you are not happy with that choice you can
  1526. now restart the Video Wizard and choose a full probe.
  1527. Choose <Vesa> if you are happy with the Vesa driver...
  1528. Choose <Probe> to go back and probe for a hardware-specific driver...')" 0 0
  1529. if [ $? -ne 0 ];then
  1530. cp -a -f --remove-destination /usr/lib/x/drivers-backup/* /usr/lib/xorg/modules/drivers/
  1531. rm -f /usr/lib/x/drivers-backup/*
  1532. exec xorgwizard ###EXIT###
  1533. fi
  1534. fi
  1535. else
  1536. #100113 offer to change to alternate drivers...
  1537. ALTERNATEDRIVERS="`find /usr/lib/x/drivers-alternate -type f -name '*.so' | rev | cut -f 2-9 -d '_' | cut -f 1 -d '/' | rev`"
  1538. if [ "$ALTERNATEDRIVERS" != "" ];then
  1539. xALTERNATEDRIVERS=""
  1540. for ONEALT in $ALTERNATEDRIVERS
  1541. do
  1542. xONEALT="$ONEALT"
  1543. case $ONEALT in
  1544. i810) xONEALT='Intel' ;;
  1545. intel) xONEALT='Intel' ;;
  1546. nv) xONEALT='Nvidia' ;;
  1547. nouveau) xONEALT='Nvidia' ;;
  1548. nvidia) xONEALT='Nvidia' ;;
  1549. esac
  1550. xALTERNATEDRIVERS="$xALTERNATEDRIVERS $ONEALT $xONEALT"
  1551. done
  1552. rm -f /tmp/xorgwizard-altdrv 2>/dev/null
  1553. dialog --title "$(gettext 'Xorg Video Wizard')" --menu "`gettext \"There are some alternative video drivers that Xorg is currently not using. If you think that your video hardware may need one of these, select it, otherwise stay with 'vesa'...
  1554. NOTICE: if you choose a driver other than 'vesa', then the Xorg Wizard will restart so that Xorg can probe the hardware with the chosen driver enabled.
  1555. TECHNICAL NOTE: Unused drivers are kept at /usr/lib/x/drivers-alternate. If you choose one (other than 'vesa'), it will be moved to /usr/lib/xorg/modules/drivers.\"`" 0 0 0 vesa Generic_driver $xALTERNATEDRIVERS 2> /tmp/xorgwizard-altdrv
  1556. if [ -s /tmp/xorgwizard-altdrv ];then
  1557. ALTDRV="`cat /tmp/xorgwizard-altdrv`"
  1558. mv -f /usr/lib/x/drivers-alternate/${ALTDRV}_drv.so /usr/lib/xorg/modules/drivers/
  1559. exec xorgwizard ${ALTDRV} ###RESTART###
  1560. fi
  1561. fi
  1562. fi
  1563. fi
  1564. #tweak...
  1565. dialog --no-collapse --title "$(gettext 'Xorg Video Wizard')" --yes-label "$(gettext 'Tweak_refresh')" --no-label "$(gettext 'Edit_xorg.conf')" --yesno "$(gettext 'If the graphics mode display was distorted, displaced, or a complete
  1566. mess, the simplest option now is to adjust the vertical screen refresh
  1567. frequency up or down slightly.
  1568. However, if you are more experienced with Linux and X, you may prefer
  1569. to open xorg.conf in a text editor and change whatever you wish.
  1570. Press ENTER key for the easy option, tweak refresh frequency...
  1571. Press TAB then ENTER to open xorg.conf in a text editor...')" 0 0
  1572. if [ $? -eq 0 ];then
  1573. if [ "$MONCHOICES" = "" ];then
  1574. #not plug-n-play.
  1575. MSGPNP="$(gettext 'WARNING: Your monitor is not plug-and-play so this Wizard cannot
  1576. determine its max allowable refresh frequency. A very cheap old
  1577. CRT monitor may not handle more than 70Hz, better quality, 85Hz.')"
  1578. else
  1579. MSGPNP="`eval_gettext \"WARNING: the maximum screen refresh frequency is specified
  1580. as \\\${MAXVERT}Hz (times per second). Do not choose any entry
  1581. in the list below that exceeds this.\"`"
  1582. fi
  1583. MSGGEN="$(gettext 'Note1: It is unwise to push a monitor too hard. Just go high enough so
  1584. that there is no flicker. 72Hz-85Hz for CRT, 60Hz for LCD.
  1585. Note2: Display displaced to right is often due to frequency too high.')"
  1586. #just offer standard freqs...
  1587. VERT0=56; MSGV0="$(gettext 'Very noticeable flicker on CRT screens')"
  1588. VERT1=60; MSGV1="$(gettext 'Okay for most LCD screens, flicker on CRT')"
  1589. VERT2=72; MSGV2="$(gettext 'Sensitive eyes may notice flicker on CRT')"
  1590. VERT3=75; MSGV3="$(gettext 'Sensitive eyes may notice flicker on CRT')"
  1591. VERT4=80; MSGV4="$(gettext 'Usually no flicker on CRT')"
  1592. VERT5=85; MSGV5="$(gettext 'No flicker on CRT')"
  1593. dialog --no-cancel --title "$(gettext 'Xorg Video Wizard')" --menu "`eval_gettext \"Xorg is currently set to refresh the screen \\\$VRTEST times per second. Taking this up or down may remove distortion etc., but note that the choices here are only suggested upper limits and Xorg may not use exactly the frequency chosen here.\"`
  1594. $MSGGEN
  1595. $MSGPNP" 0 0 0 \
  1596. "$VERT0" "$MSGV0" \
  1597. "$VERT1" "$MSGV1" \
  1598. "$VERT2" "$MSGV2" \
  1599. "$VERT3" "$MSGV3" \
  1600. "$VERT4" "$MSGV4" \
  1601. "$VERT5" "$MSGV5" \
  1602. 2>/tmp/tagvert.txt
  1603. #FUTURE: use xrandr above, to determine alternative lower frequencies.
  1604. CHOSENVERT="`cat /tmp/tagvert.txt 2>/dev/null`"
  1605. NEEDHORIZ=`gtf $XTEST $YTEST $CHOSENVERT | grep -o 'hsync: .*' | cut -f 2 -d ' ' | cut -f 1 -d '.'`
  1606. let NEEDHORIZ=NEEDHORIZ+1 #compensate for rounding off error.
  1607. APATTERN="s/HORIZSYNC0/${HORIZSYNC}/g"
  1608. if [ $NEEDHORIZ -gt ${MAXHORIZ%.*} ];then
  1609. if [ "$MONCHOICES" = "" ];then
  1610. #monitor not plug and play.
  1611. APATTERN="s/HORIZSYNC0/${MINHORIZ}\\-${NEEDHORIZ}/g"
  1612. fi
  1613. fi
  1614. sed -e "$APATTERN" /tmp/xorg.conf.tmp > /tmp/xorg.conf.tmp2
  1615. BPATTERN="s/VERTREFRESH0/${MINVERT}\\-${CHOSENVERT}/g"
  1616. sync
  1617. sed -e "$BPATTERN" /tmp/xorg.conf.tmp2 > /etc/X11/xorg.conf
  1618. sync
  1619. #100430 nvidia driver needs to set metamodes entry in Screen section...
  1620. mmPATTERN="s%.* #METAMODES% Option \"metamodes\" \"${XTEST}x${YTEST}_${CHOSENVERT} +0+0\" #METAMODES%"
  1621. mm2PATTERN="s%.* #METAMODES% #Option \"metamodes\" \"${XTEST}x${YTEST}_${VRTEST} +0+0\" #METAMODES%"
  1622. if [ "`grep 'Driver' /etc/X11/xorg.conf | grep '"nvidia"'`" != "" ];then
  1623. sed -i -e "$mmPATTERN" /etc/X11/xorg.conf
  1624. else
  1625. sed -i -e "$mm2PATTERN" /etc/X11/xorg.conf
  1626. fi
  1627. rm -f /tmp/xorg.conf.tmp2
  1628. else
  1629. dialog --no-collapse --title "$(gettext 'Xorg Video Wizard')" --msgbox "`eval_gettext \"Before editing xorg.conf, consider this...
  1630. /etx/X11/xorg.conf has these lines in the Monitor section:
  1631. HorizSync \\\$HORIZSYNC
  1632. VertRefresh \\\$VERTREFRESH
  1633. For the resolution that you want to run at, you many want to narrow
  1634. -down the specs in xorg.conf. For example, say you want 1024x768@85,
  1635. but xorg.conf has VertRefresh 50-160. -- maybe narrow that to 50-85.
  1636. Press ENTER key to edit xorg.conf...\"`" 0 0
  1637. #edit xorg.conf...
  1638. mp /etc/X11/xorg.conf
  1639. fi
  1640. done #testloop
  1641. if [ $XAUTO -ne 0 ];then #<FIX> (XAUTO=0 is <OK> button)
  1642. if [ -e /usr/bin/Xvesa ];then
  1643. dialog --title "$(gettext 'Xorg Video Wizard')" --yes-label "$(gettext 'DONE')" --no-label "Xvesa" --yesno "$(gettext "Just press ENTER key if all is fine and you are ready to run
  1644. Puppy with Xorg.
  1645. If you cannot get Xorg to work, press TAB then ENTER to choose
  1646. the \"Xvesa\" button. This will start Puppy with the simple Xvesa
  1647. graphics server that runs on most video hardware.")" 0 0
  1648. if [ ! $? -eq 0 ];then
  1649. ln -sf Xvesa /usr/bin/X
  1650. else
  1651. #prevent Xvesa video wizard from running after X has started...
  1652. rm -f /tmp/videomode
  1653. fi
  1654. fi
  1655. else
  1656. #prevent Xvesa video wizard from running after X has started...
  1657. rm -f /tmp/videomode
  1658. fi
  1659. #move it so people ain't confused seeing it in /root...
  1660. mv -f /root/xorg.conf.new /tmp/xorg.conf.new
  1661. if [ $XAUTO -ne 0 ];then #<FIX> (XAUTO=0 is <OK> button)
  1662. #need to do this here again in case of tweaking made some changes...
  1663. #create a copy of xorg.conf with the profile in the filename...
  1664. cp -af /etc/X11/xorg.conf /etc/X11/xorg.conf.${PROFILECHIP}${PROFILEMONITOR}
  1665. clear
  1666. echo "$(gettext "Xorg Video Wizard completed. Type 'xwin' to start X...")"
  1667. else
  1668. clear
  1669. #user chose the <OK> button, so going directly into X without testing.
  1670. echo -en "\\033[1;31m" #34=blue, 33=yellow, 32=green, 31=red, 35=purple, 36=aquablue, 38=black.
  1671. echo "$(gettext "If X did not work, type 'xorgwizard' to run the Video Wizard again.")"
  1672. echo "$(gettext "After that, type 'xwin' to run X graphics mode.")"
  1673. echo "$(gettext "Note, if X works but needs minor adjustment to the display, run the")"
  1674. echo "$(gettext "Video Wizard from within X (in the Setup menu) -- module 'Xvidtune'")"
  1675. echo -n "$(gettext "may be used, with caution, to finetune the display dimensions.")"
  1676. echo -e "\\033[0;39m"
  1677. fi
  1678. #v3.99 begin
  1679. [ -z /tmp/ddcprobeoem.txt ] && rm /tmp/ddcprobeoem.txt #empty
  1680. #3.99 end
  1681. [ -f /tmp/ddcprobeoem.txt ] && rm /tmp/ddcprobeoem.txt #w478
  1682. echo 'ICONWIPE' > /var/local/pup_event_icon_change_flag #111108 Karl Godt 120213 path changed from /tmp
  1683. ###END###