From 8e98926b7606d777e421b54792466c8ffbf7ba8d Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 29 Mar 2005 22:41:22 +0000 Subject: - Let IOCTL detection of an USB printer not get accepted if there is no relevant item at all in the ID string, to avoid mis-detection of some USB keyboards as printers. --- perl-install/printer/detect.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'perl-install/printer') diff --git a/perl-install/printer/detect.pm b/perl-install/printer/detect.pm index 606021eda..065ac23e1 100644 --- a/perl-install/printer/detect.pm +++ b/perl-install/printer/detect.pm @@ -112,6 +112,9 @@ sub whatUsbport() { my ($manufacturer, $model, $serialnumber, $description, $commandset) = ("", "", "", "", ""); my ($sku); + if ($idstr =~ /CLS:([^;]+);/ || $idstr =~ /CLASS:([^;]+);/) { + $itemfound = 1; + } if ($idstr =~ /MFG:([^;]+);/ || $idstr =~ /MANUFACTURER:([^;]+);/) { $manufacturer = $1; $manufacturer =~ s/Hewlett[-\s_]Packard/HP/; @@ -145,8 +148,8 @@ sub whatUsbport() { $itemfound = 1; } # Nothing found? Try again if not in the third attempt, - # in the third attempt always accept. - next if !$itemfound && $j < 3; + # after the third attempt give up + next if !$itemfound; # Was there a manufacturer and a model in the string? if ($manufacturer eq "" || $model eq "") { $manufacturer = ""; -- cgit v1.2.1