From a9725a8b9f4ce81a9409fa405d1091e75b9f2afc Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Thu, 1 Sep 2005 19:29:15 +0000 Subject: - Do not display or use the description field of the IEEE-1284 ID string of a printer if it is shorter than 5 characters (Many HP printers have a 4-digit number there). --- perl-install/printer/printerdrake.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index 26a7ab402..46e5a2fdf 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -1452,7 +1452,8 @@ sub setup_local_autoscan { my @str; foreach my $p (@autodetected) { if (($p->{val}{DESCRIPTION}) || ($p->{val}{MODEL})) { - my $menustr = ($p->{val}{DESCRIPTION} ? + my $menustr = (defined($p->{val}{DESCRIPTION}) && + (length($p->{val}{DESCRIPTION}) > 5) ? $p->{val}{DESCRIPTION} : (($p->{val}{MANUFACTURER} ? ($p->{val}{MANUFACTURER} . " ") : ()) . @@ -2825,7 +2826,7 @@ sub setup_common { $descr = "$descrmake|$autosku"; } elsif ($automake && $automodel) { $descr = "$descrmake|$automodel"; - } elsif ($autodescr) { + } elsif ($autodescr && (length($autodescr) > 5)) { $descr = $autodescr; $descr =~ s/ /|/; } elsif ($automodel) { @@ -2930,7 +2931,7 @@ sub setup_common { # exact match or a match to the auto-detection ID string next if $matchlength >= 100; # Try to match the (human-readable) make and model of the - # Foomatic database or of thr PPD file + # Foomatic database or of the PPD file my $dbmakemodel; if ($printer->{expert}) { $dbmakemodel = $1 if $entry =~ m/^(.*)\|[^\|]*$/; -- cgit v1.2.1