summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer/data.pm8
-rw-r--r--perl-install/printer/detect.pm3
-rw-r--r--perl-install/printer/main.pm9
3 files changed, 14 insertions, 6 deletions
diff --git a/perl-install/printer/data.pm b/perl-install/printer/data.pm
index 3a105496a..c5d1a385a 100644
--- a/perl-install/printer/data.pm
+++ b/perl-install/printer/data.pm
@@ -5,9 +5,15 @@ use common;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
-@EXPORT = qw(%spoolers %spooler_inv %shortspooler_inv);
+@EXPORT = qw(%spoolers %spooler_inv %shortspooler_inv
+ $kernelversion $usbprintermodule);
+our $kernelversion = `uname -r 2>/dev/null`;
+$kernelversion =~ s/^(\s*)(\d+\.\d+)(\..*)$/$2/;
+
+our $usbprintermodule = ($kernelversion eq '2.6' ? "usblp" : "printer");
+
our %spoolers = ('pdq' => {
'help' => "/usr/bin/pdq -h -P %s 2>&1 |",
'print_command' => 'lpr-pdq',
diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm
index e1583e311..28cb2a02c 100644
--- a/perl-install/printer/detect.pm
+++ b/perl-install/printer/detect.pm
@@ -4,9 +4,10 @@ use strict;
use common;
use modules;
use detect_devices;
+use printer::data;
sub local_detect() {
- modules::get_probeall("usb-interface") and eval { modules::load("printer") };
+ modules::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).
whatPrinter();
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm
index f856902a2..1fa15d916 100644
--- a/perl-install/printer/main.pm
+++ b/perl-install/printer/main.pm
@@ -2242,7 +2242,7 @@ sub configure_hpoj {
if ($bus ne "hpjd") {
if (!$libusb) {
# Start ptal-mlcd daemon for locally connected devices
- # (kernel mode with "printer" module for USB).
+ # (kernel mode with "printer"/"usblp" module for USB).
run_program::rooted($::prefix,
"ptal-mlcd", "$bus:probe",
"-device",
@@ -2253,9 +2253,9 @@ sub configure_hpoj {
# 4xxx)
my $usbdev = usbdevice($_->{val});
if (defined($usbdev)) {
- # Unload kernel module "printer"
+ # Unload kernel module "printer"/"usblp"
if (modules::get_probeall("usb-interface")) {
- eval(modules::unload("printer"));
+ eval(modules::unload($usbprintermodule));
$printermoduleunloaded = 1;
}
# Start ptal-mlcd
@@ -2312,7 +2312,8 @@ sub configure_hpoj {
}
close F;
}
- $printermoduleunloaded && eval(modules::load("printer"));
+ $printermoduleunloaded &&
+ eval(modules::load($usbprintermodule));
}
last if $device_ok;
}