From 830b8a584925f3152c7efac2009a69fe83f4c5f0 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Mon, 20 Jan 2003 02:48:22 +0000 Subject: Improve association of printers with database entries (preparation for non-interactive print queue generation): - Make use of device ID strings in the Foomatic database - Association of generic printers when PDL (PCL, PCL-XL, PostScript) could be auto-detected - Cleaned up entries from manufacturer-supplied PPDs for PostScript printers to try to match model names of Foomatic entries - Bug fixes on previous association mechanism --- perl-install/detect_devices.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 1aa420d79..fe5f484cd 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -640,8 +640,9 @@ sub whatUsbport() { # Remove non-printable characters $idstr =~ tr/[\x00-\x1f]/\./; # Extract the printer data from the ID string - my ($manufacturer, $model, $serialnumber, $description) = - ("", "", "", ""); + my ($manufacturer, $model, $serialnumber, $description, + $commandset, $sku) = + ("", "", "", "", ""); if ($idstr =~ /MFG:([^;]+);/ || $idstr =~ /MANUFACTURER:([^;]+);/) { $manufacturer = $1; $manufacturer =~ s/Hewlett[-\s_]Packard/HP/; @@ -653,7 +654,7 @@ sub whatUsbport() { $model ||= $1; } if ($idstr =~ /SKU:([^;]+);/) { - $model = $1; + $sku = $1; } if ($idstr =~ /DES:([^;]+);/ || $idstr =~ /DESCRIPTION:([^;]+);/) { $description = $1; @@ -663,6 +664,10 @@ sub whatUsbport() { if ($idstr =~ /SE*R*N:([^;]+);/) { $serialnumber = $1; } + if ($idstr =~ /CMD:([^;]+);/ || + $idstr =~ /COMMAND\s*SET:([^;]+);/) { + $commandset ||= $1; + } # Was there a manufacturer and a model in the string? if ($manufacturer eq "" || $model eq "") { next; @@ -677,7 +682,9 @@ sub whatUsbport() { MODEL => $model, MANUFACTURER => $manufacturer, DESCRIPTION => $description, - SERIALNUMBER => $serialnumber + SERIALNUMBER => $serialnumber, + 'COMMAND SET' => $commandset, + SKU => $sku } }; } @res; -- cgit v1.2.1