diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2003-02-17 13:37:57 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2003-02-17 13:37:57 +0000 |
commit | ac022583859306b7b63c3773072337a9cec48256 (patch) | |
tree | b784b1f796ef07dc78376f588f56c72df93d20ce /perl-install/printer | |
parent | 567d2ff8b8e5c00682545034a2c9024817e37921 (diff) | |
download | drakx-ac022583859306b7b63c3773072337a9cec48256.tar drakx-ac022583859306b7b63c3773072337a9cec48256.tar.gz drakx-ac022583859306b7b63c3773072337a9cec48256.tar.bz2 drakx-ac022583859306b7b63c3773072337a9cec48256.tar.xz drakx-ac022583859306b7b63c3773072337a9cec48256.zip |
- Fixed bug of HP DeskJetb 990C being automatically installed even if
there is already a queue for it
- Fixed checking whether a device is known to CUPS
Diffstat (limited to 'perl-install/printer')
-rw-r--r-- | perl-install/printer/main.pm | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 84fbaf1aa..df75d892c 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -111,21 +111,25 @@ sub assure_device_is_available_for_cups { # file:/dev/null instead. Restart CUPS if necessary to assure that # CUPS knows the device. my ($device) = @_; + my $sdevice = handle_configs::searchstr($device); my ($result, $i); - for ($i = 0; $i < 3; $i++) { + # USB printers get special model-dependent URLs in "lpinfo -v" here + # checking is complicated, so we simply restart CUPS then and ready. + my $maxattempts = ($device =~ /usb/ ? 1 : 3); + for ($i = 0; $i < $maxattempts; $i++) { local *F; open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . "/bin/sh -c \"export LC_ALL=C; /usr/sbin/lpinfo -v\" |" or die "Could not run \"lpinfo\"!"; while (my $line = <F>) { - if ($line =~ /$device/) { # Found a line containing the device - # name, so CUPS knows it. + if ($line =~ /$sdevice/) { # Found a line containing the device + # name, so CUPS knows it. close F; return 1; } } close F; - $result = SIGHUP_daemon("cups"); + $result = printer::services::restart("cups"); } return $result; } @@ -1939,14 +1943,20 @@ sub autodetectionentry_for_uri { $serial =~ s/\%20/ /g; $make =~ s/Hewlett[-\s_]Packard/HP/; $make =~ s/HEWLETT[-\s_]PACKARD/HP/; + my $smake = handle_configs::searchstr($make); + my $smodel = handle_configs::searchstr($model); foreach my $p (@autodetected) { - next if (!$p->{val}{MANUFACTURER} or - ($p->{val}{MANUFACTURER} ne $make)); - next if (!$p->{val}{MODEL} or - ($p->{val}{MODEL} ne $model)); - next if ((!$p->{val}{SERIALNUMBER} and $serial) or - ($p->{val}{SERIALNUMBER} and !$serial) or - ($p->{val}{SERIALNUMBER} ne $serial)); + next if ((!$p->{val}{MANUFACTURER} or + ($p->{val}{MANUFACTURER} ne $make)) and + (!$p->{val}{DESCRIPTION} or + ($p->{val}{DESCRIPTION} !~ /^\s*$smake\s+/))); + next if ((!$p->{val}{MODEL} or + ($p->{val}{MODEL} ne $model)) and + (!$p->{val}{DESCRIPTION} or + ($p->{val}{DESCRIPTION} !~ /\s+$smodel\s*$/))); + next if ($serial and + (!$p->{val}{SERIALNUMBER} or + ($p->{val}{SERIALNUMBER} ne $serial))); return $p; } } |