From 09a4ebff156604b867c1ba4c2072442766d724be Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 22 Feb 2009 17:18:14 -0600
Subject: update Xconfig and templates for xorg 1.5

---
 abs/mv-core/MythVantage-config/PKGBUILD            |   2 +-
 .../templates/xorg/96xx_supported.txt              | 137 +++++++-
 .../templates/xorg/xorg.conf.ati                   |   6 +-
 .../templates/xorg/xorg.conf.intel                 |   6 +-
 .../templates/xorg/xorg.conf.nvidia                |   5 +-
 .../templates/xorg/xorg.conf.vesa                  |   5 +-
 .../templates/xorg/xorg.conf.via                   |   5 +-
 .../templates/xorg/xorg.conf.vmware                |   5 +-
 abs/mv-core/MythVantage-config/xconfig.sh          | 389 ++++++++++++---------
 9 files changed, 380 insertions(+), 180 deletions(-)

diff --git a/abs/mv-core/MythVantage-config/PKGBUILD b/abs/mv-core/MythVantage-config/PKGBUILD
index 28fedfe..f1e6c40 100755
--- a/abs/mv-core/MythVantage-config/PKGBUILD
+++ b/abs/mv-core/MythVantage-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=MythVantage-config
 pkgver=3.2
-pkgrel=143
+pkgrel=144
 pkgdesc="The Gui-installer"
 depends=(bc mysql-python expect curl dnsutils sg3_utils parted)
 arch=('i686')
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/96xx_supported.txt b/abs/mv-core/MythVantage-config/templates/xorg/96xx_supported.txt
index eddcbd4..dd4833a 100644
--- a/abs/mv-core/MythVantage-config/templates/xorg/96xx_supported.txt
+++ b/abs/mv-core/MythVantage-config/templates/xorg/96xx_supported.txt
@@ -1,9 +1,69 @@
     NVIDIA GPU product                    Device PCI ID
-    ----------------------------------    ----------------------------------
+    
+    GeForce 6800 Ultra                    0x0040
+    GeForce 6800                          0x0041
+    GeForce 6800 XE                       0x0043
+    GeForce 6800 XT                       0x0044
+    GeForce 6800 GT                       0x0045
+    GeForce 6800 GT                       0x0046
+    GeForce 6800 GS                       0x0047
+    GeForce 6800 XT                       0x0048
+    Quadro FX 4000                        0x004E
+    GeForce 7800 GTX                      0x0090
+    GeForce 7800 GTX                      0x0091
+    GeForce 7800 GT                       0x0092
+    GeForce 7800 GS                       0x0093
+    GeForce Go 7800                       0x0098
+    GeForce Go 7800 GTX                   0x0099
+    Quadro FX 4500                        0x009D
+    GeForce 6800 GS                       0x00C0
+    GeForce 6800                          0x00C1
+    GeForce 6800 LE                       0x00C2
+    GeForce 6800 XT                       0x00C3
+    GeForce Go 6800                       0x00C8
+    GeForce Go 6800 Ultra                 0x00C9
+    Quadro FX Go1400                      0x00CC
+    Quadro FX 3450/4000 SDI               0x00CD
+    Quadro FX 1400                        0x00CE
+    GeForce 6800/GeForce 6800 Ultra       0x00F0
+    GeForce 6600/GeForce 6600 GT          0x00F1
+    GeForce 6600                          0x00F2
+    GeForce 6200                          0x00F3
+    GeForce 6600 LE                       0x00F4
+    GeForce 7800 GS                       0x00F5
+    GeForce 6800 GS                       0x00F6
+    Quadro FX 3400/4400                   0x00F8
+    GeForce 6800 Ultra                    0x00F9
+    GeForce PCX 5750                      0x00FA
+    GeForce PCX 5900                      0x00FB
+    Quadro FX 330/GeForce PCX 5300        0x00FC
+    Quadro NVS 280 PCI-E/Quadro FX 330    0x00FD
+    Quadro FX 1300                        0x00FE
+    GeForce PCX 4300                      0x00FF
     GeForce2 MX/MX 400                    0x0110
     GeForce2 MX 100/200                   0x0111
     GeForce2 Go                           0x0112
     Quadro2 MXR/EX/Go                     0x0113
