summaryrefslogtreecommitdiffstats
path: root/perl-install/scanner.pm
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2003-02-04 22:38:12 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2003-02-04 22:38:12 +0000
commit24654ac490e845bb60d1a8e250915614bd8ba9c9 (patch)
treedd87d0fe8125b51bbafdeebcda410063e6664255 /perl-install/scanner.pm
parent51bc080ed8558d2f0ea32c977583711f07d29d6a (diff)
downloaddrakx-backup-do-not-use-24654ac490e845bb60d1a8e250915614bd8ba9c9.tar
drakx-backup-do-not-use-24654ac490e845bb60d1a8e250915614bd8ba9c9.tar.gz
drakx-backup-do-not-use-24654ac490e845bb60d1a8e250915614bd8ba9c9.tar.bz2
drakx-backup-do-not-use-24654ac490e845bb60d1a8e250915614bd8ba9c9.tar.xz
drakx-backup-do-not-use-24654ac490e845bb60d1a8e250915614bd8ba9c9.zip
- Fixed Titi's newly introduced bugs. Now scannerdrake works at least as
under Mandrake 9.0. - Fixed bug of automatic configuration also being done if one opts for manual configuration of an auto-detected scanner. - Made scannerdrake editing the SANE config files instead of replacing them by the config lines from the DB (or emptying them when no config lines are given in the DB).
Diffstat (limited to 'perl-install/scanner.pm')
-rwxr-xr-xperl-install/scanner.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm
index f38d59ce9..e5d8bb48d 100755
--- a/perl-install/scanner.pm
+++ b/perl-install/scanner.pm
@@ -28,39 +28,46 @@ use standalone;
use common;
use detect_devices;
use log;
-
+use handle_configs;
my $_sanedir = "$::prefix/etc/sane.d";
my $_scannerDBdir = "$::prefix$ENV{SHARE_PATH}/ldetect-lst";
-my $scannerDB = readScannerDB("$_scannerDBdir/ScannerDB");
+$scannerDB = readScannerDB("$_scannerDBdir/ScannerDB");
sub confScanner {
my ($model, $port) = @_;
$port ||= detect_devices::dev_is_devfs() ? "$::prefix/dev/usb/scanner0" : "$::prefix/dev/scanner";
my $a = $scannerDB->{$model}{server};
#print "file:[$a]\t[$model]\t[$port]\n| ", (join "\n| ", @{$scannerDB->{$model}{lines}}),"\n";
- output("$_sanedir/$a.conf", (join "\n", @{$scannerDB->{$model}{lines}}));
- substInFile { s/\$DEVICE/$port/ } "$_sanedir/$a.conf";
+ my @driverconf = cat_("$_sanedir/$a.conf");
+ my @configlines = @{$scannerDB->{$model}{lines}};
+ (s/\$DEVICE/$port/) foreach @configlines;
+ (handle_configs::set_directive(\@driverconf, $_)) foreach @configlines;
+ output("$_sanedir/$a.conf", @driverconf);
add2dll($a);
}
sub add2dll {
return if member($_[0], chomp_(cat_("$_sanedir/dll.conf")));
- append_to_file("$_sanedir/dll.conf", "$_[0]\n");
+ my @dllconf = cat_("$_sanedir/dll.conf");
+ handle_configs::add_directive(\@dllconf, $_[0]);
+ output("$_sanedir/dll.conf", @dllconf);
}
sub detect {
my ($i, @res) = 0;
foreach (grep { $_->{driver} =~ /scanner/ } detect_devices::usb_probe()) {
+ use Data::Dumper;
+ print Dumper ($_);
#my ($manufacturer, $model) = split '\|', $_->{description};
#$_->{description} =~ s/Hewlett[-\s_]Packard/HP/;
$_->{description} =~ s/Seiko\s+Epson/Epson/i;
- push @res, { port => "/dev/usb/scanner$i", val => { #CLASS => 'SCANNER',
- #MODEL => $model,
- #MANUFACTURER => $manufacturer,
+ push @res, { port => "/dev/usb/scanner$i", val => { CLASS => 'SCANNER',
+ MODEL => $model,
+ MANUFACTURER => $manufacturer,
DESCRIPTION => $_->{description},
- #id => $_->{id},
- #vendor => $_->{vendor},
+ id => $_->{id},
+ vendor => $_->{vendor},
} };
++$i;
}