summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2005-08-30 23:46:11 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2005-08-30 23:46:11 +0000
commit657b601f8818b63e63d45d80e6e2e78b6a98dbb0 (patch)
tree67d2bfa61ef6de1ecf867e8f5d59259250ea0b8c /perl-install
parent9ef99372008c98dc3224aa856f9c9dd239cffddb (diff)
downloaddrakx-657b601f8818b63e63d45d80e6e2e78b6a98dbb0.tar
drakx-657b601f8818b63e63d45d80e6e2e78b6a98dbb0.tar.gz
drakx-657b601f8818b63e63d45d80e6e2e78b6a98dbb0.tar.bz2
drakx-657b601f8818b63e63d45d80e6e2e78b6a98dbb0.tar.xz
drakx-657b601f8818b63e63d45d80e6e2e78b6a98dbb0.zip
- Support for HPLIP URIs with "?device=...", possible fix for bug
#18041 and bug #18053.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/main.pm19
1 files changed, 15 insertions, 4 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index a0ec64f84..cf70a6461 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -2443,9 +2443,15 @@ sub autodetectionentry_for_uri {
} elsif ($uri =~ m!^hp:/(usb|par|net)/!) {
# HP printer (controlled by HPLIP)
my $hplipdevice = $uri;
- $hplipdevice =~ m!^hp:/(usb|par|net)/(\S+?)(\?serial=(\S+)|)$!;
+ $hplipdevice =~ m!^hp:/(usb|par|net)/(\S+?)(\?(serial|device)=(\S+)|)$!;
my $model = $2;
- my $serial = $4;
+ my $serial = undef;
+ my $device = undef;
+ if ($4 eq 'serial') {
+ $serial = $5;
+ } elsif ($4 eq 'device') {
+ $device = $5;
+ }
$model =~ s/_/ /g;
foreach my $p (@autodetected) {
next if !$p->{val}{MODEL};
@@ -2459,6 +2465,7 @@ 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});
return $p;
}
} elsif ($uri =~ m!^ptal://?mlc:!) {
@@ -2754,14 +2761,18 @@ sub start_hplip {
'/bin/sh -c "export LC_ALL=C; /usr/lib/cups/backend/hp" |') or
die 'Could not run "/usr/lib/cups/backend/hp"!';
while (my $line = <$F>) {
- if (($line =~ m!^direct\s+(hp:/$bus/(\S+)\?serial=(\S+))\s+!) ||
+ if (($line =~ m!^direct\s+(hp:/$bus/(\S+?)\?serial=(\S+))\s+!) ||
+ ($line =~ m!^direct\s+(hp:/$bus/(\S+?)\?device=()(\S+))\s+!) ||
($line =~ m!^direct\s+(hp:/$bus/(\S+))\s+!)) {
my $uri = $1;
my $modelstr = $2;
my $serial = $3;
+ my $devicestr = $4;
if ((uc($modelstr) eq uc($hplipentry->{model})) &&
(!$serial ||
- (uc($serial) eq uc($a->{val}{SERIALNUMBER})))) {
+ (uc($serial) eq uc($a->{val}{SERIALNUMBER}))) &&
+ (!$devicestr ||
+ ($devicestr eq $device))) {
close $F;
return $uri;
}