NIASH chipset based flatbed scanners - HOW-TO
This project's goal is to implement a SANE backend for flatbed scanners
with the NIASH chipset, the following document describes and explains the
procedures to undertake in order to fully install and configure a working
version of the package. Although the major aim was to write a SANE
backend, to ease the testing and experimenting, a test tool was also
built, it shares most of the code with the SANE backend, but provides a
simpler interface and (hopefully) turns the building and configuration
processes, as well as error and bug tracking more easy to cope with. Since
this project is in alpha stage, it is therefore recommended that
users build and use this test tool before trying to build the SANE
backend.
As of the date of this writing, the package makes use of two distinct
ways of accessing USB scanners:
- By using the Linux kernel native support for accessing USB
scanners. This method provides a better throughoutput, but
requires a Linux kernel v2.4.13 or greater. Since most mainstream
GNU/Linux distributions ship with kernels older than the required
version, the user will probably need to compile a new kernel.
(this method is from now on refered as kernel method)
- By using libUSB. This method was implemented in order to save
users the trouble to (re)compile a new Linux kernel (it is also very
handy to port the test tool to other systems). It requires a
2.4 series Linux kernel or a OpenBSD/FreeBSD/NetBSD kernel with ugen support.
Please note that you must install LibUSB 0.1.5 (or greater) in your system to use this
method. (this method is from now on refered as libusb method)
The default under GNU/Linux systems is to build the package with both methods (if available)
and let the user choose which to use at run time. Alternatively the user might want to build
the package with just one of the methods, which is perfectly possible
(see details bellow). Note that under the free BSDs the package will only be built with
the LibUSB method.
In all the examples below we will use a ficticious release whose
revision number is 2, release date the 28th of January 2002, and
distribution file testtool-20020128_2.tar.gz.
Please note that this tools are provided with no warranty, use them
at your own risk.
- Hardware:
- A Hewlett Packard 3300c, 3400c, 4300c or a Agfa Touch flatbed scanner
- A USB controller (UHCI or OHCI) supported by the Linux kernel
- Software:
- GNU/Linux systems
- Linux kernel version 2.4.x (libusb method)
- Linux kernel version 2.4.13 or greater (kernel method)
- OpenBSD, FreeBSD and NetBSD
- Any recent kernel with ugen support (libusb method only)
- LibUSB version 0.1.5 (libusb method only)
- The GNU C Compiler (GCC)
The following itens should be checked before trying to install the
package:
It is mandatory that you run a 2.4 series Linux kernel (at least version 2.4.13 to use the
kernel method) with the following itens compiled as modules or builted in:
Capability
| Module
| Notes
|
Support for USB - CONFIG_USB
| usbcore.o
| Required
|
Preliminary USB device filesystem - CONFIG_USB_DEVICEFS
| n/a
| Required to use libusb method, optional otherwise
|
UHCI (Intel PIIX4, VIA, ...) support - CONFIG_USB_UHCI
| usb-uhci.o
| Required on systems with an UHCI USB controller
|
UHCI Alternate Driver (JE) support - CONFIG_USB_UHCI_ALT
| uhci.o
| An alternative driver for UHCI USB controllers (compile this or
the previous, only one is required)
|
OHCI (Compaq, iMacs, ...) support - CONFIG_USB_OHCI
| usb-ohci.o
| Required on systems with an OHCI USB controller
|
USB Scanner support - CONFIG_USB_SCANNER
| scanner.o
| Required to use the kernel method, not recommended to
use the libusb method
|
In order to properly build SANE with the NIASH backend, you should remove any
previously installed version of SANE and all related packages (thanks to
Harman Nagra for pointing this out).
Since 2.3.46 the Linux kernel includes a dynamic device filesystem
called "devfs" (device file system). With devfs, there is no need to create the device
files, because they are dynamically created for you.
For USB Scanners, the device is created in /dev/usb/scannerX where X
can range from 0 to 15 depending on the number of scanners connected
to the system.
To see if you have devfs, check if the file .devfsd exists in /dev by issuing the command:
If .devfsd is listed, then you have devfs, so keep on reading,
otherwise jump to "Without devfs".
If you would like to maintain the file /dev/usbscanner0 in order to maintain
compatibility with applications, then add the following to
/etc/devfsd.conf:
REGISTER ^usb/scanner0$ CFUNCTION GLOBAL symlink usb/scanner0 usbscanner0
UNREGISTER ^usb/scanner0$ CFUNCTION GLOBAL unlink usbscanner0
If you intend to use more than one scanner at a time (up to 16 are permited), add a device for
each USB scanner like this:
bash# mknod /dev/usbscanner[X] c 180 [Y]
where [X] is a number between 0 and 15, and [Y] = [X] + 48.
So, to add 2 USB scanners, issue the command:
bash# mknod /dev/usbscanner0 c 180 48
bash# mknod /dev/usbscanner1 c 180 49
If you foresee using only one scanner it is best to:
bash# mknod /dev/usbscanner0 c 180 48
bash# ln -s /dev/usbscanner0 /dev/usbscanner
Set the appropriate permissions for /dev/usbscanner[0-15] (don't forget
about group and world permissions). Both read and write permissions
are required for proper operation. For example:
bash# chmod 666 /dev/usbscanner0
Although the process of building and installing libUSB is out of the scope of this
document, we warn you of the following:
- Under GNU/Linux, LibUSB requires that the preliminary USB device filesystem is mounted
in the proper place (/proc/bus/usb), to mount it do:
bash# mount -t usbdevfs usbdevfs /proc/bus/usb/
or add the following line to you /etc/fstab:
usbdevfs /proc/bus/usb usbdevfs defaults 0 0
- Before using libUSB under GNU/Linux, you must unload the scanner.o module (if it's not
compiled as module, but builted-in, libUSB will never be able to claim
the USB interface to access the scanner). To unload the scanner.o
module do the following:
bash# modprobe -r scanner
- Under OpenBSD/FreeBSD/NetBSD, LibUSB will not work correctly if your kernel is compiled with uscanner
support, you must recompile your kernel and remove uscanner support.
Unpack the sources like this:
bash# cd /usr/src
bash# tar xvzf /path/to/sources/testtool-20020128_2.tar.gz
bash# cd testtool
To build the package with both USB access methods just issue:
to build the package with just the kernel USB access method, issue:
to build the package with just the LibUSB USB access method, issue:
to see the what you can do with the test tool do:
Unpack SANE backends source code to the desired directory, and use the patch-sane.sh
script provided with the package (lets assume that the SANE source directory was unpacked to
the parent directory of the test tool):
bash# ./patch-sane.sh ../sane-backend-x.x.x
If everything went right, then just build SANE backends, otherwise, you might try the official patch
that we make available at the project's
website (instructions are provided here).
- The vertical resolution of the HP3400c is currently fixed at 300
DPI, so the resulting image will look stretched in the vertical
direction.
- Calibration does not work correctly on the HP3400c
- Sometimes when some settings are wrong, the carriage will move too
far to the bottom and make a quite loud clicking sound. If this
happens to you, quickly remove the power plug or the USB plug,
it will almost for sure crash Linux, but at least you don't
damage the scanner...
- If something goes wrong, we recommend reloading the scanner module
and possibly also the USB controller module (for example, 'modprobe -r
scanner' 'modprobe -r uhci' 'modprobe uhci' modprobe 'scanner')
- Parallel port support is implemented (through libieee1284), but
completely untested.
To report bugs and make sugestions use the facilities provided in our website.
To make things easier, provide us at least the following information:
- Kernel version
- Package version and revision
- USB method you're using
- LibUSB version, if any
Last modified: $Date: 2002/04/22 22:48:54 $
Copyright © 2002 Bertrik
Sikken, Ricardo Martins