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 / Radeon_DualHead_DriverOptions.pl < prev    next >
Perl Script  |  2006-11-29  |  4KB  |  141 lines

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