summaryrefslogtreecommitdiffstats
path: root/perl-install/printer/detect.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2005-09-06 11:04:48 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2005-09-06 11:04:48 +0000
commit000fb05891af910e6830a47115c05531956de597 (patch)
treeb31450d1d7d0bc5983261f5922c73514850be5b6 /perl-install/printer/detect.pm
parentbf34b09d19da14b3df5f60ea93e72fc3f4d1af50 (diff)
downloaddrakx-backup-do-not-use-000fb05891af910e6830a47115c05531956de597.tar
drakx-backup-do-not-use-000fb05891af910e6830a47115c05531956de597.tar.gz
drakx-backup-do-not-use-000fb05891af910e6830a47115c05531956de597.tar.bz2
drakx-backup-do-not-use-000fb05891af910e6830a47115c05531956de597.tar.xz
drakx-backup-do-not-use-000fb05891af910e6830a47115c05531956de597.zip
- When auto-detecting network printer models via SNMP, guess
manufacturer name from model name
Diffstat (limited to 'perl-install/printer/detect.pm')
-rw-r--r--perl-install/printer/detect.pm38
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 "";
}