/[soft]/drakx/trunk/perl-install/standalone/service_harddrake
ViewVC logotype

Diff of /drakx/trunk/perl-install/standalone/service_harddrake

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 959 by anssi, Sun Apr 17 14:34:04 2011 UTC revision 960 by anssi, Wed Apr 20 01:25:05 2011 UTC
# Line 31  use Storable qw(store retrieve); Line 31  use Storable qw(store retrieve);
31    
32  my $force = member('--force', @ARGV);  my $force = member('--force', @ARGV);
33  my $reboot_needed;  my $reboot_needed;
34    my $do_udev_settle;
35    
36  my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0;  my $invert_do_it = $ARGV[0] eq 'X11' ? 1 : 0;
37  my ($hw_sysconfdir, $timeout) = ("/etc/sysconfig/harddrake2", $invert_do_it ? 600 : 25);  my ($hw_sysconfdir, $timeout) = ("/etc/sysconfig/harddrake2", $invert_do_it ? 600 : 25);
# Line 113  sub find_xorg_driver { Line 114  sub find_xorg_driver {
114        || -e "/usr/$lib/xorg/extra-modules/${new_driver}_drv.so";        || -e "/usr/$lib/xorg/extra-modules/${new_driver}_drv.so";
115  }  }
116    
117    sub after_x_driver_switch {
118        # If a wrong driver is loaded, ask for a reboot.
119        my $reboot_needed = -x "/sbin/display_driver_helper" && system("/sbin/display_driver_helper", "--check-loaded") != 0;
120        if (!$reboot_needed) {
121            # Load any new drivers.
122            system("udevadm", "trigger",  "--subsystem-match=pci", "--attr-match=class=0x03*");
123        }
124        $reboot_needed;
125    }
126    
127  sub switch_x_driver {  sub switch_x_driver {
128      my ($old_driver, $new_driver, $reason) = @_;      my ($old_driver, $new_driver, $reason) = @_;
129      if (!find_xorg_driver($new_driver)) {      if (!find_xorg_driver($new_driver)) {
# Line 127  sub switch_x_driver { Line 138  sub switch_x_driver {
138      Xconfig::card::libgl_config_and_more({ Driver => $new_driver });      Xconfig::card::libgl_config_and_more({ Driver => $new_driver });
139      Xconfig::various::setup_kms();      Xconfig::various::setup_kms();
140    
141      # If a wrong driver is loaded, ask for a reboot.      after_x_driver_switch(); # returns 1 if reboot is needed
     my $reboot_needed = -x "/sbin/display_driver_helper" && system("/sbin/display_driver_helper", "--check-loaded") != 0;  
     if (!$reboot_needed) {  
         # Load any new drivers.  
         system("udevadm", "trigger",  "--subsystem-match=pci", "--attr-match=class=0x03*");  
         system("udevadm", "settle", "--timeout=10");  
     }  
     $reboot_needed;  
142  }  }
143    
144  sub should_reconfigure_x_driver {  sub should_reconfigure_x_driver {
# Line 207  foreach my $device (@devices) { Line 211  foreach my $device (@devices) {
211              setVarsInSh("$hw_sysconfdir/xorg", { XORG_DRV => $previous_xorg_config{XORG_DRV} });              setVarsInSh("$hw_sysconfdir/xorg", { XORG_DRV => $previous_xorg_config{XORG_DRV} });
212          } else {          } else {
213              $reboot_needed |= switch_x_driver($current_driver, $card_data->{Driver}, $reason);              $reboot_needed |= switch_x_driver($current_driver, $card_data->{Driver}, $reason);
214                $do_udev_settle = 1;
215              schedule_warn_about_switch($reason) if any { $current_driver =~ $_->{xorg_driver_regexp} } @cards;              schedule_warn_about_switch($reason) if any { $current_driver =~ $_->{xorg_driver_regexp} } @cards;
216              # Update $current_driver with the new one              # Update $current_driver with the new one
217              $current_driver = $card_data->{Driver};              $current_driver = $card_data->{Driver};
# Line 249  foreach my $card (@cards) { Line 254  foreach my $card (@cards) {
254              my $reason = N("The proprietary kernel driver was not found for '%s' X.org driver",              my $reason = N("The proprietary kernel driver was not found for '%s' X.org driver",
255                             $old_driver);                             $old_driver);
256              $reboot_needed |= switch_x_driver($card->{xorg_driver_regexp}, $driver, $reason);              $reboot_needed |= switch_x_driver($card->{xorg_driver_regexp}, $driver, $reason);
257                $do_udev_settle = 1;
258              schedule_warn_about_switch($reason);              schedule_warn_about_switch($reason);
259          }          }
260      }      }
# Line 367  foreach my $hw_class (@harddrake::data:: Line 373  foreach my $hw_class (@harddrake::data::
373      } elsif ($Ident eq "VIDEO") {      } elsif ($Ident eq "VIDEO") {
374          # explicitely NOT read the existing config (eg: new profile with globetrotter)          # explicitely NOT read the existing config (eg: new profile with globetrotter)
375          harddrake::autoconf::xconf($modules_conf, {}, member($cfg{SETUP_FB}, qw(NO no)), $cfg{RESOLUTION_WANTED});          harddrake::autoconf::xconf($modules_conf, {}, member($cfg{SETUP_FB}, qw(NO no)), $cfg{RESOLUTION_WANTED});
376            $reboot_needed |= after_x_driver_switch();
377            $do_udev_settle = 1;
378          next;          next;
379      } elsif ($Ident eq "MOUSE") {      } elsif ($Ident eq "MOUSE") {
380          harddrake::autoconf::mouse_conf($modules_conf);          harddrake::autoconf::mouse_conf($modules_conf);
# Line 433  if ($reboot_needed && ! -e "/tmp/.X11-un Line 441  if ($reboot_needed && ! -e "/tmp/.X11-un
441      }      }
442  }  }
443    
444    system("udevadm", "settle", "--timeout=10") if $do_udev_settle;
445    
446  $in->exit(0) if $in;  $in->exit(0) if $in;

Legend:
Removed from v.959  
changed lines
  Added in v.960

  ViewVC Help
Powered by ViewVC 1.1.28