+    GeForce 6600 GT                       0x0140
+    GeForce 6600                          0x0141
+    GeForce 6600 LE                       0x0142
+    GeForce 6600 VE                       0x0143
+    GeForce Go 6600                       0x0144
+    GeForce 6610 XL                       0x0145
+    GeForce Go 6600 TE/6200 TE            0x0146
+    GeForce Go 6600                       0x0148
+    GeForce Go 6600 GT                    0x0149
+    Quadro NVS 440                        0x014A
+    Quadro FX 550                         0x014C
+    Quadro FX 540                         0x014E
+    GeForce 6200                          0x014F
+    GeForce 6500                          0x0160
+    GeForce 6200 TurboCache(TM)           0x0161
+    GeForce Go 6200                       0x0164
+    Quadro NVS 285                        0x0165
+    GeForce Go 6400                       0x0166
+    GeForce Go 6200                       0x0167
+    GeForce Go 6400                       0x0168
     GeForce4 MX 460                       0x0170
     GeForce4 MX 440                       0x0171
     GeForce4 MX 420                       0x0172
@@ -14,7 +74,7 @@
     GeForce4 460 Go                       0x0177
     Quadro4 550 XGL                       0x0178
     GeForce4 440 Go 64M                   0x0179
-    Quadro NVS 400                        0x017A
+    Quadro NVS                            0x017A
     Quadro4 500 GoGL                      0x017C
     GeForce4 410 Go 16M                   0x017D
     GeForce4 MX 440 with AGP8X            0x0181
@@ -22,15 +82,31 @@
     GeForce4 MX 420 with AGP8X            0x0183
     GeForce4 MX 4000                      0x0185
     Quadro4 580 XGL                       0x0188
-    Quadro NVS 280 SD                     0x018A
+    Quadro NVS with AGP8X                 0x018A
     Quadro4 380 XGL                       0x018B
     Quadro NVS 50 PCI                     0x018C
     GeForce2 Integrated GPU               0x01A0
+    GeForce 7300 LE                       0x01D1
+    Quadro NVS 110M                       0x01D7
+    GeForce Go 7300                       0x01D7
+    GeForce Go 7400                       0x01D8
+    Quadro NVS 110M                       0x01DA
+    Quadro NVS 120M                       0x01DB
+    Quadro FX 350M                        0x01DC
+    Quadro FX 350                         0x01DE
+    GeForce 7300 GS                       0x01DF
     GeForce4 MX Integrated GPU            0x01F0
     GeForce3                              0x0200
     GeForce3 Ti 200                       0x0201
     GeForce3 Ti 500                       0x0202
     Quadro DCC                            0x0203
+    GeForce 6800                          0x0211
+    GeForce 6800 LE                       0x0212
+    GeForce 6800 GT                       0x0215
+    GeForce 6800 XT                       0x0218
+    GeForce 6150                          0x0240
+    GeForce 6150 LE                       0x0241
+    GeForce 6100                          0x0242
     GeForce4 Ti 4600                      0x0250
     GeForce4 Ti 4400                      0x0251
     GeForce4 Ti 4200                      0x0253
@@ -43,4 +119,57 @@
     GeForce4 4200 Go                      0x0286
     Quadro4 980 XGL                       0x0288
     Quadro4 780 XGL                       0x0289
-    Quadro4 700 GoGL                      0x028C
\ No newline at end of file
+    Quadro4 700 GoGL                      0x028C
+    GeForce 7900 GTX                      0x0290
+    GeForce 7900 GT                       0x0291
+    GeForce Go 7900 GS                    0x0298
+    GeForce Go 7900 GTX                   0x0299
+    Quadro FX 2500M                       0x029A
+    Quadro FX 1500M                       0x029B
+    Quadro FX 5500                        0x029C
+    Quadro FX 3500                        0x029D
+    Quadro FX 1500                        0x029E
+    Quadro FX 4500 X2                     0x029F
+    GeForce 7600 GS                       0x02E1
+    GeForce FX 5800 Ultra                 0x0301
+    GeForce FX 5800                       0x0302
+    Quadro FX 2000                        0x0308
+    Quadro FX 1000                        0x0309
+    GeForce FX 5600 Ultra                 0x0311
+    GeForce FX 5600                       0x0312
+    GeForce FX 5600XT                     0x0314
+    GeForce FX Go5600                     0x031A
+    GeForce FX Go5650                     0x031B
+    Quadro FX Go700                       0x031C
+    GeForce FX 5200                       0x0320
+    GeForce FX 5200 Ultra                 0x0321
+    GeForce FX 5200                       0x0322
+    GeForce FX 5200LE                     0x0323
+    GeForce FX Go5200                     0x0324
+    GeForce FX Go5250                     0x0325
+    GeForce FX 5500                       0x0326
+    GeForce FX 5100                       0x0327
+    GeForce FX Go5200 32M/64M             0x0328
+    Quadro NVS 280 PCI                    0x032A
+    Quadro FX 500/600 PCI                 0x032B
+    GeForce FX Go53xx                     0x032C
+    GeForce FX Go5100                     0x032D
+    GeForce FX 5900 Ultra                 0x0330
+    GeForce FX 5900                       0x0331
+    GeForce FX 5900XT                     0x0332
+    GeForce FX 5950 Ultra                 0x0333
+    GeForce FX 5900ZT                     0x0334
+    Quadro FX 3000                        0x0338
+    Quadro FX 700                         0x033F
+    GeForce FX 5700 Ultra                 0x0341
+    GeForce FX 5700                       0x0342
+    GeForce FX 5700LE                     0x0343
+    GeForce FX 5700VE                     0x0344
+    GeForce FX Go5700                     0x0347
+    GeForce FX Go5700                     0x0348
+    Quadro FX Go1000                      0x034C
+    Quadro FX 1100                        0x034E
+    GeForce 7600 GT                       0x0391
+    GeForce 7600 GS                       0x0392
+    GeForce Go 7600                       0x0398
+    Quadro FX 560                         0x039E
\ No newline at end of file
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.ati b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.ati
index c6d9249..8c75552 100644
--- a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.ati
+++ b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.ati
@@ -1,3 +1,7 @@
+Section "ServerFlags"
+	Option "AutoAddDevices" "False"
+EndSection
+
 Section "ServerLayout"
 	Identifier     "X.org Configured"
 	Screen      0  "aticonfig-Screen[0]" 0 0
