[sane-devel] Canon FS4000

abel deuring adeuring at gmx.net
Sat Sep 20 15:04:12 BST 2003

eric at b.org schrieb:

>> sane-find-scanner detects the Canon scanner by sending a ACAI INQUIRY 
>> command to each SG device. The INQUIRY commands returns the data you 
>> also see from "rescan scsi bus" output: Things like device type and 
>> vendor/device name.
> rescan-scsi-bus.sh ask to the SG devices (through sg module I think) , 
> and this one can answer something correct, because the question is very 
> "basic" (I mean it's not a (e.g.) Canon-specific command).
> Is this correct ?

Yes. All SCSI devices must support a set of very basic commands like 
INQUIRY (returns some details like vendor, model, firmware revision, 
device type), TEST UNIT READY (is the device currently "accessible"?) or 
REQUEST SENSE (returns some details about an error in the previously 
issued SCSI command). If you need a bit more background: either read the 
source code of one or two Sane backends, or ask ;) Another useful source 
for SCSI information is http://www.t10.org. There you can download the 
SCSI specification drafts. (Similar as other standard documents, the 
stuff available there isn't very easily readable, but comprehensive) 
Look for the SCSI 2 draft; your scanner is most likely a SCSI 2 device.

> What I thought is something else :
> eric at tomate:/usr/src/linux/drivers/usb$ egrep -H FS4000 ./* 2>/dev/null
> ./scanner.h:    { USB_DEVICE(0x04a9, 0x3042) }, /* FS4000US */

I don't know much about USB, but I guess this mainly means that the 
scanner module "knows" that device ID 0x4a9, 0x3042 is a scanner.

> So the name of the FS4000 from Canon is officialy in the kernel 
> (2.4.23pre4 for me)...
> It 's only a declaration, with good ids. But is it usable anyway ?

Again, I don't know much about USB. But I think it is a quite safe bet 
that the scanner will use SCSI commands, even if it accessed via the USB 
bus -- the SCSI commands will just be "wrapped" in some way to be sent 
via the USB system.

>> scanimage -L loads all installed backends and asks each of them, if it 
>> detected any _supported_ scanner. The backends for SCSI scanners send 
>> an INQUIRY command to the device, and compare vendor name, device name 
>> etc. with a backend specific list of supported devices.
>> Assuming that the command set of the FS4000 is similar to that of the 
>> Canon FS2700, which is supported by Sane, you could try to modify the 
> Hummmm, yes I've found something interessant in the VueScan Doc :
> ./vuescan.htm-What's new in version 7.6.30
> ./vuescan.htm-<UL>
> ./vuescan.htm:<LI>Fixed problem with Canon FS4000 infrared cleaning
> ./vuescan.htm-<LI>Fixed problem with ScanWit 2740S infrared cleaning
> Interessant, a bug corrected twice :-)
> Same chipset ?

Maybe. But good infrared cleaning ins't exactly trivial, so it could 
also be that vuescan had some other bug which occured for different devices.

>> Canon backend so that it will detect your scanner. It is not likely that 
> I'll take this way : look at the FS2700 backend for write the FS4000.
>> this will be the only required patch, but it might be a start to get 
>> the FS4000 running with Sane -- at least via a SCSI adapter.
> Ok : scanimage loads a backend, and sane-find-scanner/rescan-scsi-bus.sh 
> use generic commands directly.


>> I think that I've heard somewhere that vuescan is able to print the 
>> SCSI commands sent to a scanner. If this is true, you can compare the 
>> commands sent by vuescan and by the Canon backend. This may give you 
>> some idea, how you must patch the Canon backend to get the FS4000 
>> running.
> It is a very, very important information for me. Thank you. I'll search 
> immediatly other informations.
> Above, result of :
> strings /usr/local/vuescan/vuescan...

> ##########################
> <..cut...>
> sanei_scsi
> /proc/sys/kernel/sg-big-buff
> Processor
> sanei_scsi.issue: %p
> cat /proc/scsi/sg/debug 1>&2
> sanei_scsi_req_flush_all
> sanei_scsi.c

> I don't understand why the sane API seems to be used. Can someone help me ?

Well, Sane is distributed under the GNU GPL, with an important 
exception, allowing usage of libraries also in commercial software. And 
the sane_scsi library "abstracts away" the operating system specific 
details, how a SCSI device can be accessed.

> BTW : is it possible to give any option with VueScan ? I'll read again 
> the doc too...

No idea -- I have never used vuescan. But I hope other subscribers of 
this list can give you hints.


More information about the sane-devel mailing list