Re: SANE standard,

Milon Firikis (milonf@ariadne-t.gr)
Mon, 07 Dec 1998 14:33:52 +0200

Robert Schwebel wrote:
>
> Hello!

[snip]

>
> A few questions:
>
> - Is there more information about how to write a backend? I looked threw
> the SANE coding standard V1.0 and found it still difficult to write a
> backend myself with what I found there. I played around with the pnm
> driver which seems to be a sample implementation, but it is very
> poorly
> documented and other drivers seem to follow completely different
> strategies and style guides. Something like a "How to start writing a
> SANE backend" would be nice.

That's the only thing AFAIK. However you did the right moves. PNM
backend is difficult to understand and the scanners backend are way too
different from your needs but still is an invaluable "source" of
knowledge. I recommend mustek.c I started with that. You can also try
apple.c. apple.c has a define
#if 0
#define NEUTRALIZE_BACKEND
#define APPLE_MODEL_SELECT APPLESCANNER
#endif

in the apple.h. If you turn the zero to one then you will be able to use
the backend even without scanner. You can't do anything useful with it
but it will let you see the options handling and all these...

>
> - How do I compile my own backend? At the moment I copied my source into
> the sane-1.0/backends directory as root, compiled it there and
> installed
> the libraries by hand in /usr/local/lib/sane/ (because make install
> installs always all libraries found, no matter if they already were
> installed). Is this really the right way? Any possibility of making
> the source with user permissions and only installing it as root?

untar the SANE source
chown -R user.group sane-XXX
always edit source code as user (not root)
always do make as user
If you are a developer you should try ./configure with --static-libs or
something, otherwise you won't be able to debug your backend.

When you want to install, you install as root.

In order to make your backend part of the building procedure you should
edit Makefile.in and add your backend to the proper places.

> - A few samples of how to deal with all these options defined in the
> option
> descriptor would be nice as well. I tried to setup a string_list, but
> if I run xscanimage and select one of the list entries it stops with
> xscanimage: can't resolve symbol 'sanei_constrain_value'

Give more info...

> - Is there a separation between the API part of the SANE backend and the
> hardware dependend routines?

SANE hides out scsi interface. You should use sanei_scsi routines and
not direct scsi calls. Unfortunately this isn't true for other kind of
interfaces. Especially for the scanners that have a proprietary ISA card
one should use direct hardware port access giving up both compatibility
(PC only) and security (SANE should be setuid root). For the parallel
ports and serial ports I don't have a clear idea what is the status qwo
right now. Maybe somebody else could clarify further?

>Am I simply allowed to access hardware
> ports from my backend and are there any guidelines dealing with
> compatiblity (what system libraries am I allowed to use) and
> portability?

Give some more info (Hardware, interface, libraries) for a more proper
advise and not a general conversation...

MF

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com