[sane-devel] A couple of backend API questions

Dmitri Katchalov dmitrik@MailAndNews.com
Tue, 02 Oct 2001 12:58:02 +1000


I'm writing a SANE backend form my Brother MFC 4600. I've got a couple
of questions about the API.

1) Does SANE support non-square pixel resolutions? My device (which is
basically a fax machine)
supports 200x100 (Standard), 200x200 (Fine) and 200x400 (Super Fine)
modes. How do I set
the "resolution" attribute?

2) Timing of SANE_read. Once the scan operation is started the device
spits data at pretty much
constant rate. I haven't yet found a way to flow-control it. If the
front-end does not call read() on time
buffer overrun is likely to occur and the data will be lost. Unlike
other scanners this one is a
multi-function device, it can do several things at the same time and the
comms channel is shared
with printer and fax so if I don't poll it fast enough it will affect
printing and faxing as well.

3) The device has paper end detector. If the document is physically
shorter than A4 the number
of scan lines returned may be less than requested. Is it OK to return
EOF in this case or do I need
to pad the image with blank lines?

4) SANE_cancel. I'm having some problems implementing its asynchronous
My device needs to be closed gracefully otherwise I will have problems
opening it next time.
This involves sending a "shut up" command to the device and getting a
response back.
When the manual says "asynchronously" I take it can be either from a
different thread or a signal
handler. AFAIK there are only a few things you can do from within signal
handler and waiting
for a packet is not one of them. I don't think you can even call free()
safely in this context.