@@ -6,7 +10,7 @@ Section "ServerLayout"
 EndSection
 
 Section "Files"
-	RgbPath      "/usr/share/X11/rgb"
+#	RgbPath      "/usr/share/X11/rgb"
 	ModulePath   "/usr/lib/xorg/modules"
 	FontPath     "/usr/share/fonts/misc"
 	FontPath     "/usr/share/fonts/75dpi"
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.intel b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.intel
index a4d258a..c4a67c9 100644
--- a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.intel
+++ b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.intel
@@ -1,3 +1,7 @@
+Section "ServerFlags"
+        Option "AutoAddDevices" "False"
+EndSection
+
 Section "ServerLayout"
 	Identifier     "Xorg Configured"
 	Screen      0  "Screen0" 0 0
@@ -13,7 +17,7 @@ Section "ServerFlags"
 EndSection
 
 Section "Files"
-	RgbPath      "/usr/share/X11/rgb"
+#	RgbPath      "/usr/share/X11/rgb"
 	ModulePath   "/usr/lib/xorg/modules"
 	FontPath     "/usr/share/fonts/misc:unscaled"
 	FontPath     "/usr/share/fonts/misc"
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.nvidia b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.nvidia
index dec0f42..6e005a2 100755
--- a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.nvidia
+++ b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.nvidia
@@ -1,5 +1,8 @@
 # nvidia-xconfig: X configuration file generated by nvidia-xconfig
 # nvidia-xconfig:  version 1.0  (buildmeister@builder3)  Tue Aug  1 21:11:12 PDT 2006
+Section "ServerFlags"
+        Option "AutoAddDevices" "False"
+EndSection
 
 Section "ServerLayout"
     Identifier     "Layout0"
@@ -9,7 +12,7 @@ Section "ServerLayout"
 EndSection
 
 Section "Files"
-    RgbPath         "/usr/X11R6/lib/X11/rgb"
+#    RgbPath         "/usr/X11R6/lib/X11/rgb"
 EndSection
 
 Section "Module"
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vesa b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vesa
index c569819..90b426b 100755
--- a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vesa
+++ b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vesa
@@ -1,5 +1,8 @@
 # nvidia-xconfig: X configuration file generated by nvidia-xconfig
 # nvidia-xconfig:  version 1.0  (buildmeister@builder3)  Tue Aug  1 21:11:12 PDT 2006
+Section "ServerFlags"
+        Option "AutoAddDevices" "False"
+EndSection
 
 Section "ServerLayout"
     Identifier     "Layout0"
@@ -9,7 +12,7 @@ Section "ServerLayout"
 EndSection
 
 Section "Files"
-    RgbPath         "/usr/X11R6/lib/X11/rgb"
+#    RgbPath         "/usr/X11R6/lib/X11/rgb"
 EndSection
 
 Section "Module"
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.via b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.via
index 6dd7821..96cae54 100644
--- a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.via
+++ b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.via
@@ -1,5 +1,8 @@
 # nvidia-xconfig: X configuration file generated by nvidia-xconfig
 # nvidia-xconfig:  version 1.0  (buildmeister@builder3)  Tue Aug  1 21:11:12 PDT 2006
