summaryrefslogtreecommitdiffstats
path: root/perl-install/Xconfig
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/Xconfig')
-rw-r--r--perl-install/Xconfig/test.pm5
-rw-r--r--perl-install/Xconfig/xfree4.pm2
2 files changed, 5 insertions, 2 deletions
diff --git a/perl-install/Xconfig/test.pm b/perl-install/Xconfig/test.pm
index d5b2f1334..38d9f9377 100644
--- a/perl-install/Xconfig/test.pm
+++ b/perl-install/Xconfig/test.pm
@@ -67,12 +67,14 @@ sub test {
my $b = before_leaving { unlink $f_err };
if (!xtest(":9")) {
- local $_;
local *F; open F, $f_err;
+
+ local $_;
i: while (<F>) {
if (Xconfig::card::using_xf4($card)) {
if (/^\(EE\)/ && !/Disabling/ || /^Fatal\b/) {
my @msg = !/error/ && $_ ;
+ local $_;
while (<F>) {
/reporting a problem/ and last;
push @msg, $_;
@@ -83,6 +85,7 @@ sub test {
} else {
if (/\b(error|not supported)\b/i) {
my @msg = !/error/ && $_ ;
+ local $_;
while (<F>) {
/not fatal/ and last i;
/^$/ and last;
diff --git a/perl-install/Xconfig/xfree4.pm b/perl-install/Xconfig/xfree4.pm
index 542226000..88cad5b06 100644
--- a/perl-install/Xconfig/xfree4.pm
+++ b/perl-install/Xconfig/xfree4.pm
@@ -49,7 +49,7 @@ sub new_mouse_sections {
} (1 .. $nb_new);
push @$layout, { val => qq("Mouse1" "CorePointer") };
- push @$layout, { val => qq("Mouse$_" "SendCoreEvents") } foreach (2 .. $nb_new);
+ push @$layout, { val => qq("Mouse$_" "SendCoreEvents") } foreach 2 .. $nb_new;
@l;
}
#n155'>155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
#!/usr/bin/perl
# -*- coding: utf-8 -*-

use utf8;
use strict;
use diagnostics;
use lib qw(/usr/lib/libDrakX);
use standalone;
use common;

# i18n: IMPORTANT: to get correct namespace (drakconf instead of only libDrakX)
BEGIN { unshift @::textdomains, 'drakconf' }

use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version
use ugtk2 qw(:create :helpers :wrappers);
use interactive;
use modules::parameters;
use harddrake::data;  #- needs to stay after use-ugtk2 as long as this module defines globals containing some N()
use fsedit;
use pkgs;
use POSIX qw(:sys_wait_h);


# { field => [ short_translation, full_description] }
my %fields = 
    (
     generic =>
     {
      "alternative_drivers" => [ N("Alternative drivers"),
                                 N("the list of alternative drivers for this sound card") ],
      "bus" => 
      [ N("Bus"), 
        N("this is the physical bus on which the device is plugged (eg: PCI, USB, ...)") ],
      "bus_id" => 
      [ N("Bus identification"), 
        N("- PCI and USB devices: this lists the vendor, device, subvendor and subdevice PCI/USB ids") ],
      "bus_location" => 
      [ N("Location on the bus"), 
        N("- pci devices: this gives the PCI slot, device and function of this card
- eide devices: the device is either a slave or a master device
- scsi devices: the scsi bus and the scsi device ids") ],
      "capacity" => [ N("Drive capacity"), N("special capacities of the driver (burning ability and or DVD support)") ],
      "description" => [ N("Description"), N("this field describes the device") ],
      "device" => [ N("Old device file"),
                    N("old static device name used in dev package") ],
      "driver" => [
                   #-PO: here "module" is the "jargon term" for a kernel driver
                   N("Module"), N("the module of the GNU/Linux kernel that handles the device") ],
      "extended_partitions" => [ N("Extended partitions"), N("the number of extended partitions") ],
      "geometry" => [ N("Geometry"), N("Cylinder/head/sectors geometry of the disk") ],
      "host" => [ N("Disk controller"), N("the disk controller on the host side") ],
      "info" => [ N("Identifier"), N("usually the device serial number") ],
      "media_type" => [ N("Media class"), N("class of hardware device") ],
      "Model" => [ N("Model"), N("hard disk model") ],
      "port" => [ N("Port"), N("network printer port") ],
      "primary_partitions" => [ N("Primary partitions"), N("the number of the primary partitions") ],
      "Vendor" => [ N("Vendor"), N("the vendor name of the device") ],
      "pci_domain" => [ N("PCI domain"), N("the PCI domain of the device") ],
      "pci_bus" => [ N("Bus PCI #"), N("the PCI bus on which the device is plugged") ],
      "pci_device" => [ N("PCI device #"), N("PCI device number") ],
      "pci_function" => [ N("PCI function #"), N("PCI function number") ],
      "vendor" => [ N("Vendor ID"), N("this is the standard numerical identifier of the vendor") ],
      "id" => [ N("Device ID"), N("this is the numerical identifier of the device") ],
      "subvendor" => [ N("Sub vendor ID"), N("this is the minor numerical identifier of the vendor") ],
      "subid" => [ N("Sub device ID"), N("this is the minor numerical identifier of the device") ],
      "usb_pci_device" =>, [ N("Device USB ID"), N("..") ],
     },
     CPU =>
     {
      "bogomips" => [ N("Bogomips"), N("the GNU/Linux kernel needs to run a calculation loop at boot time to initialize a timer counter.  Its result is stored as bogomips as a way to \"benchmark\" the cpu.") ],
      "cache size" => [ N("Cache size"), N("size of the (second level) cpu cache") ],
      "coma_bug" => [
                     #-PO: here "comas" is the medical coma, not the lexical coma!!
                     N("Coma bug"), N("whether this cpu has the Cyrix 6x86 Coma bug") ],
      "cpu family" => [ N("Cpuid family"), N("family of the cpu (eg: 6 for i686 class)") ],
      "cpuid level" => [ N("Cpuid level"), N("information level that can be obtained through the cpuid instruction") ],
      "cpu MHz" => [ N("Frequency (MHz)"), N("the CPU frequency in MHz (Megahertz which in first approximation may be coarsely assimilated to number of instructions the cpu is able to execute per second)") ],
      "flags" => [ N("Flags"), N("CPU flags reported by the kernel") ],
      "fdiv_bug" => [ N("Fdiv bug"), 
                      N("Early Intel Pentium chips manufactured have a bug in their floating point processor which did not achieve the required precision when performing a Floating point DIVision (FDIV)") ],
      "fpu" => [ N("Is FPU present"), N("yes means the processor has an arithmetic coprocessor") ],
      "fpu_exception" => [ N("Whether the FPU has an irq vector"), N("yes means the arithmetic coprocessor has an exception vector attached") ],
      "f00f_bug" => [ N("F00f bug"), N("early pentiums were buggy and freezed when decoding the F00F bytecode") ],
      "hlt_bug" => [ N("Halt bug"), 
                     N("Some of the early i486DX-100 chips cannot reliably return to operating mode after the \"halt\" instruction is used") ],
      "level" => [ N("Level"), N("sub generation of the cpu") ],
      "model" => [ N("Model"), N("generation of the cpu (eg: 8 for Pentium III, ...)") ],
      "model name" => [ N("Model name"), N("official vendor name of the cpu") ],
      "name" => [ N("Name"), N("the name of the CPU") ],
      "processor" => [ N("Processor ID"), N("the number of the processor") ],
      "stepping" => [ N("Model stepping"), N("stepping of the cpu (sub model (generation) number)") ],
      "vendor_id" => [ N("Vendor"), N("the vendor name of the processor") ],
      "wp" => [ N("Write protection"), N("the WP flag in the CR0 register of the cpu enforce write protection at the memory page level, thus enabling the processor to prevent unchecked kernel accesses to user memory (aka this is a bug guard)") ],
     },
     FLOPPY =>
     {
      info => [ N("Floppy format"), N("format of floppies supported by the drive") ],
     },
     HARDDISK =>
     {
      channel => [ N("Channel"), N("EIDE/SCSI channel") ],
      info => [ N("Disk identifier"), N("usually the disk serial number") ],
      lun => [ N("Logical unit number"), N("the SCSI target number (LUN). SCSI devices connected to a host are uniquely identified by a
channel number, a target id and a logical unit number") ],
     },
     MEMORY =>
     {
      'Installed Size' => [ 
          #-PO: here, "size" is the size of the ram chip (eg: 128Mo, 256Mo, ...)
          N("Installed size"), N("Installed size of the memory bank") ],
      'Enabled Size' => [ N("Enabled Size"), N("Enabled size of the memory bank") ],
      'name' => [ N("Type"), N("type of the memory device") ],
      'Current Speed' => [ N("Speed"), N("Speed of the memory bank") ],
      'Bank Connections' => [ N("Bank connections"), '' ],
      'Socket Designation' => [ N("Name"), N("Socket designation of the memory bank") ],
     },
     MOUSE =>
     {
      "device" => [ N("Device file"), N("the device file used to communicate with the kernel driver for the mouse") ],
      EmulateWheel => [ N("Emulated wheel"), N("whether the wheel is emulated or not") ],
      MOUSETYPE => [ N("Type"), N("the type of the mouse") ],
      name => [ N("Name"), N("the name of the mouse") ],
      nbuttons => [ N("Number of buttons"), N("the number of buttons the mouse has") ],
      type => [ N("Bus"), N("the type of bus on which the mouse is connected") ],
      Protocol => [ N("Mouse protocol used by X11"), N("the protocol that the graphical desktop use with the mouse") ],
     }
    );

my %groups = (
              generic =>
              {
               N("Identification") => [ qw(Vendor model description info media_type) ],
               N("Connection") => [ qw(bus pci_domain pci_bus pci_device pci_function vendor id subvendor subid) ],
              },
              AUDIO =>
              {
               N("Driver") => [ qw(driver alternative_drivers) ],
              },
              CPU =>
              {
               N("Identification") => [ qw(processor vendor_id), "model name", "cpu family", qw(model level stepping) ],
               N("Performances") => [ "cpu MHz", "cache size", "bogomips" ],
               N("Bugs") => [ qw(fdiv_bug coma_bug f00f_bug hlt_bug) ],
               N("FPU")  => [ qw(fpu fpu_exception) ],
              },
              HARDDISK =>
              {
               N("Identification") => [ qw(Vendor Model description info media_type) ],
               N("Connection") => [ qw(bus channel lun) ],
               N("Bus identification") => [ qw(vendor id subvendor subid) ],
               N("Device") => [ qw(device) ],
               N("Partitions") => [ qw(primary_partitions extended_partitions) ],
              },
              MOUSE =>
              {
               N("Identification") => [ qw(name type MOUSETYPE Protocol) ],
               N("Features") => [ qw(EmulateWheel nbuttons) ],
              },
             );

foreach my $class (qw(BURNER CDROM DVDROM)) {
    $groups{$class} = $groups{HARDDISK};
    $fields{$class} = $fields{HARDDISK};
}


my ($in, $pid, $w);

my (%options, %check_boxes);
my $conffile = "/etc/sysconfig/harddrake2/ui.conf";

my ($current_device, $current_class, $current_configurator);

my %sysh = distrib();
my $distro_name = $sysh{system};

my %menus = (
             'options' => 
             #-PO: please keep all "/" characters !!!
             N("/_Options"),
             'help' => N("/_Help")
             );

my %menu_options = (
                    'PRINTERS_DETECTION' => [ $menus{options}, N("/Autodetect _printers") ],
                    'MODEMS_DETECTION' => [ $menus{options}, N("/Autodetect _modems") ],
                    'JAZZ_DETECTION' => [ $menus{options}, N("/Autodetect _jaz drives") ],
                    'PARALLEL_ZIP_DETECTION' => [ $menus{options}, N("/Autodetect parallel _zip drives") ],
                    );

$ugtk2::wm_icon = "harddrake";
$w = ugtk2->new(N("Hardware Configuration"));
# fake diagnostics pragma:
local $::main_window = $w->{real_window};

my @menu_items = 
    (
     [ N("/_File"), undef, undef, undef, '<Branch>' ],
     [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit_global, undef, '<Item>' ],
     [ join('', @{$menu_options{PRINTERS_DETECTION}}), undef, 
       sub { $options{PRINTERS_DETECTION} = $check_boxes{PRINTERS_DETECTION}->get_active }, undef, '<CheckItem>' ],
     [ join('', @{$menu_options{MODEMS_DETECTION}}), undef,
       sub { $options{MODEMS_DETECTION} = $check_boxes{MODEMS_DETECTION}->get_active }, undef, '<CheckItem>' ],
     [ join('', @{$menu_options{JAZZ_DETECTION}}), undef,
       sub { $options{JAZZ_DETECTION} = $check_boxes{JAZZ_DETECTION}->get_active }, undef, '<CheckItem>' ],
     [ join('', @{$menu_options{PARALLEL_ZIP_DETECTION}}), undef,
       sub { $options{PARALLEL_ZIP_DETECTION} = $check_boxes{PARALLEL_ZIP_DETECTION}->get_active }, undef, '<CheckItem>' ],
     [ $menus{help}, undef, undef, undef, '<Branch>' ],
     if_(-x "/usr/sbin/drakhelp_inst",
	 [ $menus{help} . N("/_Help"), undef, sub { run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'harddrake') }, undef, '<Item>' ],
	),
     [ $menus{help} . N("/_Fields description"), undef, sub {
           if ($current_device) {
               create_dialog(N("Harddrake help"), 
                             '<big><b>' . N("Description of the fields:\n\n") . '</b></big>'
                             . join("\n\n", map {
                                 my $info = lookup_field($_);
                                 if_($info->[0], formatAlaTeX(qq(<span foreground="royalblue3">$info->[0]:</span> $info->[1])));
                             } sort keys %$current_device),
                             { use_markup => 1, transient => $w->{real_window}, height => 400, scroll => 1 });

           } else {
               create_dialog(N("Select a device!"), N("Once you've selected a device, you'll be able to see the device information in fields displayed on the right frame (\"Information\")"), { transient => $w->{real_window} });
           }
       },
       undef, '<Item>'
     ],
     if_(!-e "/etc/sysconfig/oem",
	 [ $menus{help} . N("/_Report Bug"), undef, sub { run_program::raw({ detach => 1 }, 'drakbug', '--report', 'harddrake') }, undef, '<Item>' ],
	),
     [ $menus{help} . N("/_About..."), undef, sub {
         my $license = formatAlaTeX(translate($::license));
         $license =~ s/\n/\n\n/sg; # nicer formatting
         my $w = gtknew('AboutDialog', name => N("Harddrake"),
                        version => mandrake_release_info()->{version},
                        copyright => N("Copyright (C) %s by Mandriva", '2001-2008'),
                        license => $license, wrap_license => 1,
                        comments => N("This is HardDrake, a %s hardware configuration tool.", $distro_name),
                        website => 'http://mandrivalinux.com',
                        website_label => N("Mandriva Linux"),
                        authors => 'Thierry Vignaud <vignaud@mandriva.com>',
                        artists => 'Hélène Durosini <ln@mandriva.com>',
                        translator_credits =>
                          #-PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>")
                          N("_: Translator(s) name(s) & email(s)\n"),
                        transient_for => $::main_window, modal => 1, position_policy => 'center-on-parent',
                    );
         $w->show_all;
         $w->run;
       }, undef, '<Item>'
     ]
    );

$in = 'interactive'->vnew('su'); #require_root_capability();

%options = getVarsFromSh($conffile);
$options{MDV_ONLINE} ||= [];

# Build the gui
add_icon_path('/usr/share/pixmaps/harddrake2/');
$::noborderWhenEmbedded = 1;


my ($menubar, $factory) = create_factory_menu($w->{real_window}, @menu_items);
$w->{window}->set_size_request(805, 550) if !$::isEmbedded;

my $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Int");
$w->{window}->add(gtkpack_(0, Gtk2::VBox->new(0, 0),
                           0, $menubar,
                           0, Gtk2::Banner->new("/usr/share/mcc/themes/default/harddrake-mdk.png", translate("Hardware")),
                           1, create_hpaned(gtkadd(Gtk2::Frame->new(N("Detected hardware")), 
                                                   create_scrolled_window(gtkset_size_request(my $tree = Gtk2::TreeView->new_with_model($tree_model), 350, -1), ['automatic', 'automatic'])),
                                            gtkpack_(0, Gtk2::VBox->new(0, 0),
                                                     1, gtkadd(my $frame = Gtk2::Frame->new(N("Information")),
                                                               create_scrolled_window(my $text = Gtk2::TextView->new)),
                                                     0, my $module_cfg_button = gtksignal_connect(Gtk2::Button->new(N("Set current driver options")),
                                                                                                  clicked => sub {
                                                                                                      local $SIG{CHLD} = undef;
                                                                                                      require modules::interactive;
                                                                                                      modules::interactive::config_window($in, $current_device);
                                                                                                      gtkset_mousecursor_normal();
                                                                                                  }),