summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/printer/detect.pm33
-rw-r--r--perl-install/printer/main.pm508
-rw-r--r--perl-install/printer/printerdrake.pm445
-rwxr-xr-xperl-install/standalone/printerdrake2
4 files changed, 205 insertions, 783 deletions
diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm
index b164595a5..1f6e06977 100644
--- a/perl-install/printer/detect.pm
+++ b/perl-install/printer/detect.pm
@@ -165,7 +165,7 @@ sub whatUsbport() {
# Was there a manufacturer and a model in the string?
if ($manufacturer eq "" || $model eq "") {
$manufacturer = "";
- $model = N("Unknown Model");
+ $model = N("Unknown model");
}
# No description field? Make one out of manufacturer and model.
if ($description eq "") {
@@ -204,12 +204,13 @@ sub whatNetPrinter {
return () if $#portstoscan < 0;
my $portlist = join ",", @portstoscan;
-
+
# Which hosts should be scanned?
- # (Applying nmap to a whole network is very time-consuming, because nmap
- # waits for a certain timeout period on non-existing hosts, so we get a
- # lists of existing hosts by pinging the broadcast addresses for existing
- # hosts and then scanning only them, which is much faster)
+ # (Applying nmap to a whole network is very time-consuming,
+ # because nmap waits for a certain timeout period on non-existing
+ # hosts, so we get a lists of existing hosts by pinging the
+ # broadcast addresses for existing hosts and then scanning only
+ # them, which is much faster)
my @hostips = getIPsInLocalNetworks();
return () if $#hostips < 0;
my $hostlist = join " ", @hostips;
@@ -220,7 +221,7 @@ sub whatNetPrinter {
open F, ($::testing ? "" : "chroot $::prefix/ ") .
qq(/bin/sh -c "export LC_ALL=C; nmap -r -P0 --host_timeout $timeout --initial_rtt_timeout $irtimeout -p $portlist $hostlist" 2> /dev/null |)
or return @res;
- my ($host, $ip, $port, $modelinfo) = ("", "", "", "");
+ my ($host, $ip, $port, $modelinfo, $namechecked) = ("", "", "", "", 0);
while (my $line = <F>) {
chomp $line;
@@ -231,13 +232,23 @@ sub whatNetPrinter {
$ip = $host if !$ip;
$host = $ip if $host eq "";
$port = "";
+ $namechecked = 0;
undef $modelinfo;
} elsif ($line =~ m!^\s*(\d+)/\S+\s+open\s+!i) {
next if $ip eq "";
$port = $1;
-
+
+ # Check integrity of the host name (work around DNS problems
+ # by using IP if host name is broken)
+ if (!$namechecked && ($host ne $ip)) {
+ $namechecked = 1; # Do not check more than once
+ my $packedip = gethostbyname("$host");
+ my ($a,$b,$c,$d) = unpack('C4',$packedip);
+ my $ipfromdns = sprintf("%d.%d.%d.%d", $a, $b, $c, $d);
+ $host = $ip if $ip ne $ipfromdns;
+ }
# Now we have all info for one printer
# Store this auto-detection result in the data structure
@@ -249,7 +260,7 @@ sub whatNetPrinter {
foreach my $share (@shares) {
push @res, { port => "smb://$host/$share->{name}",
val => { CLASS => 'PRINTER',
- MODEL => N("Unknown Model"),
+ MODEL => N("Unknown model"),
MANUFACTURER => "",
DESCRIPTION => $share->{description},
SERIALNUMBER => ""
@@ -484,7 +495,7 @@ sub getSNMPModel {
open F, ($::testing ? $::prefix : "chroot $::prefix/ ") .
qq(/bin/sh -c "scli -v 1 -c 'show printer info' $host" 2> /dev/null |) or
return { CLASS => 'PRINTER',
- MODEL => N("Unknown Model"),
+ MODEL => N("Unknown model"),
MANUFACTURER => "",
DESCRIPTION => "",
SERIALNUMBER => ""
@@ -557,7 +568,7 @@ sub getSNMPModel {
}
# We couldn't determine a model
- $model = N("Unknown Model") if $model eq "";
+ $model = N("Unknown model") if $model eq "";
# Remove trailing spaces
$manufacturer =~ s/(\S+)\s+$/$1/;
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index 0e45f79e9..25f58474b 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -20,9 +20,6 @@ use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(%printer_type %printer_type_inv);
-#-Did we already read the subroutines of /usr/sbin/ptal-init?
-my $ptalinitread = 0;
-
our %printer_type = (
N("Local printer") => "LOCAL",
N("Remote printer") => "REMOTE",
@@ -316,14 +313,17 @@ sub read_configured_queues($) {
}
}
close $F;
+ # Mark that we have a CUPS queue but do not know the
+ # name the PPD file in /usr/share/cups/model
+ $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd} ||= '1';
+ # Mark that our PPD file is not a Foomatic one
+ $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{driver} = "PPD";
+ } else {
+ # We do not have a PPD file for this queue
+ $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd} = undef;
+ # No PPD found? Then we have a raw queue
+ $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{driver} = "raw";
}
- # Mark that we have a CUPS queue but do not know the name
- # the PPD file in /usr/share/cups/model
- if ((!$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd}) &&
- (! -r $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd})) {
- $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{ppd} = '1';
- }
- $printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{driver} = 'PPD';
$printer->{OLD_QUEUE} = "";
}
$printer->{configured}{$QUEUES[$i]{queuedata}{queue}}{queuedata}{make} ||= "";
@@ -2466,6 +2466,7 @@ sub autodetectionentry_for_uri {
# HP printer (controlled by HPLIP)
my $hplipdevice = $uri;
$hplipdevice =~ m!^hp:/(usb|par|net)/(\S+?)(\?(serial|device)=(\S+)|)$!;
+ my $bus = $1;
my $model = $2;
my $serial = undef;
my $device = undef;
@@ -2476,6 +2477,10 @@ sub autodetectionentry_for_uri {
}
$model =~ s/_/ /g;
foreach my $p (@autodetected) {
+ next if (!$p->{port}) ||
+ (($p->{port} =~ m!/usb!) && ($bus ne "usb")) ||
+ (($p->{port} =~ m!/dev/(lp|par.*|printer.*)\d+!) &&
+ ($bus ne "par"));
next if !$p->{val}{MODEL};
if (uc($p->{val}{MODEL}) ne uc($model)) {
my $entry = hplip_device_entry($p->{port}, @autodetected);
@@ -2487,7 +2492,17 @@ sub autodetectionentry_for_uri {
next if ($serial && !$p->{val}{SERIALNUMBER}) ||
(!$serial && $p->{val}{SERIALNUMBER}) ||
(uc($serial) ne uc($p->{val}{SERIALNUMBER}));
- next if $device && ($device ne $p->{port});
+ if ($device) {
+ if ($bus eq "par") {
+ $device =~ m!/dev/(lp|parport|printer/)(\d+)!;
+ my $parporthplip = $1;
+ $p->{port} =~ m!/dev/(lp|parport|printer/)(\d+)!;
+ my $parportauto = $1;
+ next if $parporthplip != $parportauto;
+ } else {
+ next if $device ne $p->{port};
+ }
+ }
return $p;
}
} elsif ($uri =~ m!^ptal://?mlc:!) {
@@ -2526,7 +2541,7 @@ sub autodetectionentry_for_uri {
# ------------------------------------------------------------------
#
-# Configuration of HP multi-function devices
+# Configuration of HP printers and multi-function devices with HPLIP
#
# ------------------------------------------------------------------
@@ -2535,7 +2550,7 @@ sub read_hplip_db {
# Read the device database XML file which comes with the HPLIP
# package
open(my $F, "< $::prefix/usr/share/hplip/data/xml/models.xml") or
- die "Could not read /usr/share/hplip/data/xml/models.xml\n";
+ warn "Could not read /usr/share/hplip/data/xml/models.xml\n";
my $entry = {};
my $inentry = 0;
@@ -2604,6 +2619,12 @@ sub read_hplip_db {
and $entry->{deviddesc} = $2;
$idstr =~ m!(CMD|COMMAND\s*SET):([^;]+);!i
and $entry->{devidcmdset} = $2;
+ } elsif (m!^\s*<io support="(\d+)".*/>\s*$!) {
+ # Input/Output ports explicitly supported by HPLIP
+ my $ports = $1;
+ $entry->{bus}{par} = 1 if ($ports & 1);
+ $entry->{bus}{usb} = 1 if ($ports & 2);
+ $entry->{bus}{net} = 1 if ($ports & 4);
} elsif (m!^\s*<tech type="(\d+)"/>\s*$!) {
# Printing technology
$entry->{tech} = $1;
@@ -2667,8 +2688,10 @@ sub hplip_simple_model {
sub hplip_device_entry {
my ($device, @autodetected) = @_;
- # Currently, only devices on USB or TCP/Socket work
- return undef if ($device !~ /usb/i) && ($device !~ m!^socket://!i);
+ # Currently, only local or TCP/Socket device work
+ return undef if ($device !~ /usb/i) &&
+ ($device !~ m!/dev/(lp|par.*|printer.*)\d+!) &&
+ ($device !~ m!^socket://!i);
if (!$hplipdevicesdb) {
# Read the HPLIP device database if not done already
@@ -2745,9 +2768,7 @@ sub start_hplip {
my $bus;
if ($device =~ /usb/) {
$bus = "usb";
- } elsif ($device =~ /par/ ||
- $device =~ m!/dev/lp! ||
- $device =~ /printers/) {
+ } elsif ($device =~ m!/dev/(lp|par.*|printer.*)\d+!) {
$bus = "par";
} elsif ($device =~ m!^socket://!) {
$bus = "net";
@@ -2795,19 +2816,26 @@ sub start_hplip {
my $modelstr = $2;
my $serial = $3;
my $devicestr = $4;
+ $devicestr =~ m!/dev/(lp|parport|printer/)(\d+)!;
+ my $parporthplip = $1;
+ $device =~ m!/dev/(lp|parport|printer/)(\d+)!;
+ my $parportdevice = $1;
if ((uc($modelstr) eq uc($hplipentry->{model})) &&
(!$serial ||
(uc($serial) eq uc($a->{val}{SERIALNUMBER}))) &&
(!$devicestr ||
- ($devicestr eq $device))) {
+ ($devicestr eq $device) ||
+ (($parporthplip ne "") &&
+ ($parportdevice ne "") &&
+ ($parporthplip == $parportdevice)))) {
close $F;
return $uri;
}
}
}
close $F;
+ last;
}
- last;
}
# HPLIP URI not found
return undef;
@@ -2838,9 +2866,7 @@ sub remove_hpoj_config {
my $bus;
if ($device =~ /usb/) {
$bus = "usb";
- } elsif ($device =~ /par/ ||
- $device =~ m!/dev/lp! ||
- $device =~ /printers/) {
+ } elsif ($device =~ m!/dev/(lp|par.*|printer.*)\d+!) {
$bus = "par";
} elsif ($device =~ /socket/) {
$bus = "hpjd";
@@ -2875,391 +2901,6 @@ sub remove_hpoj_config {
}
closedir PTALDIR;
return undef;
-}
-
-sub configure_hpoj {
- my ($device, @autodetected) = @_;
-
- # Make the subroutines of /usr/sbin/ptal-init available
- # It's only necessary to read it at the first call of this subroutine,
- # the subroutine definitions stay valid after leaving this subroutine.
- if (!$ptalinitread) {
- open(my $PTALINIT, "$::prefix/usr/sbin/ptal-init") or do {
- die "unable to open $::prefix/usr/sbin/ptal-init";
- };
- my @ptalinitfunctions; # subroutine definitions in /usr/sbin/ptal-init
- local $_;
- while (<$PTALINIT>) {
- if (m!sub main!) {
- last;
- } elsif (m!^[^#]! && !(m!^\s*exec\b!)) {
- # Comment lines and the "exec" line (probably obsolete
- # Red Hat workaround) are skipped.
-
- # Make the subroutines also working during installation
- if ($::isInstall) {
- s!\$::prefix!\$hpoj_prefix!g;
- s!prefix="/usr"!prefix="$::prefix/usr"!g;
- s!etcPtal="/etc/ptal"!etcPtal="$::prefix/etc/ptal"!g;
- s!varLock="/var/lock"!varLock="$::prefix/var/lock"!g;
- s!varRunPrefix="/var/run"!varRunPrefix="$::prefix/var/run"!g;
- s!/sbin/lsmod!/usr/bin/lsmod!g;
- s!/sbin/modprobe!/usr/bin/modprobe!g;
- s!/sbin/rmmod!/usr/bin/rmmod!g;
- s!(my\s*\$osPlatform\s*=\s*).*?$!$1"Linux";!g;
- s!chomp\s*\$osPlatform\s*;\s*$!!g;
- s!(my\s*\$linuxVersion\s*=\s*).*?$!$1"$kernelversion";!g;
- s!^\s*\$linuxVersion\s*=~\s*s.*$!!g;
- s!chomp\s*\$linuxVersion\s*;\s*$!!g;
- s!(my\s*\$usbprintermodule\s*=\s*).*?$!$1"$usbprintermodule";!g;
- }
- push @ptalinitfunctions, $_;
- }
- }
- close $PTALINIT;
-
- eval "package printer::hpoj;
- @ptalinitfunctions
- sub getDevnames {
- return (%devnames)
- }
- sub getConfigInfo {
- return (%configInfo)
- }";
-
- if ($::isInstall) {
- # Needed for photo card reader detection during installation
- system("ln -s $::prefix/var/run/ptal-mlcd /var/run/ptal-mlcd");
- system("ln -s $::prefix/etc/ptal /etc/ptal");
- }
- $ptalinitread = 1;
- }
-
- # Read the HPOJ config file and check whether this device is already
- # configured
- printer::hpoj::setupVariables();
- printer::hpoj::readDeviceInfo();
-
- $device =~ m!^/dev/\S*lp(\d+)$! or
- $device =~ m!^/dev/printers/(\d+)$! or
- $device =~ m!^socket://([^:]+)$! or
- $device =~ m!^socket://([^:]+):(\d+)$!;
- my $model = $1;
- my ($model_long, $serialnumber, $serialnumber_long) = ("", "", "");
- my $cardreader = 0;
- my $device_ok = 1;
- my $bus;
- my $address_arg = "";
- my $base_address = "";
- my $hostname = "";
- my $port = $2;
- if ($device =~ /usb/) {
- $bus = "usb";
- } elsif ($device =~ /par/ ||
- $device =~ m!/dev/lp! ||
- $device =~ /printers/) {
- $bus = "par";
- $address_arg = printer::detect::parport_addr($device);
- eval "$base_address = $1" if $address_arg =~ /^\s*-base\s+(\S+)/;
- } elsif ($device =~ /socket/) {
- $bus = "hpjd";
- $hostname = $model;
- return "" if $port && ($port < 9100 || $port > 9103);
- if ($port && $port != 9100) {
- $port -= 9100;
- $hostname .= ":$port";
- }
- } else {
- return "";
- }
- if ($#autodetected < 0) {
- # Make a pseudo structure for the auto-detected data if there is
- # no auto-detected data (for example when configuring manually)
- $autodetected[0] = {
- 'port' => $device,
- 'val' => {
- 'MODEL' => N("Unknown model")
- }
- };
- }
- foreach (@autodetected) {
- $device eq $_->{port} or next;
- # $model is for the PTAL device name, so make sure that it is unique
- # so in the case of the model name auto-detection having failed leave
- # the port number or the host name as model name.
- my $searchunknown = N("Unknown model");
- if ($_->{val}{MODEL} &&
- $_->{val}{MODEL} !~ /$searchunknown/i &&
- $_->{val}{MODEL} !~ /^\s*$/) {
- $model = $_->{val}{MODEL};
- }
- $serialnumber = $_->{val}{SERIALNUMBER};
- services::stop("hpoj") if $bus ne "hpjd";
- # Check if the device is really an HP multi-function device
- #my $libusb = 0;
- foreach my $libusb (0, 1) {
- # Do access via libusb/user mode only if we have a USB device
- next if $libusb && $bus ne "usb";
- # Preliminary workaround to make the user-mode USB devices
- # (LIDIL devices) installable as verification of the HPOJ
- # settings of these devices does not work yet. The workaround
- # will probably removed after version 9.2 of this distribution.
- # Note: This workaround leaves out the checking for a photo
- # memory card reader, but to my knowledge there are no LIDIL
- # devices with card reader yet.
- if ($libusb) {
- $device_ok = 1;
- next;
- }
- my $printermoduleunloaded = 0;
- if ($bus ne "hpjd") {
- if (!$libusb) {
- # Start ptal-mlcd daemon for locally connected devices
- # (kernel mode with "printer"/"usblp" module for USB).
- run_program::rooted($::prefix,
- "ptal-mlcd", "$bus:probe",
- (($bus ne "par") ||
- (!$address_arg) ?
- ("-device", $device) : ()),
- split(' ',$address_arg));
- } else {
- # Start ptal-mlcd daemon for user-mode USB devices
- # (all LIDIL MF devices as HP PSC 1xxx and OfficeJet
- # 4xxx)
- my $usbdev = usbdevice($_->{val});
- if (defined($usbdev)) {
- # Unload kernel module "printer"/"usblp"
- if (modules::any_conf->read->get_probeall("usb-interface")) {
- eval(modules::unload($usbprintermodule));
- $printermoduleunloaded = 1;
- }
- # Start ptal-mlcd
- run_program::rooted($::prefix,
- "ptal-mlcd", "$bus:probe",
- "-device", $usbdev);
- } else {
- # We could not determine the USB device number,
- # so we cannot check this device in user mode
- next;
- }
- }
- }
- $device_ok = 0;
- my $ptalprobedevice = $bus eq "hpjd" ? "hpjd:$hostname" : "mlc:$bus:probe";
- if (open(my $F, ($::testing ? $::prefix : "chroot $::prefix/ ") . "/usr/bin/ptal-devid $ptalprobedevice |")) {
- my $devid = join("", <$F>);
- close $F;
- if ($devid) {
- $device_ok = 1;
- if (open(my $F, ($::testing ? $::prefix : "chroot $::prefix/ ") . "/usr/bin/ptal-devid $ptalprobedevice -long -mdl 2>/dev/null |")) {
- $model_long = join("", <$F>);
- close $F;
- chomp $model_long;
- # If SNMP or local port auto-detection failed but
- # HPOJ auto-detection succeeded, fill in model name
- # here.
- if (!$_->{val}{MODEL} ||
- $_->{val}{MODEL} =~ /$searchunknown/i ||
- $_->{val}{MODEL} =~ /^\s*$/) {
- if ($model_long =~ /:([^:;]+);/) {
- $_->{val}{MODEL} = $1;
- $model = $_->{val}{MODEL};
- $model =~ s/ /_/g;
- }
- }
- }
- if (open(my $F, ($::testing ? $::prefix : "chroot $::prefix/ ") . "/usr/bin/ptal-devid $ptalprobedevice -long -sern 2>/dev/null |")) { #-#
- $serialnumber_long = join("", <$F>);
- close $F;
- chomp $serialnumber_long;
- }
- $cardreader = 1 if printer::hpoj::cardReaderDetected($ptalprobedevice);
- }
- }
- if ($bus ne "hpjd") {
- # Stop ptal-mlcd daemon for locally connected devices
- if (open(my $F, ($::testing ? $::prefix : "chroot $::prefix/ ") . qq(ps auxwww | grep "ptal-mlcd $bus:probe" | grep -v grep | ))) {
- my $line = <$F>;
- if ($line =~ /^\s*\S+\s+(\d+)\s+/) {
- my $pid = $1;
- kill 15, $pid;
- }
- close $F;
- }
- $printermoduleunloaded &&
- eval(modules::load($usbprintermodule));
- }
- last if $device_ok;
- }
- printer::services::start("hpoj") if $bus ne "hpjd";
- last;
- }
- # No, it is not an HP multi-function device.
- return "" if !$device_ok;
-
- # If $model_long and $serialnumber_long stay empty, fill them with
- # $model and $serialnumber
- $model_long ||= $model;
- $serialnumber_long ||= $serialnumber;
-
- # Determine the ptal device name from already existing config files
- my $ptalprefix =
- ($bus eq "hpjd" ? "hpjd:" : "mlc:$bus:");
- my $ptaldevice = printer::hpoj::lookupDevname($ptalprefix, $model_long,
- $serialnumber_long, $base_address);
-
- # It's all done for us, the device is already configured
- return $ptaldevice if defined($ptaldevice);
-
- # Determine the ptal name for a new device
- if ($bus eq "hpjd") {
- $ptaldevice = "hpjd:$hostname";
- } else {
- $ptaldevice = $model;
- $ptaldevice =~ s![\s/]+!_!g;
- $ptaldevice = "mlc:$bus:$ptaldevice";
- }
-
- # Delete any old/conflicting devices
- printer::hpoj::deleteDevice($ptaldevice);
- if ($bus eq "par") {
- while (1) {
- my $oldDevname = printer::hpoj::lookupDevname("mlc:par:",undef,undef,$base_address);
- last unless defined($oldDevname);
- printer::hpoj::deleteDevice($oldDevname);
- }
- }
-
- # Configure the device
-
- # Open configuration file
- open(my $CONFIG, "> $::prefix/etc/ptal/$ptaldevice") or
- die "Could not open /etc/ptal/$ptaldevice for writing!\n";
-
- # Write file header.
- my $date = chomp_(`date`);
- print $CONFIG
-qq(
-# Added $date by "printerdrake"
-
-# The basic format for this file is "key[+]=value".
-# If you say "+=" instead of "=", then the value is appended to any
-# value already defined for this key, rather than replacing it.
-
-# Comments must start at the beginning of the line. Otherwise, they may
-# be interpreted as being part of the value.
-
-# If you have multiple devices and want to define options that apply to
-# all of them, then put them in the file /etc/ptal/defaults, which is read
-# in before this file.
-
-# The format version of this file:
-# ptal-init ignores devices with incorrect/missing versions.
-init.version=2
-);
-
- # Write model string.
- if ($model_long !~ /\S/) {
- print $CONFIG
- "\n" .
- qq(# "printerdrake" couldn't read the model but added this device anyway:\n) .
- "# ";
- } else {
- print $CONFIG
- "\n" .
- "# The device model that was originally detected on this port:\n" .
- qq(# If this ever changes, then you should re-run "printerdrake"\n) .
- "# to delete and re-configure this device.\n";
- if ($bus eq "par") {
- print $CONFIG
- "# Comment out if you do not care what model is really connected to this\n" .
- "# parallel port.\n";
- }
- }
- print $CONFIG
- qq(init.mlcd.append+=-devidmatch "$model_long"\n);
-
- # Write serial-number string.
- if ($serialnumber_long !~ /\S/) {
- print $CONFIG
- "\n" .
- "# The device's serial number is unknown.\n" .
- "# ";
- } else {
- print $CONFIG
- "\n" .
- "# The serial number of the device that was originally detected on this port:\n";
- if ($bus =~ /^[pu]/) {
- print $CONFIG
- "# Comment out if you want to disable serial-number matching.\n";
- }
- }
- print $CONFIG
- qq(init.mlcd.append+=-devidmatch "$serialnumber_long"\n);
-
- if ($bus =~ /^[pu]/) {
- print $CONFIG
- "\n" .
- "# Standard options passed to ptal-mlcd:\n" .
- "init.mlcd.append+=";
- if ($bus eq "usb") {
- # Important: do not put more quotes around /dev/usb/lp[0-9]*,
- # because ptal-mlcd currently does no globbing:
- print $CONFIG "-device /dev/usb/lp0 /dev/usb/lp1 /dev/usb/lp2 /dev/usb/lp3 /dev/usb/lp4 /dev/usb/lp5 /dev/usb/lp6 /dev/usb/lp7 /dev/usb/lp8 /dev/usb/lp9 /dev/usb/lp10 /dev/usb/lp11 /dev/usb/lp12 /dev/usb/lp13 /dev/usb/lp14 /dev/usb/lp15";
- } elsif ($bus eq "par") {
- print $CONFIG "$address_arg" .
- (!$address_arg ? " -device $device" : "");
- }
- print $CONFIG "\n" .
- "\n" .
- "# ptal-mlcd's remote console can be useful for debugging, but may be a\n" .
- "# security/DoS risk otherwise. In any case, it's accessible with the\n" .
- qq(# command "ptal-connect mlc:<XXX>:<YYY> -service PTAL-MLCD-CONSOLE".\n) .
- "# Uncomment the following line if you want to enable this feature for\n" .
- "# this device:\n" .
- "# init.mlcd.append+=-remconsole\n" .
- "\n" .
- "# If you need to pass any other command-line options to ptal-mlcd, then\n" .
- "# add them to the following line and uncomment the line:\n" .
- "# init.mlcd.append+=\n" .
- "\n" .
- "# By default ptal-printd is started for mlc: devices. If you use CUPS,\n" .
- "# then you may not be able to use ptal-printd, and you can uncomment the\n" .
- "# following line to disable ptal-printd for this device:\n" .
- "# init.printd.start=0\n";
- } else {
- print $CONFIG
- "\n" .
- "# By default ptal-printd is not started for hpjd: devices.\n" .
- "# If for some reason you want to start it for this device, then\n" .
- "# uncomment the following line:\n" .
- "init.printd.start=1\n";
- }
-
- print $CONFIG
- "\n" .
- "# If you need to pass any additional command-line options to ptal-printd,\n" .
- "# then add them to the following line and uncomment the line:\n" .
- "# init.printd.append+=\n";
- if ($cardreader) {
- print $CONFIG
- "\n" .
- "# Uncomment the following line to enable ptal-photod for this device:\n" .
- "init.photod.start=1\n" .
- "\n" .
- "# If you have more than one photo-card-capable peripheral and you want to\n" .
- "# assign particular TCP port numbers and mtools drive letters to each one,\n" .
- qq(# then change the line below to use the "-portoffset <n>" option.\n) .
- "init.photod.append+=-maxaltports 26\n";
- }
- close($CONFIG);
- printer::hpoj::readOneDevice($ptaldevice);
-
- # Restart HPOJ
- printer::services::restart("hpoj");
-
- # Return HPOJ device name to form the URI
- return $ptaldevice;
}
sub devicefound {
@@ -3327,57 +2968,6 @@ sub config_sane {
die "can not write SANE config in /etc/sane.d/dll.conf: $!";
}
-sub config_photocard() {
-
- # Add definitions for the drives p:. q:, r:, and s: to /etc/mtools.conf
- cat_("$::prefix/etc/mtools.conf") !~ m/^\s*drive\s+p:/m or return;
-
- append_to_file("$::prefix/etc/mtools.conf", <<'EOF');
-# Drive definitions added for the photo card readers in HP multi-function
-# devices driven by HPOJ
-drive p: file=":0" remote
-drive q: file=":1" remote
-drive r: file=":2" remote
-drive s: file=":3" remote
-# This turns off some file system integrity checks of mtools, it is needed
-# for some photo cards.
-mtools_skip_check=1
-EOF
-
- # Generate a config file for the graphical mtools frontend MToolsFM or
- # modify the existing one
- my $mtoolsfmconf;
- if (-f "$::prefix/etc/mtoolsfm.conf") {
- $mtoolsfmconf = cat_("$::prefix/etc/mtoolsfm.conf") or die "can not read MToolsFM config in $::prefix/etc/mtoolsfm.conf: $!";
- my $alloweddrives = lc($1) if $mtoolsfmconf =~ m/^\s*DRIVES\s*=\s*"([A-Za-z ]*)"/m;
- foreach my $letter ("p", "q", "r", "s") {
- $alloweddrives .= $letter if $alloweddrives !~ /$letter/;
- }
- $mtoolsfmconf =~ s/^\s*DRIVES\s*=\s*"[A-Za-z ]*"/DRIVES="$alloweddrives"/m;
- $mtoolsfmconf =~ s/^\s*LEFTDRIVE\s*=\s*"[^"]*"/LEFTDRIVE="p"/m;
- #"# Fix emacs syntax highlighting
- } else {
- $mtoolsfmconf = <<'EOF';
-# MToolsFM config file. comments start with a hash sign.
-#
-# This variable sets the allowed driveletters (all lowercase). Example:
-# DRIVES="ab"
-DRIVES="apqrs"
-#
-# This variable sets the driveletter upon startup in the left window.
-# An empty string or space is for the hardisk. Example:
-# LEFTDRIVE="a"
-LEFTDRIVE="p"
-#
-# This variable sets the driveletter upon startup in the right window.
-# An empty string or space is for the hardisk. Example:
-# RIGHTDRIVE="a"
-RIGHTDRIVE=" "
-EOF
- }
- output("$::prefix/etc/mtoolsfm.conf", $mtoolsfmconf);
-}
-
sub setcupslink {
my ($printer) = @_;
return 1 if !$::isInstall || $printer->{SPOOLER} ne "cups" || -d "/etc/cups/ppd";
diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm
index 0d2dc0bba..648e12498 100644
--- a/perl-install/printer/printerdrake.pm
+++ b/perl-install/printer/printerdrake.pm
@@ -927,23 +927,10 @@ sub configure_new_printers {
$in->wait_message(N("Printerdrake"),
N("Searching for new printers..."));
- # When HPOJ is running, it blocks the printer ports on which it is
- # configured, so we stop it here. If it is not installed or not
- # configured, this command has no effect. We do not stop HPOJ if we are
- # called by the hotplug script, as HPOJ reloads the parallel port
- # kernel modules and causes a new hotplug signal which leads to
- # recursive calls of the hotplug script.
- require services;
- services::stop("hpoj") if !$::noX && !$::autoqueue;
-
# Auto-detect local printers
my @autodetected = printer::detect::local_detect();
$printer->{AUTODETECTEDPRINTERSNONINTERACTIVE} = \@autodetected if @autodetected;
- # We are ready with auto-detection, so we restart HPOJ here. If it
- # is not installed or not configured, this command has no effect.
- services::start("hpoj") if !$::noX && !$::autoqueue;
-
# No printer found? So no need of new queues.
return 1 if !@autodetected;
@@ -1436,11 +1423,6 @@ sub setup_local_autoscan {
};
}
my $_w = $in->wait_message(N("Printer auto-detection"), N("Detecting devices..."));
- # When HPOJ is running, it blocks the printer ports on which it is
- # configured, so we stop it here. If it is not installed or not
- # configured, this command has no effect.
- require services;
- services::stop("hpoj");
@autodetected = (
$expert_or_modify || $printer->{AUTODETECTLOCAL} ? printer::detect::local_detect() : (),
!$expert_or_modify ? printer::detect::whatNetPrinter($printer->{AUTODETECTNETWORK}, $printer->{AUTODETECTSMB}, $printer->{TIMEOUT}) : (),
@@ -1514,9 +1496,6 @@ sub setup_local_autoscan {
$menuentries->{$menustr} = $q;
}
}
- # We are ready with auto-detection, so we restart HPOJ here. If it
- # is not installed or not configured, this command has no effect.
- printer::services::start("hpoj");
} else {
# Always ask for queue name in recommended mode when no auto-
# detection was done
@@ -1732,23 +1711,23 @@ complete => sub {
# Auto-detect printer model (works if host is an ethernet-connected
# printer)
my $modelinfo = printer::detect::getSNMPModel($remotehost);
- my $auto_hpoj;
+ my $auto_hplip;
if (defined($modelinfo) &&
$modelinfo->{MANUFACTURER} ne "" &&
$modelinfo->{MODEL} ne "") {
local $::isWizard = 0;
$in->ask_warn(N("Information"), N("Detected model: %s %s",
$modelinfo->{MANUFACTURER}, $modelinfo->{MODEL}));
- $auto_hpoj = 1;
+ $auto_hplip = 1;
} else {
- $auto_hpoj = 0;
+ $auto_hplip = 0;
}
# Do configuration of multi-function devices and look up model name
# in the printer database
setup_common($printer, $in,
"$modelinfo->{MANUFACTURER} $modelinfo->{MODEL}",
- $printer->{currentqueue}{connect}, $auto_hpoj,
+ $printer->{currentqueue}{connect}, $auto_hplip,
({port => $printer->{currentqueue}{connect},
val => $modelinfo }));
@@ -2207,7 +2186,7 @@ sub setup_socket {
if ($printer->{AUTODETECT}) {
$modelinfo = printer::detect::getSNMPModel($remotehost);
}
- my $auto_hpoj;
+ my $auto_hplip;
if (defined($modelinfo) &&
$modelinfo->{MANUFACTURER} ne "" &&
$modelinfo->{MODEL} ne "") {
@@ -2217,16 +2196,16 @@ sub setup_socket {
$modelinfo->{MANUFACTURER},
$modelinfo->{MODEL}));
}
- $auto_hpoj = 1;
+ $auto_hplip = 1;
} else {
- $auto_hpoj = 0;
+ $auto_hplip = 0;
}
# Do configuration of multi-function devices and look up model name
# in the printer database
setup_common($printer, $in,
"$modelinfo->{MANUFACTURER} $modelinfo->{MODEL}",
- $printer->{currentqueue}{connect}, $auto_hpoj,
+ $printer->{currentqueue}{connect}, $auto_hplip,
({port => $printer->{currentqueue}{connect},
val => $modelinfo }));
1;
@@ -2259,8 +2238,6 @@ list => [ if_($printer->{currentqueue}{connect},
"smb://",
"ncp://",
"socket://",
- "ptal:/mlc:",
- "ptal:/hpjd:",
"hp:/usb/",
"hp:/par/",
"hp:/net/",
@@ -2333,7 +2310,7 @@ complete => sub {
# printer)
my $remotehost = $1;
my $modelinfo = printer::detect::getSNMPModel($remotehost);
- my $auto_hpoj;
+ my $auto_hplip;
if (defined($modelinfo) &&
$modelinfo->{MANUFACTURER} ne "" &&
$modelinfo->{MODEL} ne "") {
@@ -2341,16 +2318,16 @@ complete => sub {
$in->ask_warn(N("Information"), N("Detected model: %s %s",
$modelinfo->{MANUFACTURER},
$modelinfo->{MODEL}));
- $auto_hpoj = 1;
+ $auto_hplip = 1;
} else {
- $auto_hpoj = 0;
+ $auto_hplip = 0;
}
# Do configuration of multi-function devices and look up model name
# in the printer database
setup_common($printer, $in,
"$modelinfo->{MANUFACTURER} $modelinfo->{MODEL}",
- $printer->{currentqueue}{connect}, $auto_hpoj,
+ $printer->{currentqueue}{connect}, $auto_hplip,
({port => $printer->{currentqueue}{connect},
val => $modelinfo }));
}
@@ -2393,17 +2370,79 @@ complete => sub {
1;
}
+sub hplip_bus_warning {
+
+ my ($printer, $in, $device, $hplipentry) = @_;
+
+ # Determine connection type
+ my $bus;
+ if ($device =~ /usb/) {
+ $bus = "usb";
+ } elsif ($device =~ m!/dev/(lp|par.*|printer.*)\d+!) {
+ $bus = "par";
+ } elsif ($device =~ m!^socket://!) {
+ $bus = "net";
+ } else {
+ return 0;
+ }
+
+ # HPLIP supports the connection through which the device is currently
+ # accessed
+ return 1 if $hplipentry->{bus}{$bus};
+
+ # Ask user what to do
+ if ($::noX) {
+ return 0;
+ } else {
+ local $::isWizard = 0;
+ my $modelstr = $hplipentry->{model};
+ $modelstr =~ s/_/ /g;
+ my $choice = $in->ask_from_list
+ (N("Add a new printer"),
+ N("Your printer %s is currently connected %s.",
+ $modelstr,
+ ($bus eq "par" ? N("to a parallel port") :
+ ($bus eq "usb" ? N("to the USB") :
+ N("via the network")))) . " " .
+ N("This type of connection is currently not fully supported by HPLIP.") .
+ " " .
+ N("You get full HPLIP support for your device if you connect it ") .
+ join(", ",
+ (if_($hplipentry->{bus}{par}, N("to a parallel port")),
+ if_($hplipentry->{bus}{usb}, N("to the USB")),
+ if_($hplipentry->{bus}{net}, N("via the network")))) .
+ ".\n\n" .
+ N("You can now set up your device with HPLIP anyway (works in many cases), ") .
+ N("set it up without HPLIP (print-only), ") . N("or") . " " .
+ N("cancel the setup (for example to reconnect your device).") .
+ "\n\n" .
+ N("You can always revise your choice by clicking your printer's entry in the main window, ") .
+ N("clicking the \"%s\" button, ", N("Edit")) .
+ N("and choosing \"%s\".", N("Printer connection type")) .
+ "\n\n" .
+ N("What do you want to do?"),
+ [N("Set up with HPLIP"),
+ N("Set up without HPLIP"),
+ N("Cancel setup")], N("Cancel setup"));
+ if ($choice eq N("Set up with HPLIP")) {
+ return 1;
+ } elsif ($choice eq N("Set up without HPLIP")) {
+ return 2;
+ } else {
+ return 0;
+ }
+ }
+}
+
sub setup_common {
my ($printer, $in, $makemodel, $device, $do_auto_detect, @autodetected) = @_;
local $::isEmbedded = 0;
- #- Check whether the printer is an HP multi-function device and
- #- configure HPOJ if it is one
+ #- Check whether the printer is an HP printer or multi-function device and
+ #- configure HPLIP if it is one
my $hplipdevice = "";
- my $ptaldevice = "";
- my $isHPOJ = 0;
my $isHPLIP = 0;
my $searchunknown = N("Unknown model");
my $w;
@@ -2411,44 +2450,38 @@ sub setup_common {
# Ask user whether he has a multi-function device when he did not
# do auto-detection or when auto-detection failed
if (!$do_auto_detect ||
- $makemodel =~ /$searchunknown/ ||
+ $makemodel =~ /$searchunknown/i ||
$makemodel =~ /^\s*$/) {
local $::isWizard = 0;
if (!$printer->{noninteractive}) {
- if (($device =~ m!/usb/! ||
- $device =~ m!^socket://!) &&
- $printer->{SPOOLER} eq 'cups') {
- my $choice = $in->ask_from_list
+ if ($printer->{SPOOLER} eq 'cups') {
+ $isHPLIP = $in->ask_yesorno
(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("To access these extra functions on HP printers they must be set up with HPLIP (HP Linux Imaging and Printing). ") .
"\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);
+ N("Do you want to use HPLIP (choose \"No\" for non-HP printers)? "), 0);
}
}
}
my $hplipentry;
+ my $hplipaborted = 0;
if (($printer->{SPOOLER} eq 'cups') &&
(($hplipentry =
printer::main::hplip_device_entry($device, @autodetected)) ||
$isHPLIP)) {
# Device is supported by HPLIP
-
+ if ($hplipentry) {
+ my $buswarning =
+ hplip_bus_warning($printer, $in, $device, $hplipentry);
+ return 0 if !$buswarning;
+ $hplipaborted = 1 if $buswarning == 2;
+ }
# Install HPLIP packages
my $hplipinstallfailed = 0;
if (!$::testing &&
+ !$hplipaborted &&
!files_exist(qw(/usr/sbin/hpiod))) {
if ($::noX) {
$hplipinstallfailed = 1;
@@ -2482,14 +2515,15 @@ sub setup_common {
}
}
}
- # Start HPLIP and get device URI
- undef $w;
- $w = $in->wait_message(
- N("Printerdrake"),
- N("Checking device and configuring %s...", N("HPLIP")))
- if !$printer->{noninteractive};
- if (!$hplipinstallfailed) {
+ if (!$hplipinstallfailed && !$hplipaborted) {
+ # Start HPLIP and get device URI
+ undef $w;
+ $w = $in->wait_message
+ (N("Printerdrake"),
+ N("Checking device and configuring %s...", N("HPLIP")))
+ if !$printer->{noninteractive};
+
if ($isHPLIP && ($device !~ m!^socket://!)) {
my @uris = printer::main::start_hplip_manual();
my (@menu, %menuhash);
@@ -2513,7 +2547,21 @@ sub setup_common {
$hplipentry =
printer::main::hplip_device_entry_from_uri
($hplipdevice);
- $makemodel = $choice;
+ if ($hplipentry) {
+ my $buswarning =
+ hplip_bus_warning($printer, $in,
+ $device, $hplipentry);
+ return 0 if !$buswarning;
+ if ($buswarning == 2) {
+ $hplipaborted = 1;
+ $hplipdevice = "";
+ } else {
+ $makemodel = $choice;
+ }
+ } else {
+ $hplipaborted = 1;
+ $hplipdevice = "";
+ }
} else {
$hplipdevice = printer::main::start_hplip
($device, $hplipentry, @autodetected);
@@ -2523,7 +2571,7 @@ sub setup_common {
($hplipdevice);
}
if (($makemodel !~ /\S/) ||
- ($makemodel =~ /$searchunknown/)) {
+ ($makemodel =~ /$searchunknown/i)) {
$makemodel = $hplipentry->{model};
$makemodel =~ s/_/ /g;
$makemodel = "HP " . $makemodel
@@ -2586,169 +2634,8 @@ sub setup_common {
}
}
if (!$hplipdevice) {
- if ($makemodel =~ /HP\s+(OfficeJet|PSC|PhotoSmart|LaserJet\s+(1200|1220|2200|30(15|20|30)|3200|33.0|4345)|(DeskJet|dj)\s*450)/i ||
- $makemodel =~ /Sony\s+IJP[\s\-]+V[\s\-]+100/i ||
- $isHPOJ) {
- # Install HPOJ package
- my $hpojinstallfailed = 0;
- if (!$::testing &&
- !files_exist(qw(/usr/sbin/ptal-mlcd
- /usr/sbin/ptal-init
- /usr/bin/xojpanel
- /usr/sbin/lsusb))) {
- if ($::noX) {
- $hpojinstallfailed = 1;
- } else {
- $w = $in->wait_message(N("Printerdrake"),
- N("Installing %s package...", N("HPOJ")))
- if !$printer->{noninteractive};
- $in->do_pkgs->install('hpoj', 'xojpanel', 'usbutils')
- or do {
- $in->ask_warn(N("Warning"),
- N("Could not install the %s packages!",
- N("HPOJ")) . " " .
- N("Only printing will be possible on the %s.",
- $makemodel));
- $hpojinstallfailed = 1;
- };
- }
- }
- # Configure and start HPOJ
- undef $w;
- $w = $in->wait_message
- (N("Printerdrake"),
- N("Checking device and configuring %s...", N("HPOJ")))
- if !$printer->{noninteractive};
-
- eval { $ptaldevice = printer::main::configure_hpoj
- ($device, @autodetected) if !$hpojinstallfailed };
-
- if (my $err = $@) {
- warn qq(HPOJ conf failure: "$err");
- log::l(qq(HPOJ conf failure: "$err"));
- }
-
- if ($ptaldevice) {
- # HPOJ has determined the device name, make use of
- # it if we did not know it before
- if (!$do_auto_detect ||
- !$makemodel ||
- $makemodel eq $searchunknown ||
- $makemodel =~ /^\s*$/) {
- $makemodel = $ptaldevice;
- $makemodel =~ s/^.*:([^:]+)$/$1/;
- $makemodel =~ s/_/ /g;
- if ($makemodel =~ /^\s*IJP/i) {
- $makemodel = "Sony $makemodel";
- } else {
- $makemodel = "HP $makemodel";
- }
- }
- # Configure scanning with SANE on the MF device
- if ($makemodel !~ /HP\s+PhotoSmart/i &&
- $makemodel !~ /HP\s+LaserJet\s+2200/i &&
- $makemodel !~ /HP\s+(DeskJet|dj)\s*450/i) {
- # Install SANE
- if (!$::testing &&
- (!files_exist("/usr/bin/scanimage",
- #"/usr/bin/xscanimage",
- "/etc/sane.d/dll.conf",
- "/usr/$lib/sane/libsane-hpoj.so.1") ||
- (!files_exist(qw(/usr/bin/xsane)) &&
- !files_exist(qw(/usr/bin/kooka)) &&
- ($::isInstall ||
- !$in->do_pkgs->is_installed('scanner-gui'))))) {
- undef $w;
- $w = $in->wait_message
- (N("Printerdrake"),
- N("Installing SANE packages..."))
- if !$printer->{noninteractive};
- $::noX
- or $in->do_pkgs->install('sane-backends',
- #'sane-frontends',
- ($::isInstall ?
- 'xsane' :
- 'scanner-gui'),
- "${lib}sane-hpoj1")
- or do {
- $in->ask_warn(N("Warning"),
- N("Could not install the %s packages!",
- "SANE") . " " .
- N("Scanning on the %s will not be possible.",
- $makemodel));
- };
- }
- # Configure the HPOJ SANE backend
- printer::main::config_sane('hpoj');
- }
- # Configure photo card access with mtools and MToolsFM
- if (($makemodel =~ /HP\s+PhotoSmart/i ||
- $makemodel =~ /HP\s+PSC\s*9[05]0/i ||
- $makemodel =~ /HP\s+PSC\s*13[15]\d/i ||
- $makemodel =~ /HP\s+PSC\s*161\d/i ||
- $makemodel =~ /HP\s+PSC\s*2\d\d\d/i ||
- $makemodel =~ /HP\s+OfficeJet\s+D\s*1[45]5/i ||
- $makemodel =~ /HP\s+OfficeJet\s+71[34]0/i ||
- $makemodel =~ /HP\s+OfficeJet\s+91\d\d/i ||
- $makemodel =~ /HP\s+(DeskJet|dj)\s*450/i) &&
- $makemodel !~ /HP\s+PhotoSmart\s+7150/i) {
- # Install mtools and MToolsFM
- if (!$::testing &&
- !files_exist(qw(/usr/bin/mdir
- /usr/bin/mcopy
- /usr/bin/MToolsFM
- ))) {
- undef $w;
- $w = $in->wait_message
- (N("Printerdrake"),
- N("Installing mtools packages..."))
- if !$printer->{noninteractive};
- $::noX
- or $in->do_pkgs->install('mtools', 'mtoolsfm')
- or do {
- $in->ask_warn(N("Warning"),
- N("Could not install the %s packages!",
- "Mtools") . " " .
- N("Photo memory card access on the %s will not be possible.",
- $makemodel));
- };
- }
- # Configure mtools/MToolsFM for photo card access
- printer::main::config_photocard();
- }
-
- if (!$printer->{noninteractive} && !$::noX) {
- my $text = "";
- # Inform user about how to scan with his MF device
- $text = scanner_help($makemodel, "ptal://$ptaldevice");
- if ($text) {
- undef $w;
- local $::isWizard = 0;
- $in->ask_warn
- (N("Scanning on your HP multi-function device"),
- $text);
- }
- # Inform user about how to access photo cards with his
- # MF device
- $text = photocard_help($makemodel, "ptal://$ptaldevice");
- if ($text) {
- undef $w;
- local $::isWizard = 0;
- $in->ask_warn(N("Photo memory card access on your HP multi-function device"),
- $text);
- }
- }
- # make the DeviceURI from $ptaldevice.
- $printer->{currentqueue}{connect} =
- "ptal://" . $ptaldevice;
- } else {
- # make the DeviceURI from $device.
- $printer->{currentqueue}{connect} = $device;
- }
- } else {
- # make the DeviceURI from $device.
- $printer->{currentqueue}{connect} = $device;
- }
+ # make the DeviceURI from $device.
+ $printer->{currentqueue}{connect} = $device;
$w = $in->wait_message(
N("Printerdrake"),
N("Configuring device..."))
@@ -2791,7 +2678,7 @@ sub setup_common {
N("Making printer port available for CUPS..."))
if !$printer->{noninteractive};
printer::main::assure_device_is_available_for_cups(
- $hplipsocket || $hplipdevice || $ptaldevice || $device);
+ $hplipsocket || $hplipdevice || $device);
}
}
@@ -2832,7 +2719,7 @@ sub setup_common {
$descr =~ s/ /|/;
} elsif ($automodel) {
$descr = $automodel;
- if ($descr !~ /$searchunknown/) {
+ if ($descr !~ /$searchunknown/i) {
$descr =~ s/ /|/;
} else {
$descr = "|$searchunknown";
@@ -3383,7 +3270,8 @@ sub get_printer_info {
delete($printer->{currentqueue}{ppd});
$printer->{currentqueue}{foomatic} = 0;
# Read info from printer database
- foreach (qw(printer ppd driver make model)) { #- copy some parameter, shorter that way...
+ foreach (qw(printer ppd driver make model)) {
+ #- copy some parameters, shorter that way...
$printer->{currentqueue}{$_} = $printer::main::thedb{$printer->{DBENTRY}}{$_};
}
$newdriver = 1;
@@ -4090,7 +3978,7 @@ sub printer_help {
my $photocard = "";
my $hp11000fw = "";
if ($printer->{configured}{$queue}) {
- if ($printer->{configured}{$queue}{queuedata}{model} eq "Unknown model" ||
+ if ($printer->{configured}{$queue}{queuedata}{model} eq N("Unknown model") ||
$printer->{configured}{$queue}{queuedata}{model} eq N("Raw printer")) {
$raw = 1;
}
@@ -4102,22 +3990,6 @@ sub printer_help {
if ($hplip) {
$hplip = "\n\n$hplip\n\n";
}
- # Information about scanning with HP's multi-function devices
- $scanning = scanner_help(
- $printer->{configured}{$queue}{queuedata}{make} . " " .
- $printer->{configured}{$queue}{queuedata}{model},
- $printer->{configured}{$queue}{queuedata}{connect});
- if ($scanning) {
- $scanning = "\n\n$scanning\n\n";
- }
- # Information about photo card access with HP's multi-function devices
- $photocard = photocard_help(
- $printer->{configured}{$queue}{queuedata}{make} . " " .
- $printer->{configured}{$queue}{queuedata}{model},
- $printer->{configured}{$queue}{queuedata}{connect});
- if ($photocard) {
- $photocard = "\n\n$photocard\n\n";
- }
if ($printer->{configured}{$queue}{queuedata}{printer} eq
'HP-LaserJet_1000') {
$hp11000fw = "\n\n$hp1000fwtext\n";
@@ -4139,11 +4011,11 @@ The \"%s\" command also allows to modify the option settings for a particular pr
(!$cupsremote ?
N("To know about the options available for the current printer read either the list shown below or click on the \"Print option list\" button.%s%s%s
-", $hplip, $scanning . $photocard, $hp11000fw) . printer::main::help_output($printer, 'cups') :
- $hplip . $scanning . $photocard . $hp11000fw .
+", $hplip, $hp11000fw) . printer::main::help_output($printer, 'cups') :
+ $hplip . $hp11000fw .
N("Here is a list of the available printing options for the current printer:
-") . printer::main::help_output($printer, 'cups')) : $hplip . $scanning . $photocard . $hp11000fw);
+") . printer::main::help_output($printer, 'cups')) : $hplip . $hp11000fw);
} elsif ($spooler eq "lprng") {
$dialogtext =
N("To print a file from the command line (terminal window) use the command \"%s <file>\".
@@ -4153,7 +4025,7 @@ N("This command you can also use in the \"Printing command\" field of the printi
(!$raw ?
N("
The \"%s\" command also allows to modify the option settings for a particular printing job. Simply add the desired settings to the command line, e. g. \"%s <file>\". ", "lpr", ($queue ne $default ? "lpr -P $queue -Z option=setting -Z switch" : "lpr -Z option=setting -Z switch")) .
-N("To get a list of the options available for the current printer click on the \"Print option list\" button.") . $hplip . $scanning . $photocard . $hp11000fw : $hplip . $scanning . $photocard . $hp11000fw);
+N("To get a list of the options available for the current printer click on the \"Print option list\" button.") . $hplip . $hp11000fw : $hplip . $hp11000fw);
} elsif ($spooler eq "lpd") {
$dialogtext =
N("To print a file from the command line (terminal window) use the command \"%s <file>\".
@@ -4163,7 +4035,7 @@ N("This command you can also use in the \"Printing command\" field of the printi
(!$raw ?
N("
The \"%s\" command also allows to modify the option settings for a particular printing job. Simply add the desired settings to the command line, e. g. \"%s <file>\". ", "lpr", ($queue ne $default ? "lpr -P $queue -o option=setting -o switch" : "lpr -o option=setting -o switch")) .
-N("To get a list of the options available for the current printer click on the \"Print option list\" button.") . $hplip . $scanning . $photocard . $hp11000fw : $hplip . $scanning . $photocard . $hp11000fw);
+N("To get a list of the options available for the current printer click on the \"Print option list\" button.") . $hplip . $hp11000fw : $hplip . $hp11000fw);
} elsif ($spooler eq "pdq") {
$dialogtext =
N("To print a file from the command line (terminal window) use the command \"%s <file>\" or \"%s <file>\".
@@ -4179,18 +4051,12 @@ The \"%s\" and \"%s\" commands also allow to modify the option settings for a pa
", "pdq", "lpr", ($queue ne $default ? "pdq -P $queue -aoption=setting -oswitch" : "pdq -aoption=setting -oswitch")) .
N("To know about the options available for the current printer read either the list shown below or click on the \"Print option list\" button.%s%s%s
-", $hplip, $scanning . $photocard, $hp11000fw) . printer::main::help_output($printer, 'pdq') :
- $hplip . $scanning . $photocard . $hp11000fw);
+", $hplip, $hp11000fw) . printer::main::help_output($printer, 'pdq') :
+ $hplip . $hp11000fw);
}
- my $windowtitle = ($scanning ?
- ($photocard ?
- N("Printing/Scanning/Photo Cards on \"%s\"", $queue) :
- N("Printing/Scanning on \"%s\"", $queue)) :
- ($photocard ?
- N("Printing/Photo Card Access on \"%s\"", $queue) :
- ($hplip ?
+ my $windowtitle = ($hplip ?
N("Using/Maintaining the printer \"%s\"", $queue) :
- N("Printing on the printer \"%s\"", $queue))));
+ N("Printing on the printer \"%s\"", $queue));
if (!$raw && !$cupsremote) {
my $choice;
while ($choice ne N("Close")) {
@@ -4200,7 +4066,7 @@ N("To know about the options available for the current printer read either the l
N("Close"));
if ($choice ne N("Close")) {
my $_w = $in->wait_message(N("Printerdrake"),
- N("Printing test page(s)..."));
+ N("Printing option list..."));
printer::main::print_optionlist($printer);
}
}
@@ -4244,49 +4110,6 @@ sub hplip_help {
return $text;
}
-sub scanner_help {
- my ($makemodel, $deviceuri) = @_;
- if ($deviceuri =~ m!^ptal://?(.*?)$!) {
- my $ptaldevice = $1;
- if ($makemodel !~ /HP\s+PhotoSmart/i &&
- $makemodel !~ /HP\s+LaserJet\s+2200/i &&
- $makemodel !~ /HP\s+(DeskJet|dj)\s*450/i) {
- # Models with built-in scanner
- return N("Your multi-function device was configured automatically to be able to scan. Now you can scan with \"scanimage\" (\"scanimage -d hp:%s\" to specify the scanner when you have more than one) from the command line or with the graphical interfaces \"xscanimage\" or \"xsane\". If you are using the GIMP, you can also scan by choosing the appropriate point in the \"File\"/\"Acquire\" menu. Call also \"man scanimage\" on the command line to get more information.
-
-You do not need to run \"scannerdrake\" for setting up scanning on this device, you only need to use \"scannerdrake\" if you want to share the scanner on the network.",
- $ptaldevice);
- } else {
- # Scanner-less models
- return "";
- }
- }
-}
-
-sub photocard_help {
- my ($makemodel, $deviceuri) = @_;
- if ($deviceuri =~ m!^ptal://?(.*?)$!) {
- my $ptaldevice = $1;
- if (($makemodel =~ /HP\s+PhotoSmart/i ||
- $makemodel =~ /HP\s+PSC\s*9[05]0/i ||
- $makemodel =~ /HP\s+PSC\s*13[15]\d/i ||
- $makemodel =~ /HP\s+PSC\s*161\d/i ||
- $makemodel =~ /HP\s+PSC\s*2\d\d\d/i ||
- $makemodel =~ /HP\s+OfficeJet\s+D\s*1[45]5/i ||
- $makemodel =~ /HP\s+OfficeJet\s+71[34]0/i ||
- $makemodel =~ /HP\s+OfficeJet\s+91\d\d/i ||
- $makemodel =~ /HP\s+(DeskJet|dj)\s*450/i) &&
- $makemodel !~ /HP\s+PhotoSmart\s+7150/i) {
- # Models with built-in photo card drives
- return N("Your printer was configured automatically to give you access to the photo card drives from your PC. Now you can access your photo cards using the graphical program \"MtoolsFM\" (Menu: \"Applications\" -> \"File tools\" -> \"MTools File Manager\") or the command line utilities \"mtools\" (enter \"man mtools\" on the command line for more info). You find the card's file system under the drive letter \"p:\", or subsequent drive letters when you have more than one HP printer with photo card drives. In \"MtoolsFM\" you can switch between drive letters with the field at the upper-right corners of the file lists.",
- $ptaldevice);
- } else {
- # Photo-card-drive-less models
- return "";
- }
- }
-}
-
sub copy_queues_from {
my ($printer, $in, $oldspooler) = @_;
@@ -5491,9 +5314,7 @@ What do you want to modify on this printer?",
($printer->{expert} ?
N("Printer manufacturer, model, driver") :
N("Printer manufacturer, model")),
- if_($printer->{configured}{$queue}{queuedata}{make} ne "" &&
- $printer->{configured}{$queue}{queuedata}{model} ne N("Unknown model") &&
- $printer->{configured}{$queue}{queuedata}{model} ne N("Raw printer"),
+ if_($printer->{configured}{$queue}{args},
N("Printer options"))) : ()),
if_($queue ne $printer->{DEFAULT},
N("Set this printer as the default")),
diff --git a/perl-install/standalone/printerdrake b/perl-install/standalone/printerdrake
index 7bc4e1387..bb01d456f 100755
--- a/perl-install/standalone/printerdrake
+++ b/perl-install/standalone/printerdrake
@@ -375,7 +375,7 @@ sub Refresh {
$refreshing = 1;
my ($strfilt) = @_;
my $selection = get_selection();
- printer::services::wait_for_cups();
+ printer::services::wait_for_cups() if ($printer->{SPOOLER} eq "cups");
my @printers;
defined $printer and @printers = printer::cups::lpstat_lpv();
RefreshLocalPrintersFull($strfilt, @printers);