diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2005-09-28 12:37:49 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2005-09-28 12:37:49 +0000 |
commit | 03dfcc7850412b70707ce5fa10d3fd1fd224b870 (patch) | |
tree | ccaea07ea5034ba86d0a6867f2f88fdd39f9ddcd /perl-install/printer/detect.pm | |
parent | fece17faa5a81dfe813f4aad1c52d62ec08487e6 (diff) | |
download | drakx-03dfcc7850412b70707ce5fa10d3fd1fd224b870.tar drakx-03dfcc7850412b70707ce5fa10d3fd1fd224b870.tar.gz drakx-03dfcc7850412b70707ce5fa10d3fd1fd224b870.tar.bz2 drakx-03dfcc7850412b70707ce5fa10d3fd1fd224b870.tar.xz drakx-03dfcc7850412b70707ce5fa10d3fd1fd224b870.zip |
- Let parallel HP printers be set up with HPLIP.
- Removed HPOJ support (HPOJ obsolete, now completely replaced by HPLIP).
- Warn the user if an HP printer is connected via a port which is not
supported by HPLIP.
- Fixed printerdrake freezing when choosing a machine as remote CUPS
server (for daemon-less client) which does not exist or does not run
CUPS.
- Let network printer detection also work if the DNS is misconfigured.
- Let "Printer options" entry in printer editing menu only disapppear
if there are really no options (entry disappeared also for Sagem
MF3625 with empty manufacturer name in the PPD).
- Fixed raw queue being shown with "driver: PPD" and not "driver: raw".
- Do not use "Unknown model" and "Unknown Model", this somtimes broke
identifying a print queue as being for an unknown printer.
- Do not die if /usr/share/hplip/data/xml/models.xml (HPLIP printer
database) is missing, this allows creation of live distros without
HPLIP.
- Fixed loop of determining the HPLIP device URI for local printers in
the "printer::main::start_hplip()" function.
Diffstat (limited to 'perl-install/printer/detect.pm')
-rw-r--r-- | perl-install/printer/detect.pm | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm index b164595a5..1f6e06977 100644 --- a/perl-install/printer/detect.pm +++ b/perl-install/printer/detect.pm @@ -165,7 +165,7 @@ sub whatUsbport() { # Was there a manufacturer and a model in the string? if ($manufacturer eq "" || $model eq "") { $manufacturer = ""; - $model = N("Unknown Model"); + $model = N("Unknown model"); } # No description field? Make one out of manufacturer and model. if ($description eq "") { @@ -204,12 +204,13 @@ sub whatNetPrinter { return () if $#portstoscan < 0; my $portlist = join ",", @portstoscan; - + # Which hosts should be scanned? - # (Applying nmap to a whole network is very time-consuming, because nmap - # waits for a certain timeout period on non-existing hosts, so we get a - # lists of existing hosts by pinging the broadcast addresses for existing - # hosts and then scanning only them, which is much faster) + # (Applying nmap to a whole network is very time-consuming, + # because nmap waits for a certain timeout period on non-existing + # hosts, so we get a lists of existing hosts by pinging the + # broadcast addresses for existing hosts and then scanning only + # them, which is much faster) my @hostips = getIPsInLocalNetworks(); return () if $#hostips < 0; my $hostlist = join " ", @hostips; @@ -220,7 +221,7 @@ sub whatNetPrinter { open F, ($::testing ? "" : "chroot $::prefix/ ") . qq(/bin/sh -c "export LC_ALL=C; nmap -r -P0 --host_timeout $timeout --initial_rtt_timeout $irtimeout -p $portlist $hostlist" 2> /dev/null |) or return @res; - my ($host, $ip, $port, $modelinfo) = ("", "", "", ""); + my ($host, $ip, $port, $modelinfo, $namechecked) = ("", "", "", "", 0); while (my $line = <F>) { chomp $line; @@ -231,13 +232,23 @@ sub whatNetPrinter { $ip = $host if !$ip; $host = $ip if $host eq ""; $port = ""; + $namechecked = 0; undef $modelinfo; } elsif ($line =~ m!^\s*(\d+)/\S+\s+open\s+!i) { next if $ip eq ""; $port = $1; - + + # Check integrity of the host name (work around DNS problems + # by using IP if host name is broken) + if (!$namechecked && ($host ne $ip)) { + $namechecked = 1; # Do not check more than once + my $packedip = gethostbyname("$host"); + my ($a,$b,$c,$d) = unpack('C4',$packedip); + my $ipfromdns = sprintf("%d.%d.%d.%d", $a, $b, $c, $d); + $host = $ip if $ip ne $ipfromdns; + } # Now we have all info for one printer # Store this auto-detection result in the data structure @@ -249,7 +260,7 @@ sub whatNetPrinter { foreach my $share (@shares) { push @res, { port => "smb://$host/$share->{name}", val => { CLASS => 'PRINTER', - MODEL => N("Unknown Model"), + MODEL => N("Unknown model"), MANUFACTURER => "", DESCRIPTION => $share->{description}, SERIALNUMBER => "" @@ -484,7 +495,7 @@ sub getSNMPModel { open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . qq(/bin/sh -c "scli -v 1 -c 'show printer info' $host" 2> /dev/null |) or return { CLASS => 'PRINTER', - MODEL => N("Unknown Model"), + MODEL => N("Unknown model"), MANUFACTURER => "", DESCRIPTION => "", SERIALNUMBER => "" @@ -557,7 +568,7 @@ sub getSNMPModel { } # We couldn't determine a model - $model = N("Unknown Model") if $model eq ""; + $model = N("Unknown model") if $model eq ""; # Remove trailing spaces $manufacturer =~ s/(\S+)\s+$/$1/; |