diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2005-09-06 11:04:48 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2005-09-06 11:04:48 +0000 |
commit | 000fb05891af910e6830a47115c05531956de597 (patch) | |
tree | b31450d1d7d0bc5983261f5922c73514850be5b6 /perl-install/printer | |
parent | bf34b09d19da14b3df5f60ea93e72fc3f4d1af50 (diff) | |
download | drakx-000fb05891af910e6830a47115c05531956de597.tar drakx-000fb05891af910e6830a47115c05531956de597.tar.gz drakx-000fb05891af910e6830a47115c05531956de597.tar.bz2 drakx-000fb05891af910e6830a47115c05531956de597.tar.xz drakx-000fb05891af910e6830a47115c05531956de597.zip |
- When auto-detecting network printer models via SNMP, guess
manufacturer name from model name
Diffstat (limited to 'perl-install/printer')
-rw-r--r-- | perl-install/printer/detect.pm | 38 |
1 files changed, 37 insertions, 1 deletions
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 ""; } |