diff options
-rw-r--r-- | perl-install/printer.pm | 24 | ||||
-rw-r--r-- | perl-install/printerdrake.pm | 19 |
2 files changed, 38 insertions, 5 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 6c29bd0b5..bd10417b1 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -421,6 +421,15 @@ sub read_printer_db(;$) { } close DBPATH; + # Add raw queue + if ($spooler ne "pdq") { + $entry->{ENTRY} = _("Raw printer (No driver)"); + $entry->{driver} = "raw"; + $entry->{make} = ""; + $entry->{model} = "Unknown model"; + map { $thedb{$entry->{ENTRY}}->{$_} = $entry->{$_} } keys %$entry; + } + #- Load CUPS driver database if CUPS is used as spooler if (($spooler) && ($spooler eq "cups") && ($::expert)) { @@ -706,7 +715,7 @@ sub get_descr_from_ppd { my ($printer) = @_; my %ppd; - #- if there is no ppd, this means this is the PostScript generic filter. + #- if there is no ppd, this means this is a raw queue. local *F; open F, "$prefix/etc/cups/ppd/$printer->{OLD_QUEUE}.ppd" or return "|" . _("Unknown model"); # "OTHERS|Generic PostScript printer|PostScript (en)"; local $_; @@ -768,6 +777,7 @@ sub poll_ppd_base { while (<PPDS>) { chomp; my ($ppd, $mf, $descr, $lang) = split /\|/; + if ($ppd eq "raw") {next;} my ($model, $driver); if ($descr) { if ($descr =~ /^([^,]+), (.*)$/) { @@ -862,7 +872,17 @@ sub configure_queue($) { "$prefix/etc/cups/ppd/$printer->{OLD_QUEUE}.ppd " . "$prefix/etc/cups/ppd/$printer->{currentqueue}{'queue'}.ppd"); } - } + } else { + # Raw queue + run_program::rooted($prefix, "foomatic-configure", + "-s", $printer->{currentqueue}{'spooler'}, + "-n", $printer->{currentqueue}{'queue'}, + "-c", $printer->{currentqueue}{'connect'}, + "-d", $printer->{currentqueue}{'driver'}, + "-N", $printer->{currentqueue}{'desc'}, + "-L", $printer->{currentqueue}{'loc'} + ) or die "foomatic-configure failed"; + } # Make sure that queue is active if ($printer->{SPOOLER} ne "pdq") { diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index f436ab14a..8255eed75 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -268,6 +268,10 @@ complete => sub { $device eq $_->{port} or next; $printer->{DBENTRY} = bestMatchSentence ($_->{val}{DESCRIPTION}, keys %printer::thedb); + # If the manufacturer was not guessed correctly, discard the + # guess. + #$printer->{DBENTRY} =~ /^([\|])|/; + #if ($_->{val}{DESCRIPTION} !~ /lc($1)/i) {$printer->{DBENTRY} = ""}; } 1; } @@ -711,9 +715,13 @@ sub get_db_entry { } } } - if ($printer->{DBENTRY} eq "") { + if (($printer->{DBENTRY} eq "") && 0) { # Exact match with cleaned-up model did not work, try a best match $printer->{DBENTRY} = bestMatchSentence("$make|$model", keys %printer::thedb); + # If the manufacturer was not guessed correctly, discard the + # guess. + $printer->{DBENTRY} =~ /^([\|])|/; + if (lc($1) ne lc($make)) {$printer->{DBENTRY} = ""}; } # Set the OLD_CHOICE to a non-existing value $printer->{OLD_CHOICE} = "XXX"; @@ -738,6 +746,9 @@ sub choose_model { my $w = $in->wait_message('', _("Reading printer database ...")); printer::read_printer_db($printer->{SPOOLER}); } + if (!$printer::thedb{$printer->{DBENTRY}}) { + $printer->{DBENTRY} = _("Raw printer (No driver)"); + } $in->set_help('configurePrinterType') if $::isInstall; # Choose the printer/driver from the list return ($printer->{DBENTRY} = $in->ask_from_treelist(_("Printer model selection"), @@ -1724,8 +1735,10 @@ What do you want to modify on this printer?", _("Printer manufacturer, model")), (($printer->{configured}{$queue}{'queuedata'}{'make'} ne "") && - ($printer->{configured}{$queue}{'queuedata'}{'model'} ne - _("Unknown model")) ? + (($printer->{configured}{$queue}{'queuedata'}{'model'} ne + _("Unknown model")) || + ($printer->{configured}{$queue}{'queuedata'}{'model'} ne + _("Raw printer"))) ? _("Printer options") : ()), (($queue ne $printer->{DEFAULT}) ? _("Set this printer as the default") : ()), |