diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2003-03-13 00:55:20 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2003-03-13 00:55:20 +0000 |
commit | 1dfd8181df68cbc22441d6938f5b9518903b593b (patch) | |
tree | 43a5b20bc71c017c37aa9ad11404a376fe04307a | |
parent | ec3a2f853146c39f0c1385c0dfec9d425357f3ff (diff) | |
download | drakx-1dfd8181df68cbc22441d6938f5b9518903b593b.tar drakx-1dfd8181df68cbc22441d6938f5b9518903b593b.tar.gz drakx-1dfd8181df68cbc22441d6938f5b9518903b593b.tar.bz2 drakx-1dfd8181df68cbc22441d6938f5b9518903b593b.tar.xz drakx-1dfd8181df68cbc22441d6938f5b9518903b593b.zip |
Bug fixes:
- SHOWSTOPPER: SCSI scanners were never recognized as already
configured, the user was always asked whether he wants to configure
them. Problem was that device files are symlinks.
- Made most ISDN and ADSL devices not being considered as a scanner by
Scannerdrake, SANE does not support internet scanners.
-rwxr-xr-x | perl-install/scanner.pm | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/perl-install/scanner.pm b/perl-install/scanner.pm index 3c8f60a8c..88c607970 100755 --- a/perl-install/scanner.pm +++ b/perl-install/scanner.pm @@ -150,7 +150,7 @@ sub detect { } # The Alcatel Speed Touch internet scanner is not supported by # SANE - next if $description =~ /Alcatel.*Speed.*Touch|Camera/i; + next if $description =~ /Alcatel.*Speed.*Touch|Camera|ISDN|ADSL/i; # Extract port $line =~ /\s+(\S+)\s*$/; $port = $1; @@ -190,11 +190,14 @@ sub detect { if (@configured) { # Remove scanners which are already working foreach my $d (@res) { - my $searchport1 = handle_configs::searchstr($d->{port}); - my $searchport2 = handle_configs::searchstr($d->{port2}); + my $searchport1 = + handle_configs::searchstr(resolve_symlinks($d->{port})); + my $searchport2 = + handle_configs::searchstr(resolve_symlinks($d->{port2})); foreach my $c (@configured) { - if ($c->{port} =~ /$searchport1$/ || - $searchport2 && $c->{port} =~ /$searchport2$/) { + my $currentport = resolve_symlinks($c->{port}); + if ($currentport =~ /$searchport1$/ || + $searchport2 && $currentport =~ /$searchport2$/) { $d->{configured} = 1; last; } @@ -205,6 +208,35 @@ sub detect { return @res; } +sub resolve_symlinks { + + # Check if a given file (either the pure filename or in a SANE device + # string as "<prefix>:<file>") is a symlink, if so expand the link. + # If the new file name is a link, expand again, until finding the + # physical file. + my ($file) = @_; + my $prefix = ""; + if ($file =~ m!^([^/]*)(/.*)$!) { + $prefix = $1; + $file = $2; + } else { + return $file; + } + while (1) { + my $ls = `ls -l $file`; + if ($ls =~ m!\s($file)\s*\->\s*(\S+)\s*$!) { + my $target = $2; + if (($target !~ m!^/!) && ($file =~ m!^(.*)/[^/]+$!)) { + $target = "$1/$target"; + } + $file = $target; + } else { + last; + } + } + return $prefix . $file; +} + sub get_usb_ids_for_port { my ($port) = @_; local *DETECT; |