From 7dbc6f56bb79b7b1ba0d4ec60469d39f1fbeff8f Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 26 Mar 2002 15:16:17 +0000 Subject: Fixed several problems related to HP multi-function devices: - Parallel multi-function devices worked only on the first (onboard) parallel port. - HP LaserJet 2200 needs HPOJ for printing via USB. - For the HP OfficeJet D series the scanning instructions were not shown. - HPOJ does not work with HP PhotoSmart 10xx, 11xx, and 12xx. --- perl-install/printer.pm | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'perl-install/printer.pm') diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 64cfdcfa4..6d7a9302a 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -1464,14 +1464,16 @@ sub configure_hpoj { # Check if the device is really an HP multi-function device stop_service("hpoj"); my $bus; + my $address_arg = ""; if ($device =~ /usb/) { $bus = "usb"; } else { $bus = "par"; + $address_arg = parport_addr($device); } run_program::rooted($prefix, "ptal-mlcd", "$bus:probe", "-device", - "$device"); + "$device", split(' ',$address_arg)); $device_ok = 0; local *F; if (open F, ($::testing ? "$prefix" : "chroot $prefix/ ") . "/usr/bin/ptal-devid mlc:$bus:probe |") { @@ -1564,16 +1566,7 @@ sub configure_hpoj { # auto-detect the parallel port addresses $device =~ m!^/dev/lp(\d+)$!; my $portnumber = $1; - my $parport_addresses = - `cat /proc/sys/dev/parport/parport$portnumber/base-addr`; - my $address_arg; - if ($parport_addresses =~ /^\s*(\d+)\s+(\d+)\s*$/) { - $address_arg = sprintf(" -base 0x%x -basehigh 0x%x", $1, $2); - } elsif ($parport_addresses =~ /^\s*(\d+)\s*$/) { - $address_arg = sprintf(" -base 0x%x", $1); - } else { - $address_arg = ""; - } + my $address_arg = parport_addr($device); $entry = "\nptal-mlcd par:$portnumber -device $device$address_arg \$PTAL_MLCD_CMDLINE_APPEND\nptal-printd mlc:par:$portnumber \$PTAL_PRINTD_CMDLINE_APPEND\n"; $ptaldevice = "mlc:par:$portnumber"; } @@ -1589,6 +1582,24 @@ sub configure_hpoj { return $ptaldevice; } +sub parport_addr{ + # auto-detect the parallel port addresses + my ($device) = @_; + $device =~ m!^/dev/lp(\d+)$!; + my $portnumber = $1; + my $parport_addresses = + `cat /proc/sys/dev/parport/parport$portnumber/base-addr`; + my $address_arg; + if ($parport_addresses =~ /^\s*(\d+)\s+(\d+)\s*$/) { + $address_arg = sprintf(" -base 0x%x -basehigh 0x%x", $1, $2); + } elsif ($parport_addresses =~ /^\s*(\d+)\s*$/) { + $address_arg = sprintf(" -base 0x%x", $1); + } else { + $address_arg = ""; + } + return $address_arg; +} + sub config_sane { my ($ptaldevice) = @_; -- cgit v1.2.1