home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / boot / i386 / root / usr / share / sax / profile / NVidia_DualHead_DriverOptions.pl < prev    next >
Perl Script  |  2006-11-29  |  4KB  |  146 lines

  1. #!/usr/bin/perl
  2.  
  3. use lib '/usr/share/sax/profile';
  4. use lib '.';
  5.  
  6. use strict;
  7. use Profile;
  8.  
  9. #====================================
  10. # Profile name...
  11. #------------------------------------
  12. my $name = "NVidia_DualHead_DriverOptions";
  13.  
  14. #====================================
  15. # DualHead check
  16. #------------------------------------
  17. if ($ARGV[0] eq "check") {
  18.     ProfileNVDualCheck();
  19.     exit 0;
  20. }
  21.  
  22. #====================================
  23. # Init profile script
  24. #------------------------------------
  25. my $profile = ProfileInitScript();
  26.  
  27. #====================================
  28. # Do the profile adaptions...
  29. #------------------------------------
  30. if (ProfileIsXOrgVendor ("nvidia")) {
  31.     open (FD,">",$profile) ||
  32.         die "$name: Can't open $profile: $!";
  33.     print FD "Desktop -> [X] -> CalcModelines = yes\n";
  34.     print FD "Monitor -> [X] -> CalcAlgorithm = CheckDesktopGeometry\n";
  35.     close FD;
  36. } else {
  37.     #====================================
  38.     # Do the profile adaptions...
  39.     #------------------------------------
  40.     my $mlayout = ProfileNVidiaSetupMonitorLayout ($profile);
  41.     my ($CA,$CB) = split (/,/,$mlayout);
  42.     if (ProfileIsNoteBookHardware()) {
  43.         open (FD,">",$profile) ||
  44.             die "$name: Can't open $profile: $!";
  45.         my $id = 11;
  46.         my $dt = '"Device->[X]->Raw->".$id++."->Option"';
  47.         my $dx = eval $dt;
  48.         print FD "\$MS=Screen->[X]->Depth->16->Modes\n";
  49.         print FD "SaXMeta->[X]->SAX_NO_CDB_CHECK=1\n";
  50.         print FD "Desktop->[X]->CalcModelines=no\n";
  51.         print FD "Monitor->[X]->CalcAlgorithm=XServerPool\n";
  52.         print FD "Device->[X]->Driver=nvidia\n";
  53.         print FD "Device->[X]->Screen=0\n";
  54.         print FD "Device->[X]->Option = TwinView,SaXDualHead\n";
  55.         print FD "$dx=\"TwinViewOrientation\" \"Clone\"\n";
  56.         $dx = eval $dt;
  57.         print FD "$dx=\"ConnectedMonitor\" \"$mlayout\"\n";
  58.         $dx = eval $dt;
  59.         print FD "$dx=\"SaXDualOrientation\" \"RightOf\"\n";
  60.         $dx = eval $dt;
  61.         print FD "$dx=\"SaXDualMode\" \"Clone\"\n";
  62.         $dx = eval $dt;
  63.         print FD "$dx=\"SecondMonitorHorizSync\" \"31-48\"\n";
  64.         $dx = eval $dt;
  65.         print FD "$dx=\"SecondMonitorVertRefresh\" \"50-60\"\n";
  66.         $dx = eval $dt;
  67.         my $MMValue = "$CA:\${MS[0]},$CB:1024x768;$CA:1024x768,$CB:1024x768";
  68.         print FD "$dx=\"MetaModes\" \"$MMValue\"\n";
  69.         $dx = eval $dt;
  70.         print FD "$dx=\"SaXDualHSync\" \"31-48\"\n";
  71.         $dx = eval $dt;
  72.         print FD "$dx=\"SaXDualVSync\" \"50-60\"\n";
  73.         $dx = eval $dt;
  74.         print FD "$dx=\"SaXDualResolution\" \"1024x768\"\n";
  75.         $dx = eval $dt;
  76.         print FD "$dx=\"SaXDualMonitorVendor\" \"__VESA__\"\n";
  77.         $dx = eval $dt;
  78.         print FD "$dx=\"SaXDualMonitorModel\" \"1024X768\@60HZ\"\n";
  79.         close FD;
  80.     } else {
  81.         #====================================
  82.         # check secondary DDC data
  83.         #------------------------------------
  84.         open (FD,">>",$profile) ||
  85.             die "$name: Can't open $profile: $!";
  86.         my %data   = ProfileGetDDC2Data();
  87.         my $id = 11;
  88.         my $dt = '"Device->[X]->Raw->".$id++."->Option"';
  89.         my $dx = eval $dt;
  90.         print FD "$dx=\"TwinViewOrientation\" \"Clone\"\n";
  91.         $dx = eval $dt;
  92.         print FD "$dx=\"ConnectedMonitor\" \"$mlayout\"\n";
  93.         $dx = eval $dt;
  94.         print FD "$dx=\"SaXDualOrientation\" \"RightOf\"\n";
  95.         $dx = eval $dt;
  96.         print FD "$dx=\"SaXDualMode\" \"Clone\"\n";
  97.         $dx = eval $dt;
  98.         foreach my $key (keys %data) {
  99.             my $val = $data{$key};
  100.             SWITCH: for ($key) {
  101.                 /^Model/      && do {
  102.                     $id = 22;
  103.                     $dx = eval $dt;
  104.                     print FD "$dx=\"SaXDualMonitorModel\" \"$val\"\n";
  105.                     last SWITCH;
  106.                 };
  107.                 /^Vendor/     && do {
  108.                     $id = 21;
  109.                     $dx = eval $dt;
  110.                     print FD "$dx=\"SaXDualMonitorVendor\" \"$val\"\n";
  111.                     last SWITCH;
  112.                 };
  113.                 /^Resolution/ && do {
  114.                     $id = 17;
  115.                     $dx = eval $dt;
  116.                     my $key = "MetaModes";
  117.                     print FD "$dx=\"$key\" \"$CA:\${Modes[0]},$CB:$val\"\n";
  118.                     $id = 20;
  119.                     $dx = eval $dt;
  120.                     print FD "$dx=\"SaXDualResolution\" \"$val\"\n";
  121.                     last SWITCH;
  122.                 };
  123.                 /^Hsync/      && do {
  124.                     $id = 15;
  125.                     $dx = eval $dt;
  126.                     print FD "$dx=\"SecondMonitorHorizSync\" \"$val\"\n";
  127.                     $id = 18;
  128.                     $dx = eval $dt;
  129.                     print FD "$dx=\"SaXDualHSync\" \"$val\"\n";
  130.                     last SWITCH;
  131.                 };
  132.                 /^Vsync/      && do {
  133.                     $id = 16;
  134.                     $dx = eval $dt;
  135.                     print FD "$dx=\"SecondMonitorVertRefresh\" \"$val\"\n";
  136.                     $id = 19;
  137.                     $dx = eval $dt;
  138.                     print FD "$dx=\"SaXDualVSync\" \"$val\"\n";
  139.                     last SWITCH;
  140.                 };
  141.             }
  142.         }
  143.         close FD;
  144.     }
  145. }
  146.