AGFA Snapscan 1212U patch for SANE Snapscan backend
- 2000-02-15 Version 0.3 released with lots of bugs fixed.
It seems that Snapscan 1212U comes in two versions. Only version 2 supports (and requires) firmware uploads. Another difference is that version 1
scanners don't support the 'Self Test' SCSI-command. Since this command is used by the snapscan backend, earlier version of the patch didn't worked on those
devices. The 'Self Test' command is for that reason disabled.in V0.3.
SCSI-commands such as "Set window" and "Send" can't be processed by the scanner when it is busy. This behaviour has caused annoying "Device busy"
in xsane and xscanimage when the lamp is going back after a sucessful scan. A solution to the problem was suggested by Mr Dmitri (email@example.com), and it's
implemented in V0.3.
- 2000-02-09 This page is finally on the web
This is an attempt to incorporate Agfa's USB-scanners
into the growing list of supported devices under SANE.
During the Christmas holidays i bought myself a Snapscan 1212U. As a dedicated Linux user
I couldn't accept that my new scanner wasn't supported in my favorite OS. So I emailed
Agfa's technical support and asked them if they had any plans to write Linux drivers for it and offered
them to write the drivers myself if they could provide me with a specification of the protocol.
As expected, they didn't even bother to answer.
To make it happen I had to dig up the required information the hard way, by doing some reverse
engineering on the Windows software that came with the scanner (ScanWise). To my great joy
the protocol appeared to be almost identical to that used by Agfa's SCSI scanners.
And for those there already exists a SANE backend. The easiest way to proceed was to
replace the SCSI calls in the Snapscan backend with USB equivalents that used
David Nelson's generic USB scanner device driver.
As expected it didn't work the first time, and the reason was that I had
missed some data that was sent by the Windows driver to the scanner the
very first time the scanner was used. This data turned out to be the firmware.
With this new knowledge in mind I restarted the computer in Linux without
turning the power off. And believe it or not, the xscanimage program did
actually start and I could even make a preview scan.
Reverse engineering results
USB traffic logs
These are my own conclusions and wild guesses based on studies of USB traffic logs from scanning sessions in Windows.
- The latest scanner USB driver from David Nelson. Otherwise the firmware downloader won't work.
It will probably be included in the next development Linux kernel (2.3.43).
- SANE 1.0.1 or the development snapshot
Unpack SANE 1.0.1 archive
tar zxf sane-1.0.1.tar.gz
Apply Snapscan 1212U patch
patch -p0 < sane101.diff
cd sane-1.0.1; ./configure; make; make install
If your scanner device isn't /dev/usbscanner then do the appropriate changes to snapscan.conf located in /usr/local/etc/sane.d
USB Scanner module options
If the scanner module can't find your Snapscan then append the following line to /etc/conf.module
options scanner vendor=0x06bd product=0x2061
This shouldn't be necessary but the scanner driver couldn't detect my scanner without it.
How to use it
Version 2 of Snapscan 1212U supports (and requires) firmware uploads in order to work. The firmware file
comes with Agfas ScanWise scanning software for Windows. If you have the second version of
Snapscan 1212U model this file is named "SnapScan 1212U_2.bin" and can be found in the same
directory as ScanWise. If you can't find a file by that name, your scanner is probably a
version 1 model and you can safely proceed to the next step.
To upload the firmware to the scanner, use the agfafirm util found in the download section:
agfafirm /dev/usbscanner "SnapScan 1212U_2.bin"
Now the scanner is supposed to be restarted. If you are not sure you can check that the status LED on the
scanner starts flashing.
If everything is installed properly you should now be able to run any SANE based program like
xscanimage or xsane.
Known bugs and limitations
- xscanimage and xsane won't start if the scanner is busy
(the status LED is flashing).
The program will exit with the message: Device busy.
- If you are using the stable SANE 1.0.1,
the cancel button in xsane and xscanimage will not work at all.
When the button is pressed the scanning process will be interrupted
but the scanner head will not return. The only way to recover from this state
is a restart of the scanner.
- The snapscan backend will not work with SCSI scanners after the patch has been applied to SANE.s
- David Nelson for helping me out with USB-driver related problems.
- Dmitri for reporting bugs and helping me to fix them
Last modified: Thu Feb 17 01:25:05 CET 2000