summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2003-09-09 22:12:30 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2003-09-09 22:12:30 +0000
commit3d88b87cbeab9dccd038fbf43b44c500872c9d0b (patch)
treebb983ab2a2814630245dc1ed797ada6a4dec3aa2 /perl-install
parent4d6b05ca4bb1443c0abb59279f137c24d4a9f408 (diff)
downloaddrakx-3d88b87cbeab9dccd038fbf43b44c500872c9d0b.tar
drakx-3d88b87cbeab9dccd038fbf43b44c500872c9d0b.tar.gz
drakx-3d88b87cbeab9dccd038fbf43b44c500872c9d0b.tar.bz2
drakx-3d88b87cbeab9dccd038fbf43b44c500872c9d0b.tar.xz
drakx-3d88b87cbeab9dccd038fbf43b44c500872c9d0b.zip
Fixed functions for scanner database (ScannerDB) generation.
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/scanner.pm22
1 files changed, 17 insertions, 5 deletions
diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm
index 13d867bff..e192ac42a 100755
--- a/perl-install/scanner.pm
+++ b/perl-install/scanner.pm
@@ -311,7 +311,7 @@ sub readScannerDB {
}
sub updateScannerDBfromUsbtable() {
- substInFile { s/END// } "ScannerDB";
+ substInFile { s/^END// } "ScannerDB";
my $to_add = "# generated from usbtable by scannerdrake\n";
foreach (cat_("$ENV{SHARE_PATH}/ldetect-lst/usbtable")) {
my ($vendor_id, $product_id, $mod, $name) = chomp_(split /\s/,$_,4);
@@ -330,7 +330,7 @@ sub updateScannerDBfromUsbtable() {
sub updateScannerDBfromSane {
my ($sanesrcdir) = @_;
- substInFile { s/END// } "ScannerDB";
+ substInFile { s/^END// } "ScannerDB";
my $to_add = "# generated from Sane by scannerdrake\n";
# for compat with our usbtable
@@ -366,7 +366,14 @@ sub updateScannerDBfromSane {
}
}
- foreach my $f (glob_("$sanesrcdir/doc/descriptions/*.desc"), glob_("$sanesrcdir/doc/descriptions-external/*.desc")) {
+ foreach my $ff (glob_("$sanesrcdir/doc/descriptions/*.desc"), glob_("$sanesrcdir/doc/descriptions-external/*.desc"), "UNSUPPORTED") {
+ my $f = $ff;
+ # unsupported.desc must be treated separately, as the list of
+ # unsupported scanners in SANE is out of date.
+ next if $f =~ /unsupported.desc$/;
+ # Treat unsupported.desc in the end
+ $f = "$sanesrcdir/doc/descriptions/unsupported.desc" if
+ ($f eq "UNSUPPORTED");
my $F = common::openFileMaybeCompressed($f);
$to_add .= "\n# from $f";
my ($lineno, $cmd, $val) = 0;
@@ -378,8 +385,13 @@ sub updateScannerDBfromSane {
unless ($name) { $name = $val; return }
$name = member($mfg, keys %$sane2DB) ?
ref($sane2DB->{$mfg}) ? $sane2DB->{$mfg}($name) : "$sane2DB->{ $mfg }|$name" : "$mfg|$name";
- if (0 && member($name, keys %$scanner::scannerDB)) {
- print "#[$name] already in ScannerDB!\n";
+ # When adding the unsupported scanner models, check
+ # whether the model is not already supported. To
+ # compare the names ignore upper/lower case.
+ my $searchname = quotemeta($name);
+ if (($backend =~ /unsupported/i) &&
+ ($to_add =~ /^NAME $searchname$/im)) {
+ $to_add .= "# $name already supported!\n";
} else {
# SANE bug: "snapscan" calls itself "SnapScan"
$backend =~ s/SnapScan/snapscan/g;