+Section "ServerFlags"
+        Option "AutoAddDevices" "False"
+EndSection
 
 Section "ServerLayout"
     Identifier     "Layout0"
@@ -9,7 +12,7 @@ Section "ServerLayout"
 EndSection
 
 Section "Files"
-    RgbPath         "/usr/X11R6/lib/X11/rgb"
+#    RgbPath         "/usr/X11R6/lib/X11/rgb"
 EndSection
 
 Section "Module"
diff --git a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vmware b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vmware
index 843f2f4..c4db4bf 100755
--- a/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vmware
+++ b/abs/mv-core/MythVantage-config/templates/xorg/xorg.conf.vmware
@@ -1,5 +1,8 @@
 # nvidia-xconfig: X configuration file generated by nvidia-xconfig
 # nvidia-xconfig:  version 1.0  (buildmeister@builder3)  Tue Aug  1 21:11:12 PDT 2006
+Section "ServerFlags"
+        Option "AutoAddDevices" "False"
+EndSection
 
 Section "ServerLayout"
     Identifier     "Layout0"
@@ -9,7 +12,7 @@ Section "ServerLayout"
 EndSection
 
 Section "Files"
-    RgbPath         "/usr/X11R6/lib/X11/rgb"
+#    RgbPath         "/usr/X11R6/lib/X11/rgb"
 EndSection
 
 Section "Module"
diff --git a/abs/mv-core/MythVantage-config/xconfig.sh b/abs/mv-core/MythVantage-config/xconfig.sh
index a191e1f..eaa84b6 100755
--- a/abs/mv-core/MythVantage-config/xconfig.sh
+++ b/abs/mv-core/MythVantage-config/xconfig.sh
@@ -1,4 +1,6 @@
 #!/bin/bash
+#NVPKGS="ati-dri xf86-video-ati xf86-video-radeonhd intel-dri xf86-video-intel unichrome-dri xf86-video-unichrome xf86-video-mga xf86-video-savage xf86-video-trident"
+NVPKGS="ati-dri xf86-video-ati xf86-video-radeonhd intel-dri xf86-video-intel xf86-video-mga xf86-video-savage xf86-video-trident"
 BASE=""
 . /etc/profile
 NVIDIA_96XX="$TEMPLATES/xorg/96xx_supported.txt"
