 |



|
 |
I've had a somewhat hard time to get the USB scanner to work after I switched to 2.6.15. I have an Epson Perfection 3170 PHOTO scanner connected to my USB Port. First, connecting the scanner to the port, I saw the following in /var/log/messages:
-
Jan 19 14:36:18 linux kernel: usb 1-4: new high speed USB device using ehci_hcd and address 19
-
Jan 19 14:36:18 linux /etc/hotplug/usb.agent[25441]: need a device for this command
scanimage -L and sane-find-scanner were both able to see the scanner:
-
linux:/etc/hotplug/usb # scanimage -L
-
device `epson:libusb:001:019` is a Epson Perfection 3170 flatbed scanner
-
linux:/etc/hotplug/usb # sane-find-scanner
-
-
# sane-find-scanner will now attempt to detect your scanner. If the
-
# result is different from what you expected, first make sure your
-
# scanner is powered up and properly connected to your computer.
-
-
# No SCSI scanners found. If you expected something different, make sure that
-
# you have loaded a kernel SCSI driver for your SCSI adapter.
-
-
found USB scanner (vendor=0x04b8 [EPSON], product=0x0116 [EPSON Scanner]) at libusb:001:019
-
# Your USB scanner was (probably) detected. It may or may not be supported by
-
# SANE. Try scanimage -L and read the backend's manpage.
-
-
# Not checking for parallel port scanners.
-
-
# Most Scanners connected to the parallel port or other proprietary ports
-
# can't be detected by this program.
-
linux:/etc/hotplug/usb #
-
I read on Google that I had to download a proprietory scanner driver for the Epson scanner from http://www.avasys.jp/english/linux_e/dl_scan.html. There are three things to download:
-
iscan-1.18.0-1.i386.rpm
-
iscan-plugin-gt-9400-1.0.0-1.i386.rpm
-
iscan-1.18.0-1.tar.gz
I unpacked the third file in an empty directory and compiled it using ./configure ; make ; make install. I then installed the remaining two packages using rpm -Uvh *.rpm. Yet I still was not able to scan though, as mentioned before, e.g. scanimage -L was able to see the scanner.
But it saw the wrong scanner. I followed all descriptions available on the net about editing /etc/sane.d/dll.conf, /etc/sane.d/saned.conf, /etc/sane.d/epkowa.conf, yet this did not help either.
At this point I noticed that scanimage -L was showing an "epson" scanner while it was supposed to see an "epkowa" scanner. And this though I had switched to epkowa in my dll.conf:
Now obviously the dll.conf was not read from the place I expected it to be read from. Using strace, I was able to find out what was happening:
-
linux:/ # strace scanimage -L 2>&1 | grep -i dll.conf
-
open("./dll.conf", O_RDONLY) = -1 ENOENT (No such file or directory)
-
open("/usr/local/etc/sane.d/dll.conf", O_RDONLY) = 3
-
linux:/ #
-
As you can see, scanimage tries to open the dll.conf file from the current directory first, then from /usr/local/etc/sane.d, which is pretty confusing, as if you are currently editing the file in /etc/sane.d and try out scanimage from that directory, your changes may seem to be respected, while when you are working off another directory, your changes are no longer taken into account. As a consequence, I edited the files in /usr/local/etc/sane.d.
Here is the complete /usr/local/etc/sane.d/dll.conf:
-
#
-
# SANE Dynamic library loader config
-
# written by YaST2, Wed Aug 24 15:02:02 2005
-
#
-
# enablethenextlineifyouwanttoallowaccessthroughthenetwork:
-
# net
-
# abaton
-
# agfafocus
-
# apple
-
# avision
-
# artec
-
# artec_eplus48u
-
# as6e
-
# bh
-
# canon
-
# canon630u
-
# canon_pp
-
# coolscan
-
# coolscan2
-
# dc25
-
# dc210
-
# dc240
-
# dmc
-
# epson
-
# fujitsu
-
# gphoto2
-
# gt68xx
-
# hp
-
# hpsj5s
-
# hp5400
-
# ibm
-
# leo
-
# ma1509
-
# matsushita
-
# microtek
-
# microtek2
-
# mustek
-
# mustek_pp
-
# mustek_usb
-
# nec
-
# niash
-
# pie
-
# pint
-
# plustek
-
# plustek_pp
-
# pnm
-
# qcam
-
# ricoh
-
# s9036
-
# sceptre
-
# sharp
-
# sm3600
-
# snapscan
-
# sp15c
-
# st400
-
# tamarack
-
# teco1
-
# teco2
-
# teco3
-
# test
-
# u12
-
# umax
-
# umax_pp
-
# umax1220u
-
# v4l
-
# Thefollowingbackendsarenotincludedinthesane-backendsdistribution
-
# Ifyouwanttousethem,downloadthemfromtheirwebpagesandreadtheir
-
# documentation
-
# HPOfficeJetbackendhomepage:http://hpoj.sf.net/
-
# Uncommentthefollowinglineifhpojisinstalled:
-
# hpoj
-
epkowa
-
-
# EOF
-
Here is the complete /usr/local/etc/sane.d/saned.conf:
-
#
-
# saned.conf
-
#
-
# The contents of the saned.conf file is a list of host names, IP
-
# addresses or IP subnets (CIDR notation) that are permitted to use local
-
# SANE devices. IPv6 addresses must be enclosed in brackets, and should
-
# always be specified in their compressed form.
-
#
-
# The hostname matching is not case-sensitive.
-
#
-
#scan-client.somedomain.firm
-
#192.168.0.1
-
#192.168.0.1/29
-
#[2001:7a8:185e::42:12]
-
#[2001:7a8:185e::42:12]/64
-
localhost
-
#
-
# NOTE: /etc/inetd.conf (or /etc/xinetd.conf) and
-
# /etc/services must also be properly configured to start
-
# the saned daemon as documented in saned(8), services(4)
-
# and inetd.conf(4) (or xinetd.conf(5)).
-
Here is the complete /usr/local/etc/sane.d/epkowa.conf:
-
# epkowa.conf -- sample configuration for the EPKOWA SANE backend
-
# Copyright (C) 2004 Olaf Meeuwissen
-
#
-
# See sane-epkowa(5), sane-scsi(5) and sane-usb(5) for details.
-
-
# SCSI scanners can be configured simply by listing the path to the
-
# device. For example, if your system claims to have a /dev/scanner
-
# SCSI device, all you have to do is uncomment the following line:
-
#
-
#/dev/scanner
-
#
-
# In the interest of maintainability, most installations would have
-
# /dev/scanner sym-linked to the real SCSI scanner device node.
-
#
-
# An alternative way that works for many operating systems and is a
-
# little bit more generic, is to have the backend probe for your SCSI
-
# scanner with the following configuration command:
-
#
-
# scsi EPSON
-
-
# On systems with libusb, the following line is sufficient to get the
-
# backend to recognise your USB scanners. It presumes, however, that
-
# the scanner---more precisely, it's USB product ID---is known to the
-
# backend.
-
# For all USB scanners that are officially supported by this backend,
-
# this presumption is true. A list of such scanners can be found in
-
# sane-epkowa(5).
-
#
-
usb
-
-
option warmup 1
-
option warmup-time 1
-
-
# For any USB scanner not known to the backend (yet), you may, at your
-
# own peril(!!), force the backend to recognise and use it via libusb.
-
# You can do so by the following configuration command:
-
#
-
# usb <USB vendor ID> <USB product ID>
-
#
-
# SEIKO EPSON's USB vendor ID is '0x04b8' (without quotes). In order
-
# to find the USB product ID, use lsusb(1) or, on Linux systems, peek
-
# at the information in /proc/bus/usb/devices.
-
# A sample configuration for the Perfection 1650 (GT-8200), which has
-
# a product ID of 0x0110, would look as follows:
-
#
-
#usb 0x04b8 0x0110
-
#usb 0x04b8 0x0116
-
-
# When not accessing your USB scanner via libusb, you may need to use
-
# one of the configuration commands below or commands that are almost
-
# the same. These commands typically access the scanner via a kernel
-
# scanner module.
-
#
-
#usb /dev/usb/scanner0
-
#usb /dev/usbscanner0
-
#usb /dev/uscanner0
-
#
-
# Linux had a scanner module until version 2.6.2. As of version 2.6.3
-
# libusb is your only option. Linux' scanner module can be loaded via
-
# the modprobe(8) command like so:
-
#
-
# modprobe scanner vendor=<USB vendor ID> product=<USB product ID>
-
#
-
# If the scanner module already knows the vendor and product IDs, you
-
# do not have to specify them. If you want to have this done automa-
-
# tically every time you boot, you can add the above line, except for
-
# the modprobe command itself, to your /etc/modules file.
-
-
# Although not tested with this backend, parallel port scanners should
-
# be usable. You can configure them as shown below, but I do not know
-
# much about the details. Information is welcome.
-
#
-
#pio 0x278
-
#pio 0x378
-
#pio 0x3BC
-
I was still unable to scan. I found out with another strace that we were trying to load the file /usr/share/iscan/esfw32.bin, which was not there, but which was in the non-free folder of the source tree of the iscan source. I thus copied everything from the non-free folder to /usr/share/iscan which I first created.
Then when doing scanimage -L, the scanner immediately reacted, lighted up its lamp, and was working for root.
To get it to work for every other user, as well, I had to create the file /etc/hotplug/usb/libusbscanner:
-
if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
-
chown root:users "$DEVICE"
-
chmod 0660 "$DEVICE"
-
/bin/logger Scanner $DEVICE detected and connected.
-
fi
I finally created the following script to scan files into pdf's.
-
#!/usr/bin/perl
-
#
-
# This script scans a multipart image into a pdf
-
#
-
use strict;
-
-
my ($outdir) = join(" ", @ARGV);
-
my $output = "";
-
-
if($outdir eq "") {
-
$outdir = ".";
-
}
-
-
#
-
# Define the scanner here.
-
#
-
#my $scanner = "hp:/dev/sg0";
-
#my $scanner = "plustek:libusb:003:002";
-
#my $scanner = "epkowa:libusb:001:003";
-
chop (my $scanner = `export LD_PRELOAD=/usr/lib/libstdc++.so. 5. 0. 7 && scanimage -L` );
-
if($scanner =~ /^.* (epkowa.*? ).\ s.*$/ ) {
-
$scanner = $1;
-
-
} else {
-
-
}
-
-
-
#
-
# Define the scan parameters here.
-
#
-
# Valid modes are:
-
# Lineart|Halftone|Grayscale|Color
-
#
-
my $xres = "210mm";
-
my $yres = "297mm";
-
my $left = "0mm";
-
my $top = "0mm";
-
my $mode = "Gray";
-
my $res = "200dpi";
-
my $bwlight = "180";
-
my $grlight = "100";
-
my $light = "180";
-
my $dir = "/tmp/scan";
-
my $file = "\@tmpscan";
-
my $time = `date + "%Y%m%d"`; chomp($time);
-
-
#
-
# Get the output file name and timestamp
-
#
-
if($output eq "") {
-
chop ($output .= `kdialog --title "XScan" --inputbox "Enter the Filename (.pdf will be appended) [scan] : "` );
-
if($output eq "") { exit; }
-
}
-
-
if($output !~ /^.*\s-\ s\d\d\d\d\d\d\d\d$/ && $output !~ /^.*\s-\ s\d\d\d\d\d\d\d\d\. [pP ][dD ][fF ]$/ ) {
-
chop (my $tmptime = `kdialog --title "XScan" --inputbox "Enter the Timestamp [$time] (n for none) : " "$time"` );
-
if($tmptime eq "") { exit; }
-
-
if($tmptime ne "n") {
-
if($tmptime ne "") {
-
$output .= " - $tmptime";
-
} else {
-
$output .= " - $time";
-
}
-
}
-
}
-
-
if($output =~ /^(.*)\.[pP][dD][fF](.*)$/) {
-
$output = "$1$2.pdf";
-
} else {
-
$output .= ".pdf";
-
}
-
-
#
-
# Eventually create the working directory
-
#
-
if (!-d $dir) {
-
-
}
-
-
#
-
# Scan the pages
-
#
-
my $next = "";
-
my $page = 0;
-
my $pageext = "";
-
getFormat($mode, $res);
-
do {
-
$page++;
-
if($page < 10) {
-
$pageext = "00".$page;
-
}
-
if($page >= 10 && $page < 100) {
-
$pageext = "0".$page;
-
}
-
-
if ($mode eq "Binary") {
-
system("export LD_PRELOAD=/usr/lib/libstdc++.so.5.0.7 && scanimage -d $scanner --format pnm -x $xres -y $yres -l $left -t $top --mode $mode --resolution $res --threshold $light --speed=no >\"$dir/$file$pageext.pnm\"");
-
} else {
-
system("export LD_PRELOAD=/usr/lib/libstdc++.so.5.0.7 && scanimage -d $scanner --format pnm -x $xres -y $yres -l $left -t $top --mode $mode --resolution $res --speed=no >\"$dir/$file$pageext.pnm\"");
-
}
-
-
system("pnm2jpg $dir $file $pageext &");
-
-
$next = getFormat($mode, $res);
-
} while ($next ne "q");
-
-
#
-
# Wait for the last file to be converted from pnm to jpg by the pnm2jpg
-
#
-
my $wait = 1;
-
while ($wait != 0) {
-
-
if (!-e "$dir/$file$pageext.pnm") {
-
$wait = 0;
-
}
-
}
-
-
#
-
# Convert to pdf
-
#
-
system("convert \"$dir/$file*.jpg\" -adjoin \"$outdir/$output\"");
-
-
#
-
# Clean up the scanned pages
-
#
-
-
-
#
-
# Open the file
-
#
-
system("acroread \"$outdir/$output\" &");
-
-
-
-
#
-
# Get the color depth
-
#
-
sub getFormat {
-
my ($curmode, $curres) = @_;
-
my $msg = "Enter the next page Format: BGCXXX [". substr($curmode, 0, 1). substr($curres, 0, length($curres)- 3). "], q to finish : ";
-
-
chop (my $format = `kdialog --title "XScan" --inputbox "$msg" "$def"` );
-
if($format eq "") { $format = "q"; }
-
-
if($format =~ /^([bBgGcC])(.*)$/) {
-
-
$mode = "Binary";
-
$light = $bwlight;
-
} elsif (uc($ 1) eq "G") {
-
$mode = "Gray";
-
$light = $grlight;
-
} elsif (uc($ 1) eq "C") {
-
$mode = "Color";
-
$light = $grlight;
-
}
-
if($2 ne "") {
-
$res = "$2dpi";
-
}
-
-
} elsif ($format =~ /^[qQ]$/) {
-
-
}
-
}
|
 |
|