[sane-devel] Writing a driver for canoscan 3000
lauri.pirttiaho at luukku.com
Wed Jan 25 19:54:02 UTC 2006
You have gotten the same cool reply from Canon as
everyone else who has been trying to help them to
make their products useful in the free world.
Don't give up though. Every secret is there just
because it waits to be discovered. So is the protocol
of CanoScan 3000.
So, where to start. With SANE backend writing you don't
need to start with the Linux device drivers. Sane offers
quite good libraries to do the low level stuff (the
sanei libraries) so all you have to do is to discover
the procedures for controlling the scanner and then
to use the SANE infrastructure to get the control
going through the specified interface.
So the first thing is to take the Windows system and
usb sniffer there and begin studying how windows
controls the scanner. It may help to figure out the
DLL's used in the control. You can use Microsoft's
dependency walker, depends.exe, that comes with
Microsoft Platform SDK to figure out the dependencies
of DLL's and try to figure out from the exported calls
which one might do the lowest level control. Then you
can take IDA pro (there is a freeware version that is
quite sufficient to study Windows 32-bit programs and
DLL's) and disassemble the lowest level DLL and see
what it does to achieve the effects of the exported
functions (there may be functions for settings, lamp,
motor control, scaniing etc.)
Alternatively you can just make lots of small scans
(I mean just 10x10 pixels or so to save disk space)
and try to figure from USB sniffs the protocols.
Some script in Perl or your favourite text processing
language may be helpful in reducing the amount of
data in the sniffer logs. Then take the sequences
you see in the logs and try to play them back
from Linux (libusb provides simple interface to
USB devices, but you may want to read USB specs
before starting) and then after getting the basic
procedures working by these play-backs, make intelligent
changes to the sequences and try to figure out
the meanings of all the parameters.
Generally you should find in the logs sequences of
commands to do lamp switching, maybe motor speed
control, moving back and forth, taking single line
scans, lamp intensity measurements, analog front end
control (gain/offset), black/white shading control
(that is, pixelwise offset and gain settings) and
calibration, color/gray scale switching, exposure
All that detective work may easily take some months
so don't get frustrated. Problems tend to find their
solutions sooner or later.
After you have some free standing test progs (using
libusb) that do what you want and you know how to
tweak the parametsr for the effects you want, it
is time to begin making the back-end. For that there
are quite good instructions on SANE pages and some
experimenting (and knife deep into the gust of SANE libs
when necessary, e.g. to get extra traces in the case of
unexpected trouble) will reveal how to use the SANE libs
to get the back-end running.
As to CanoScan 3000, there have been some speculations
about its controller, so you might want to read the
old postings on the sane-devel list, too.
With best regards,
Luukku Plus paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku
More information about the sane-devel