@@ -6,226 +8,276 @@ NVIDIA_96XX="$TEMPLATES/xorg/96xx_supported.txt"
 
 function Xvalues {
     CMDLINE=$(cat /proc/cmdline)
-    echo $CMDLINE |grep -q forceXvesa
+    echo "$CMDLINE" | grep -q forceXvesa
     if [ $? = 0 ]
     then
         VGACARDTYPE=vesa
     else
-        VGACARDTYPE=`lspci|grep -i vga|sort -r|head -n 1| cut -d: -f3|cut -d" " -f 2`
-        CARDID=`lspci -n |grep 10de | cut -d" " -f3 |cut -d: -f2    `
-        VENDORID=`lspci -n |grep 10de | cut -d" " -f3 |cut -d: -f1`
+        VGACARDTYPE=`lspci | grep -i vga | sort -r | head -n 1 | cut -d: -f3 | cut -d" " -f2`
+        VGAPCIID=`lspci | grep -i vga | sort -r | head -n 1 | cut -d" " -f1`
+        CARDID=`lspci -n | grep "$VGAPCIID" | grep 10de | cut -d" " -f3 | cut -d: -f2`
+        VENDORID=`lspci -n | grep "$VGAPCIID" | grep 10de | cut -d" " -f3 | cut -d: -f1`
     fi
-    echo $VGACARDTYPE
-    currentmode=`cat $BASE/etc/X11/xorg.conf |grep Modes|awk -Fs ' { print $2 } '`
+    echo "$VGACARDTYPE"
+    currentmode=`cat "$BASE/etc/X11/xorg.conf" | grep Modes | awk -Fs '{ print $2 }'`
 }
 
 function presetupX {
-if [ x$XUseAdvanced =  x1 ]
-then
-    if  [ x$XIgnoreConfig  = x1 ]
+    if [ "$XUseAdvanced" = 1 ]
     then
-        echo "Using User supplied X"
-        if [ -f  $BASE/data/home/mythtv/templates/xorg.user ]
+        if  [ "$XIgnoreConfig" = 1 ]
         then
-            cp -f  $BASE/data/home/mythtv/templates/xorg.user  $XORG_CONF
+            echo "Using User supplied X"
+            if [ -f "$BASE/data/home/mythtv/templates/xorg.user" ]
+            then
+                cp -f "$BASE/data/home/mythtv/templates/xorg.user" "$XORG_CONF"
+            else
+                echo "Didn't find the file"
+                echo "Copy your config file to $BASE/data/home/mythtv/templates/xorg.use" >> "$XORG_CONF"
+            fi
         else
-            echo "Didn't find the file"
-            echo "Copy your config file to $BASE/data/home/mythtv/templates/xorg.use  " >>  $XORG_CONF
+            setupAdvancedX
         fi
     else
-    setupAdvancedX
+        if [ -f /etc/sysconfig/IGNORE_X ]
+        then
+            echo "Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X"
+        else
+            setupX
+        fi
     fi
-else
-    if [ -f /etc/sysconfig/IGNORE_X ]
-    then
-        echo "Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X"
-    else
-        setupX
-      fi
-fi
-
 }
 
 function setupAdvancedX {
-echo "#doing the advanced" > /tmp/options
-        Xcatagory=` echo $Xresadvanced |cut -d_ -f1`
-        Xres=` echo $Xresadvanced |cut -d_ -f2`
-        echo $Xcatagory
-        if [ x$Xcatagory = "xNvidia" ]
+    echo "#doing the advanced" > /tmp/options
+    Xcategory=`echo "$Xresadvanced" | cut -d_ -f1`
+    Xres=`echo "$Xresadvanced" | cut -d_ -f2`
+    echo "$Xcategory"
+    if [ "$Xcategory" = "Nvidia" ]
+    then
+        Xres=""
+        if [ "$XnVidia1080p" = "1" ]
         then
-            Xres=""
-            if [  $XnVidia1080p = "1" ]
-            then
-                Xres="${Xres} \"1920x1080_60\""
-            fi
-            if [  $XnVidia1080i = "1" ]
-            then
-                Xres="${Xres}  \"1920x1080_60i\""
-            fi
-            if [  $XnVidia720p = "1" ]
+            Xres="${Xres} \"1920x1080_60\""
+        fi
+        if [ "$XnVidia1080i" = "1" ]
+        then
+            Xres="${Xres}  \"1920x1080_60i\""
+        fi
+        if [ "$XnVidia720p" = "1" ]
+        then
+            Xres="${Xres}  \"1280x720_60\""
+        fi
+        if [ "$XnVidia480p" = "1" ]
+        then
+            Xres="${Xres}  \"720x480_60\""
+        fi
+            ML="\t Modes ${Xres}"
+    else
+
+    ML="\t Modes \"${Xres}\""
+    fi
+#    echo $ML
+    case $Xcardtype in
+        NVIDIA|nVidia)
+            case $Xconnection in
+                DVI)    ConnectedMonitor=DFP ;;
+                vga)    ConnectedMonitor=CRT;;
+                Auto)   ConnectedMonitor=Auto;;
+                TV)     ConnectedMonitor=TV
+                        echo "Option \"TVStandard\" \"$XTVstandard\""  >>/tmp/options
+                        echo "Option \"TVOutFormat\" \"$XTVconnection\"" >> /tmp/options
+                    ;;
+            esac
+            if [ "$ConnectedMonitor" = Auto ]
             then
-                Xres="${Xres}  \"1280x720_60\""
+                echo "auto connection"
+            else
+                echo "Option \"ConnectedMonitor\" \"$ConnectedMonitor\"" >> /tmp/options
+                echo "Option \"FlatPanelProperties\" \"Scaling = centered, Dithering = enabled\"" >> /tmp/options
+                echo "Option \"DigitalVibrance\" \"0\"" >> /tmp/options
             fi
-            if [  $XnVidia480p = "1" ]
+
+            if  [ "$XignoreEDID" = 1 ]
             then
-                Xres="${Xres}  \"720x480_60\""
+                EDIDvalue=true
+                EDIDFREQ=false
+                DS="    DisplaySize $XDisplaysize"
+                HS="    HorizSync   $XHsync"
+                VR="    VertRefresh $XVrefresh"
+            else
+                EDIDvalue=false
+                EDIDFREQ=true
+                DS="# Display size edid used "
+                HS="# Hsync edid used "
+                VR="# Vertrefresh edid used "
             fi
-                ML="\t Modes ${Xres}"
-        else
+            echo "Option  \"UseEdidFreqs\" \"$EDIDFREQ\"" >> /tmp/options
+            echo "Option  \"IgnoreEDID\" \"$EDIDvalue\"" >> /tmp/options
 
