From 000fb05891af910e6830a47115c05531956de597 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 6 Sep 2005 11:04:48 +0000 Subject: - When auto-detecting network printer models via SNMP, guess manufacturer name from model name --- perl-install/printer/detect.pm | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'perl-install/printer') diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm index 3b293b5de..97273a5ea 100644 --- a/perl-install/printer/detect.pm +++ b/perl-install/printer/detect.pm @@ -509,7 +509,43 @@ sub getSNMPModel { # Was there a manufacturer and a model in the output? # If not, get them from the description if ($manufacturer eq "" || $model eq "") { - if ($description =~ /^\s*(\S*)\s+(\S.*)$/) { + # Replace bad description + if ((length($description) < 5) && + (length($description) >= 5)) { + $description = $model; + } + # Guess manufacturer by model name + if ($description =~ + /^\s*(DeskJet|LaserJet|OfficeJet|PSC|PhotoSmart)\b/i) { + # HP printer + $manufacturer = "HP"; + $model = $description; + } elsif ($description =~ + /^\s*(Stylus|EPL|AcuLaser)\b/i) { + # Epson printer + $manufacturer = "Epson"; + $model = $description; + } elsif ($description =~ + /^\s*(Aficio)\b/i) { + # Ricoh printer + $manufacturer = "Ricoh"; + $model = $description; + } elsif ($description =~ + /^\s*(Optra|Color\s+JetPrinter)\b/i) { + # Lexmark printer + $manufacturer = "Lexmark"; + $model = $description; + } elsif ($description =~ + /^\s*(imageRunner|Pixma|Pixus|BJC|LBP)\b/i) { + # Canon printer + $manufacturer = "Canon"; + $model = $description; + } elsif ($description =~ + /^\s*(Phaser|DocuPrint|(Work|Document)\s*(Home|)Centre)\b/i) { + # Xerox printer + $manufacturer = "Xerox"; + $model = $description; + } elsif ($description =~ /^\s*(\S*)\s+(\S.*)$/) { $manufacturer = $1 if $manufacturer eq ""; $model = $2 if $model eq ""; } -- cgit v1.2.1