diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2005-02-13 23:02:33 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2005-02-13 23:02:33 +0000 |
commit | 05b36518c04d058352c1a0c9f4a0f16c2240e712 (patch) | |
tree | eabab8842f0e84ad066a5f241b2c218f652ee625 | |
parent | ee0e8661c12639691d28753753a8390144d713ce (diff) | |
download | drakx-backup-do-not-use-05b36518c04d058352c1a0c9f4a0f16c2240e712.tar drakx-backup-do-not-use-05b36518c04d058352c1a0c9f4a0f16c2240e712.tar.gz drakx-backup-do-not-use-05b36518c04d058352c1a0c9f4a0f16c2240e712.tar.bz2 drakx-backup-do-not-use-05b36518c04d058352c1a0c9f4a0f16c2240e712.tar.xz drakx-backup-do-not-use-05b36518c04d058352c1a0c9f4a0f16c2240e712.zip |
Allow HPLIP setup also when setting up the print queue manually.
-rw-r--r-- | perl-install/printer/main.pm | 17 | ||||
-rw-r--r-- | perl-install/printer/printerdrake.pm | 62 |
2 files changed, 71 insertions, 8 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 405c2f353..6af5aad63 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -2524,6 +2524,23 @@ sub start_hplip { return undef; } +sub start_hplip_manual { + + # Start HPLIP daemons + printer::services::start_not_running_service("hplip"); + + # Return all possible device URIs + open(my $F, ($::testing ? $::prefix : "chroot $::prefix/ ") . + '/bin/sh -c "export LC_ALL=C; /usr/lib/cups/backend/hp" |') or + die 'Could not run "/usr/lib/cups/backend/hp"!'; + my @uris; + while (<$F>) { + m!^direct\s+(hp:\S+)\s+!; + push(@uris, $1); + } + return @uris; +} + sub configure_hpoj { my ($device, @autodetected) = @_; diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index 150f09055..d4e03b7c5 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -2052,6 +2052,7 @@ sub setup_common { my $hplipdevice = ""; my $ptaldevice = ""; my $isHPOJ = 0; + my $isHPLIP = 0; my $w; if ($device =~ m!^/dev/! || $device =~ m!^socket://!) { # Ask user whether he has a multi-function device when he did not @@ -2062,14 +2063,34 @@ sub setup_common { $makemodel =~ /^\s*$/) { local $::isWizard = 0; if (!$printer->{noninteractive}) { - $isHPOJ = $in->ask_yesorno(N("Add a new printer"), - N("Is your printer a multi-function device from HP or Sony (OfficeJet, PSC, LaserJet 1100/1200/1220/3000/3200/3300/4345 with scanner, DeskJet 450, Sony IJP-V100), an HP PhotoSmart or an HP LaserJet 2200?"), 0); + if (($device =~ m!/usb/!) && + ($printer->{SPOOLER} eq 'cups')) { + my $choice = $in->ask_from_list + (N("Add a new printer"), + N("On many HP printers there are special functions available, maintenance (ink level checking, nozzle cleaning. head alignment, ...) on all not too old inkjets, scanning on multi-function devices, and memory card access on printers with card readers. ") . + "\n\n" . + N("To access these extra functions on your HP printer, it must be set up with the appropriate software: ") . + N("Either with the newer HPLIP which allows printer maintenance through the easy-to-use graphical application \"Toolbox\" and four-edge full-bleed on newer PhotoSmart models ") . + N("or with the older HPOJ which allows only scanner and memory card access, but could help you in case of failure of HPLIP. ") . + "\n\n" . + N("What is your choice (choose \"None\" for non-HP printers)? "), + [N("None"), N("HPLIP"), N("HPOJ")], N("None")); + if ($choice eq N("HPLIP")) { + $isHPLIP = 1; + } elsif ($choice eq N("HPOJ")) { + $isHPOJ = 1; + } + } else { + $isHPOJ = $in->ask_yesorno(N("Add a new printer"), + N("Is your printer a multi-function device from HP or Sony (OfficeJet, PSC, LaserJet 1100/1200/1220/3000/3200/3300/4345 with scanner, DeskJet 450, Sony IJP-V100), an HP PhotoSmart or an HP LaserJet 2200?"), 0); + } } } my $hplipentry; if (($printer->{SPOOLER} eq 'cups') && - ($hplipentry = - printer::main::hplip_device_entry($device, @autodetected))) { + (($hplipentry = + printer::main::hplip_device_entry($device, @autodetected)) || + $isHPLIP)) { # Device is supported by HPLIP # Install HPLIP packages @@ -2099,10 +2120,35 @@ sub setup_common { N("Printerdrake"), N("Checking device and configuring HPLIP...")) if !$printer->{noninteractive}; - - $hplipdevice = printer::main::start_hplip - ($device, $hplipentry, @autodetected) if - !$hplipinstallfailed; + + if (!$hplipinstallfailed) { + if ($isHPLIP) { + my @uris = printer::main::start_hplip_manual(); + my @menu; my %menuhash; + for my $item (@uris) { + if ($item =~ m!^hp:/(usb|par|net)/(\S*?)(\?\S*|)$!){ + my $modelname = "HP " . $2; + $modelname =~ s/_/ /g; + push(@menu, $modelname); + $menuhash{$modelname} = $item; + } + } + undef $w; + local $::isWizard = 0; + my $choice = $in->ask_from_list + (N("Add a new printer"), + N("Which printer do you want to set up with HPLIP?"), + \@menu, $menu[0]); + $hplipdevice = $menuhash{$choice}; + $hplipentry = + printer::main::hplip_device_entry_from_uri + ($hplipdevice); + $makemodel = $choice; + } else { + $hplipdevice = printer::main::start_hplip + ($device, $hplipentry, @autodetected); + } + } if ($hplipdevice) { # Configure scanning with SANE on HP's MF devices |