summaryrefslogtreecommitdiffstats
path: root/perl-install/printer/main.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2003-02-23 22:08:04 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2003-02-23 22:08:04 +0000
commit96664bd499e9696f79110d02885d9393611f5514 (patch)
tree9ecdd28fb75fb2f1637432a53d20a5c4c8a62940 /perl-install/printer/main.pm
parent373d8b2e3012afabb301b4ac8df49da2279bd401 (diff)
downloaddrakx-96664bd499e9696f79110d02885d9393611f5514.tar
drakx-96664bd499e9696f79110d02885d9393611f5514.tar.gz
drakx-96664bd499e9696f79110d02885d9393611f5514.tar.bz2
drakx-96664bd499e9696f79110d02885d9393611f5514.tar.xz
drakx-96664bd499e9696f79110d02885d9393611f5514.zip
Several bug fixes on printerdrake
- "BrowsePoll <IP>:<Port>" needs "Browsing On" in /etc/cups/cupsd.conf. - If the same printer model is once on the parallel port and second on USB, there was a new USB queue created on every start of Printerdrake. - Now CUPS is restarted whenever a new USB print queue is set up so that CUPS can provide the model-related USB URI. - Made sure that the default printer is defined and that it is an existing queue so that during installation printerdrake does not show a line only containing " (Default)" in the list of installed printers. - Cleaned up data structure after automatic queue generation.
Diffstat (limited to 'perl-install/printer/main.pm')
-rw-r--r--perl-install/printer/main.pm28
1 files changed, 20 insertions, 8 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index c63044413..996b4730d 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -115,7 +115,11 @@ sub assure_device_is_available_for_cups {
my ($result, $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);
+ if ($device =~ /usb/) {
+ $result = printer::services::restart("cups");
+ return 1;
+ }
+ my $maxattempts = 3;
for ($i = 0; $i < $maxattempts; $i++) {
local *F;
open F, ($::testing ? $::prefix : "chroot $::prefix/ ") .
@@ -1155,10 +1159,12 @@ sub read_cups_config {
handle_configs::read_unique_directive($printer->{cupsconfig}{cupsd_conf},
'BrowseOrder', 'deny,allow');
- # Keyword "BrowsePoll"
- @{$printer->{cupsconfig}{BrowsePoll}} =
- handle_configs::read_directives($printer->{cupsconfig}{cupsd_conf},
- 'BrowsePoll');
+ # Keyword "BrowsePoll" (needs "Browsing On")
+ if ($printer->{cupsconfig}{keys}{Browsing} !~ /off/i) {
+ @{$printer->{cupsconfig}{BrowsePoll}} =
+ handle_configs::read_directives($printer->{cupsconfig}{cupsd_conf},
+ 'BrowsePoll');
+ }
# Root location
@{$printer->{cupsconfig}{rootlocation}} =
@@ -1229,7 +1235,8 @@ sub write_cups_config {
'BrowseOrder Deny,Allow');
}
} else {
- if ($printer->{cupsconfig}{localprintersshared}) {
+ if (($printer->{cupsconfig}{localprintersshared}) ||
+ ($#{$printer->{cupsconfig}{BrowsePoll}} >= 0)) {
# Deny all broadcasts, but leave all "BrowseAllow" lines
# untouched
handle_configs::set_directive($printer->{cupsconfig}{cupsd_conf},
@@ -1237,8 +1244,9 @@ sub write_cups_config {
handle_configs::set_directive($printer->{cupsconfig}{cupsd_conf},
'BrowseOrder Allow,Deny');
} else {
- # We also do not share printers, so we turn browsing off to
- # do not need to deal with any addresses
+ # We also do not share printers, if we also do not
+ # "BrowsePoll", we turn browsing off to do not need to deal
+ # with any addresses
handle_configs::set_directive($printer->{cupsconfig}{cupsd_conf},
'Browsing Off');
}
@@ -1293,6 +1301,9 @@ sub write_cups_config {
'BrowsePoll ' .
join ("\nBrowsePoll ",
@{$printer->{cupsconfig}{BrowsePoll}}));
+ # "Browsing" must be on for "BrowsePoll" to work
+ handle_configs::set_directive($printer->{cupsconfig}{cupsd_conf},
+ 'Browsing On');
} else {
handle_configs::comment_directive($printer->{cupsconfig}{cupsd_conf},
'BrowsePoll');
@@ -1988,6 +1999,7 @@ sub autodetectionentry_for_uri {
my $smake = handle_configs::searchstr($make);
my $smodel = handle_configs::searchstr($model);
foreach my $p (@autodetected) {
+ next if $p->{port} !~ /usb/i;
next if ((!$p->{val}{MANUFACTURER} or
($p->{val}{MANUFACTURER} ne $make)) and
(!$p->{val}{DESCRIPTION} or