From 8c30c712a136069a6450e447f191daa229aacf84 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 8 Feb 2005 14:41:46 +0000 Subject: - Prevented restarting of HPOJ and reloading the parallel port kernel modules when printerdrake's queue generator is called by the hotplug script. --- perl-install/printer/detect.pm | 8 ++++++-- perl-install/printer/printerdrake.pm | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'perl-install') diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm index c1f4f3aaa..a117604cb 100644 --- a/perl-install/printer/detect.pm +++ b/perl-install/printer/detect.pm @@ -8,8 +8,12 @@ use printer::data; sub local_detect() { modules::any_conf->read->get_probeall("usb-interface") and eval { modules::load($usbprintermodule) }; - eval { modules::unload(qw(lp parport_pc parport)) }; #- on kernel 2.4 parport has to be unloaded to probe again - eval { modules::load(qw(parport_pc lp)) }; #- take care as not available on 2.4 kernel (silent error). + # Reload parallel port modules only when we were not called from the + # hotplug script, to avoid the hotplug script running recursively + if (!$::noX) { + eval { modules::unload(qw(lp parport_pc parport)) }; #- on kernel 2.4 parport has to be unloaded to probe again + eval { modules::load(qw(parport_pc lp)) }; #- take care as not available on 2.4 kernel (silent error). + } whatPrinter(); } diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index febb8b5e1..2e38748ed 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -743,16 +743,19 @@ sub configure_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. + # 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"); + services::stop("hpoj") if !$::noX; # Auto-detect local printers my @autodetected = printer::detect::local_detect(); # 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"); + services::start("hpoj") if !$::noX; # No printer found? So no need of new queues. return 1 if !@autodetected; -- cgit v1.2.1