(main page)
Last update Saturday, November 17, 2001 Bertrik Sikken
Contents
Architecture
The SANE backend consists of three layers:
- SANE API layer, interfaces between the SANE API and the core layer.
- Core layer, contains knowledge about how to write which register to control the scanner.
- Transfer layer, provides a way to read/write registers and scanner data.
The exact transfer mode (USB or parallel) is hidden from the core layer.
SANE API layer
under construction
Core layer
This layer contains the following functions:
- Calibration parameter calculation
- Lamp control
- The "data pipe".
Data pipe
The data pipe passes the actual image data from the scanner to the SANE API layer.
It consists of several stages: a transfer buffer, a circular buffer and a line buffer.
The transfer buffer makes sure that data is always transferred in relatively large
blocks to prevent unnecessary overhead in the data transfers between PC and scanner.
The circular buffer is used to re-align the color components of the scanned image.
At a resolution of 150 dpi, the blue component of the first line should be combined
with the green component of the second line and the red component of the third line
for example.
The line buffer is used to make it possible for the SANE frontend to use a transfer
buffer of arbitrary length. More specifically it makes sure that the backend passes
the 'scanimage -T' test.
Transfer layer
The transfer layer provides a simple means of communication with the scanner.
The HP3300c contains a scanner chip that directly talks IEEE1284 (parallel port protocol)
and a USB-IEEE1284 bridge that converts USB packets into parallel port commands.
The transfer layer software therefore needs to wrap up parallel port commands in
USB control packets.
Currently the transfer layer can use both libusb and the usbscanner kernel module.
The HP3400 and HP4300 also have a parallel port connection.
It is very likely that the parallel port directly connects to the scanner chip,
so the USB wrapper can be skipped and the commands can be sent directly to the
parallel port (using libieee1284 for example).
Data structures
All data is contained in a single structure, consisting of several smaller structures.
A pointer to this structure is also the handle given back to the SANE interface.
There are substructures for the data pipe, the current scan parameters and
the hardware properties.
Calibration
I will add some examples of scans of the calibration strip of several scanners here.
Calibration for the analog frontend
under construction
Per-pixel calibration
under construction
Register contents
HP3400c
0000 04 04 04 49 07 04 41 00
0008 04 04 04 04 04 04 04 04
0010 04 04 04 04 04 04 04 04
0018 04 04 04 04 04 04 04 04
0020 00 04 04 04 10 80 80 22
0028 01 03 79 80 80 80 00 80
0030 80 80 80 80 80 80 80 80
0038 01 47 FF 01 01 01 00 80
HP4300c
0000 00 00 00 49 07 00 01 00
0008 00 00 00 00 00 00 00 00
0010 00 00 00 00 00 00 00 00
0018 00 00 00 00 00 00 00 00
0020 00 00 00 00 02 04 04 22
0028 01 03 79 04 04 04 00 04
0030 04 04 04 04 04 04 04 04
0038 01 54 00 01 01 01 00 04