summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-09-14 05:12:06 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-09-14 05:12:06 +0000
commitb253118bd77ea156fb8d73b52960948a49a7b102 (patch)
treef6fd873eb83889e25ff3edc60bb0ae974280a1aa /perl-install
parentf612082b6ec2c25f805824e8c042ad8dae811ad2 (diff)
downloaddrakx-b253118bd77ea156fb8d73b52960948a49a7b102.tar
drakx-b253118bd77ea156fb8d73b52960948a49a7b102.tar.gz
drakx-b253118bd77ea156fb8d73b52960948a49a7b102.tar.bz2
drakx-b253118bd77ea156fb8d73b52960948a49a7b102.tar.xz
drakx-b253118bd77ea156fb8d73b52960948a49a7b102.zip
(detect) blacklist usb devices that have a driver and that are wrongly
detected by sane-find-scanner (scanners are managed by scanner.o module in 2.4.x and through libusb on 2.6.x)
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/scanner.pm19
1 files changed, 17 insertions, 2 deletions
diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm
index bfb745d77..433191b97 100755
--- a/perl-install/scanner.pm
+++ b/perl-install/scanner.pm
@@ -257,10 +257,13 @@ sub detect {
my @res;
# Run "sane-find-scanner", this also detects USB scanners which only
# work with libusb.
+
+ my @devices = detect_devices::probeall();
+
local *DETECT;
open DETECT, "LC_ALL=C sane-find-scanner -q |";
while (my $line = <DETECT>) {
- my ($vendorid, $productid, $make, $model, $description, $port);
+ my ($vendorid, $productid, $make, $model, $description, $port, $driver);
if ($line =~ /^\s*found\s+USB\s+scanner/i) {
# Found an USB scanner
if ($line =~ /vendor=(0x[0-9a-f]+)[^0-9a-f\[]+[^\[]*\[([^\[\]]+)\].*prod(|uct)=(0x[0-9a-f]+)[^0-9a-f\[]+[^\[]*\[([^\[\]]+)\]/) {
@@ -276,6 +279,16 @@ sub detect {
$productid = $3;
}
if ($vendorid && $productid) {
+ my ($vendor) = ($vendorid =~ /0x([0-9a-f]+)/);
+ my ($id) = ($productid =~ /0x([0-9a-f]+)/);
+ my ($device) = grep { sprintf("%04x", $_->{vendor}) eq $vendor && sprintf("%04x", $_->{id}) eq $id } @devices;
+
+ if ($device) {
+ $driver = $device->{driver}
+ } else {
+ warn "i failled to lookupp $vendorid && $productid";
+ }
+
# We have vendor and product ID, look up the scanner in
# the usbtable
foreach my $entry (cat_("$scannerDBdir/usbtable")) {
@@ -336,6 +349,7 @@ sub detect {
DESCRIPTION => $description,
id => $productid,
vendor => $vendorid,
+ driver => $driver,
}
};
}
@@ -358,7 +372,8 @@ sub detect {
}
@res = grep { ! $_->{configured} } @res;
}
- return @res;
+ # blacklist device that have a driver b/c of buggy sane-find-scanner:
+ return grep { member($_->{driver}, qw(scanner unknown)) } @res;
}
sub resolve_symlinks {