-        ML="\t Modes \"${Xres}\""
-        fi
-#        echo $ML
-    case $Xcardtype in
-        NVIDIA|nVidia )
-                        case $Xconnection in
-                                DVI)    ConnectedMonitor=DFP ;;
-                                vga)    ConnectedMonitor=CRT;;
-                                Auto)   ConnectedMonitor=Auto;;
-                                TV)    ConnectedMonitor=TV
-                                        echo "Option \"TVStandard\" \"$XTVstandard\""  >>/tmp/options
-                                        echo "Option \"TVOutFormat\" \"$XTVconnection\"" >> /tmp/options
-                                        ;;
-                            esac
-                            if [ $ConnectedMonitor = Auto ]
-                            then
-                            echo "auto connection"
-                            else
-                            echo    "Option \"ConnectedMonitor\" \"$ConnectedMonitor\"" >> /tmp/options
-                            echo    "Option \"FlatPanelProperties\" \"Scaling = centered, Dithering = enabled\"" >> /tmp/options
-                            echo    "Option \"DigitalVibrance\" \"0\"" >> /tmp/options
-                            fi
-
-                            if  [ x$XignoreEDID = x1 ]
-                                    then
-                                        EDIDvalue=true
-                                        EDIDFREQ=false
-                                        DS="     DisplaySize $XDisplaysize"
-                                        HS="    HorizSync  $XHsync"
-                                        VR="    VertRefresh $XVrefresh"
-                                    else
-                                        EDIDvalue=false
-                                        EDIDFREQ=true
-                                        DS="# Display size edid used "
-                                        HS="#Hsync edid used "
-                                        VR="#Vertrefresh edid used "
-
-                            fi
-                            echo   "Option  \"UseEdidFreqs\" \"$EDIDFREQ\"" >> /tmp/options
-                            echo   "Option  \"IgnoreEDID\" \"$EDIDvalue\"" >> /tmp/options
-
-
-                sed -e "s/^.*Modes.*$/${ML}/" \
-                    -e "/INSERT MODELINE/r  $TEMPLATES/xorg/modeline.$Xcatagory" \
-                    -e "s/^.*DisplaySize.*$/  $DS/" \
-                    -e "s/^#.*HorizSync.*$/ $HS/g" \
-                    -e "s/^#.*VertRefresh.*$/ $VR/g" \
-                    -e "/INSERT HERE/r /tmp/options"  $TEMPLATES/xorg/xorg.conf.nvidia  > $XORG_CONF
 
+            sed -e "s/^.*Modes.*$/${ML}/" \
+                -e "/INSERT MODELINE/r  $TEMPLATES/xorg/modeline.$Xcategory" \
+                -e "s/^.*DisplaySize.*$/ $DS/" \
+                -e "s/^#.*HorizSync.*$/ $HS/g" \
+                -e "s/^#.*VertRefresh.*$/ $VR/g" \
+                -e "/INSERT HERE/r /tmp/options" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF"
             ;;
+
         ati|ATI)
-                case $Xconnection in
-                        DVI)    ConnectedMonitor="tmds1,nocrt1,notv";;
-                        VGA)    ConnectedMonitor="crt1,notmds1,notv" ;;
-                        TV)    ConnectedMonitor="tv,nocrt1,notmds1"
-                                echo "Option \"TVStandard\" \"$XTVstandard\""  >>/tmp/options
-                                echo "Option \"TVFormat\" \"$XTVconnection\"" >> /tmp/options
-                                ;;
-                        esac
-                if  [ x$XignoreEDID = x1 ]
-                        then
-                            DS="     DisplaySize $XDisplaysize"
-                            HS="    HorizSync  $XHsync"
-                            VR="    VertRefresh $XVrefresh"
-                        else
-                            DS="# Display size edid used "
-                            HS="#Hsync edid used "
-                            VR="#Vertrefresh edid used "
-                    fi
-                
-                echo "Option \"ForceMonitors\" \"$ConnectedMonitor\"" >> /tmp/options
-                
-                sed -e "s/^.*Modes.*$/\t $ML/" \
-                -e "/INSERT MODELINE/r  $TEMPLATES/xorg/modeline.$Xcatagory" \
-                -e "s/^.*DisplaySize.*$/  $DS/" \
+            case $Xconnection in
+                DVI)    ConnectedMonitor="tmds1,nocrt1,notv";;
+                VGA)    ConnectedMonitor="crt1,notmds1,notv" ;;
+                TV)     ConnectedMonitor="tv,nocrt1,notmds1"
+                        echo "Option \"TVStandard\" \"$XTVstandard\""  >>/tmp/options
+                        echo "Option \"TVFormat\" \"$XTVconnection\"" >> /tmp/options
+                    ;;
+            esac
+            if  [ "$XignoreEDID" = 1 ]
+            then
+                DS="    DisplaySize $XDisplaysize"
+                HS="    HorizSync   $XHsync"
+                VR="    VertRefresh $XVrefresh"
+            else
+                DS="# Display size edid used "
+                HS="# Hsync edid used "
+                VR="# Vertrefresh edid used "
+            fi
+
+            echo "Option \"ForceMonitors\" \"$ConnectedMonitor\"" >> /tmp/options
+
+            sed -e "s/^.*Modes.*$/\t $ML/" \
+                -e "/INSERT MODELINE/r  $TEMPLATES/xorg/modeline.$Xcategory" \
+                -e "s/^.*DisplaySize.*$/ $DS/" \
                 -e "s/^#.*HorizSync.*$/ $HS/g" \
                 -e "s/^#.*VertRefresh.*$/ $VR/g" \
-                -e "/INSERT HERE/r /tmp/options"  $TEMPLATES/xorg/xorg.conf.ati  > $XORG_CONF
-                ;;
+                -e "/INSERT HERE/r /tmp/options" "$TEMPLATES/xorg/xorg.conf.ati"  > "$XORG_CONF"
+            ;;
 
-        via|VIA|Via) echo "no via here"   ;;
+        via|VIA|Via|S3)
+            # Need to add appropriate Modules, Device and DRI sections
+            # See the http://www.mythtv.org/wiki/XvMC wiki page
+            echo "no via here"
+            ;;
 
-        *)    echo "unknown card type"        ;;
+        *)
+            echo "unknown card type"
+            ;;
     esac
 }
 
 
-
 function setupX {
     Xvalues
-    #echo "$currentmode  ____    ${Xres}"
-    #if [ !  x${currentmode} = x\"${Xres}\" ]
-    if [   x = x ]
+    #echo "$currentmode  ____   ${Xres}"
+    #if [ "${currentmode}" != \"${Xres}\" ]
+    if [ x = x ]
     then
         case $VGACARDTYPE in
-            nVidia )
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" $TEMPLATES/xorg/xorg.conf.nvidia > $XORG_CONF
-                    if [ !  x$TESTMODE = "xtest" ]
+            nVidia)
+                sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF"
+                if [ "$TESTMODE" != "test" ]
+                then
+                    #nvidia check right here
+                    grep -qi "$CARDID" "$NVIDIA_96XX"
+                    if [ $? = 0 ]
                     then
-			    #nvidia check right here
-                            grep -qi $CARDID $NVIDIA_96XX
-                            if [ $? = 0 ]
-                            then 
-                                #install 96xx drivers
-                                echo "installing nvidia 96xx drivers" 
-                                pacman --noconfirm  -R libgl-dri > /dev/null 2>&1
-                                pacman --noconfirm  -S nvidia-96xx nvidia-96xx-utils  > /dev/null 2>&1
-                            else
-                                #install latest drivers
-                                pacman --noconfirm  -R libgl-dri > /dev/null 2>&1
-                                pacman --noconfirm  -S nvidia nvidia-utils > /dev/null 2>&1
-                            fi
+                        #install 96xx drivers
+                        echo "installing nvidia 96xx drivers"
+                        pacman --noconfirm  -R $NVPKGS > /dev/null 2>&1
+                        pacman --noconfirm  -S nvidia-96xx nvidia-96xx-utils  > /dev/null 2>&1
+                    else
+                        #install latest drivers
+                        echo "installing current nvidia drivers"
+                        pacman --noconfirm  -R $NVPKGS > /dev/null 2>&1
+                        pacman --noconfirm  -S nvidia nvidia-utils > /dev/null 2>&1
                     fi
-                                ;;
-            VMware )
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" $TEMPLATES/xorg/xorg.conf.vmware > $XORG_CONF
-                    ;;
+                fi
+	        echo "/usr/lib/libXvMCNVIDIA_dynamic.so.1" > "$XVMC_CONFIG"
+                ;;
+
+      #      VMware)
+      #              sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vmware" > "$XORG_CONF"
+      #              ;;
 
-            VIA )
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" $TEMPLATES/xorg/xorg.conf.via > $XORG_CONF
-                    if [ ! x$TESTMODE = "xtest" ]
+            VIA|S3)
+                # There are actually multiple options here
+                # xf86-video-openchrome
+                # xf86-video-unichrome
+                # There is also a seperate driver for the Unichrome Pro
+                sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.via" > "$XORG_CONF"
+                if [ "$TESTMODE" != "test" ]
+                then
+                    if [ "$OPENCHROME" = "1" ]
                     then
                         pacman --noconfirm  -R nvidia nvidia-utils > /dev/null 2>&1
-                        pacman --noconfirm  -S libgl-dri > /dev/null 2>&1
+                        pacman --noconfirm  -S libgl unichrome-dri xf86-video-openchrome > /dev/null 2>&1
+                    else
+                        pacman --noconfirm  -R nvidia nvidia-utils > /dev/null 2>&1
+                        pacman --noconfirm  -S libgl unichrome-dri xf86-video-unichrome > /dev/null 2>&1
                     fi
-
-                    ;;
-            Intel)
-                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" $TEMPLATES/xorg/xorg.conf.intel > $XORG_CONF
-                    if [ !  x$TESTMODE = "xtest" ]
+                fi
+                # I'm making educated guesses here...
+                if lspci | grep "VGA" | grep -qi "Unichrome Pro"
+                then
+                    if [ -f "/usr/lib/libchromeXvMCPro.so.1" ]
                     then
-                            pacman --noconfirm -R nvidia-utils > /dev/null 2>&1
-                            pacman --noconfirm -S libgl-dri > /dev/null 2>&1
+	                echo "/usr/lib/libchromeXvMCPro.so.1" > "$XVMC_CONFIG"
+                    else
+	                echo "/usr/lib/libviaXvMCPro.so.1" > "$XVMC_CONFIG"
                     fi
-                                ;;
-
-        vesa|InnoTek)  sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" $TEMPLATES/xorg/xorg.conf.vesa > $XORG_CONF
-        ;;
-    *)      XCONF=/root/xorg.conf.new
-            X -configure
-            grep -v Modes  $XCONF | sed -e '/Depth.*16/a Modes "800x600"' -e '/Depth.*24/a Modes "800x600"' -e 's/dev\/mouse/dev\/psaux/g'> $XORG_CONF
-            rm -f $XCONF 2>&1 > /dev/null 
-        ;;
+                else
+                    if [ -f "/usr/lib/libchromeXvMC.so.1" ]
+                    then
+	                echo "/usr/lib/libchromeXvMC.so.1" > "$XVMC_CONFIG"
+                    else
+                        echo "/usr/lib/libviaXvMC.so.1" > "$XVMC_CONFIG"
+                    fi
+                fi
+                ;;
+
+            Intel)
+                sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.intel" > "$XORG_CONF"
+                if [ "$TESTMODE" != "test" ]
+                then
+                    pacman --noconfirm -R nvidia-utils > /dev/null 2>&1
+                    pacman --noconfirm -S libgl > /dev/null 2>&1
+                fi
+	        echo "/usr/lib/libIntelXvMC.so.1" > "$XVMC_CONFIG"
+                ;;
+
+            vesa|InnoTek)
+                sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF"
+                ;;
+
+            *)
+                XCONF=/root/xorg.conf.new
+                XCONFB=/etc/X11/xorg.conf.install
+                X -configure
+                if [ -f "$XCONF" ]
+                then
+                    echo "Using $XCONF"
+                    grep -v Modes "$XCONF" | sed -e "/Depth.*16/a Modes \"${Xres}\" " -e "/Depth.*24/a Modes \"${Xres}\""     -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF"
+                elif [ -f "$XCONFB" ]
+                then
+                    echo "Using $XCONFB"
+                    sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$XCONFB" > "$XORG_CONF"
+                else
+                    echo "Xorg configuration failed"
+                fi
+                rm -f "$XCONF" 2>&1 > /dev/null
+                ;;
         esac
     fi
 
 }
 
 #MAIN
-TESTMODE=$1
-if [ x$TESTMODE = "xtest" ]
+TESTMODE="$1"
+if [ "$TESTMODE" = "test" ]
 then
     XORG_CONF="/tmp/xorg.conf.test"
+    XVMC_CONFIG="/tmp/XvMCConfig.test"
     XUseAdvanced="1"
     XIgnoreConfig="${2}"
     Xcardtype="${3}"
@@ -238,14 +290,13 @@ then
     XTVconnection="${10}"
     XDisplaysize="${11}"
 else
-    if [ -f   /etc/systemconfig ]
+    if [ -f /etc/systemconfig ]
     then
         . /etc/systemconfig
     else
         Xres="800x600"
     fi
     XORG_CONF="/etc/X11/xorg.conf"
+    XVMC_CONFIG="/etc/X11/XvMCConfig"
 fi
 presetupX
-
-
-- 
cgit v0.12