sane-project-website/old-archive/1999-11/0125.html

129 wiersze
6.0 KiB
HTML

<!-- received="Mon Nov 15 00:26:59 1999 PST" -->
<!-- sent="Mon, 15 Nov 1999 09:19:27 +0100" -->
<!-- name="Oliver Rauch" -->
<!-- email="oliver.rauch@Wolfsburg.DE" -->
<!-- subject="Re: Questions re Sane API digression &amp; MF Scanner" -->
<!-- id="" -->
<!-- inreplyto="Questions re Sane API digression &amp; MF Scanner" -->
<title>sane-devel: Re: Questions re Sane API digression &amp; MF Scanner</title>
<h1>Re: Questions re Sane API digression &amp; MF Scanner</h1>
<b>Oliver Rauch</b> (<a href="mailto:oliver.rauch@Wolfsburg.DE"><i>oliver.rauch@Wolfsburg.DE</i></a>)<br>
<i>Mon, 15 Nov 1999 09:19:27 +0100</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#125">[ date ]</a><a href="index.html#125">[ thread ]</a><a href="subject.html#125">[ subject ]</a><a href="author.html#125">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0126.html">Oliver Rauch: "Re: next release?"</a>
<li> <b>Previous message:</b> <a href="0124.html">raj2569@flashmail.com: "sane and video4linux"</a>
<li> <b>Maybe in reply to:</b> <a href="0121.html">Dave Restall - System Administrator: "Questions re Sane API digression &amp; MF Scanner"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
Dave Restall - System Administrator wrote:<br>
<p>
<i>&gt; Hi,</i><br>
<i>&gt;</i><br>
<i>&gt; I have started writing a backend for the Scanace 9630 scanner and</i><br>
<i>&gt; unfortunately I hit a brick wall at my first attempt. The brick wall</i><br>
<i>&gt; being :-</i><br>
<i>&gt;</i><br>
<i>&gt; The API seems pretty clear to follow and relatively simple to</i><br>
<i>&gt; implement, however there are a few things that I don't understand in the</i><br>
<i>&gt; code that I've looked at for backends. I'm only dealing with sane_init</i><br>
<i>&gt; here, but the API says this :-</i><br>
<i>&gt;</i><br>
<i>&gt; "The version code of the backend is returned in the value pointed to by</i><br>
<i>&gt; version_code. If the pointer is NULL, no version code is returned.</i><br>
<i>&gt; Argument authorize is either a pointer to a function that is invoked</i><br>
<i>&gt; when the backend requires authentication for a specific resource or NULL</i><br>
<i>&gt; if the frontend does not support authentication."</i><br>
<i>&gt;</i><br>
<i>&gt; Regarding authorization, should "frontend" read "backend" ?</i><br>
<p>
The frontend may have a routine that asks for authorization.<br>
If the backend likes to do a authorization test, it can call<br>
the authorization routine if the pointer to it is != NULL.<br>
The returned values are loagin string and password string.<br>
<p>
You do not need this for a simple backend. In fact there is no<br>
backend that uses that in the moment.<br>
<p>
If you want to test it, xsane is the only frontend (as far as I know)<br>
that supports the authorization dialog.<br>
<p>
<i>&gt;</i><br>
<i>&gt; Apart from that this bit of the spec seems pretty clear, however when I</i><br>
<i>&gt; started to read the code for other backends, all sorts of stuff seems to</i><br>
<i>&gt; go on, especially when it comes to initialising the hardware. Surely</i><br>
<i>&gt; this belongs in sane_open ?</i><br>
<i>&gt;</i><br>
<i>&gt; I also don't understand the following :-</i><br>
<i>&gt;</i><br>
<i>&gt; stubs.c What is it for ?</i><br>
<p>
Each backend uses the sane_* names for the defined sane function calls.<br>
So for a frontend you have to hide the 20 or more names of e.g. sane_init,<br>
only the sane_init function of the backend the frontend wants to use<br>
is seen by the frontend.sane-dll needs this so you can<br>
select a backend, otherwise you would have to link only ONE backend<br>
to a frontend.<br>
<p>
You do not have to care about that.<br>
<p>
<i>&gt; I was hoping it would be a pile of function stubs with comments in like</i><br>
<i>&gt; "put code for function Y here" in it, e.g. a template for the backend</i><br>
<i>&gt; but it seems to have a more sinister use.</i><br>
<i>&gt;</i><br>
<i>&gt; What does the ENTRY macro do in stubs.c ?</i><br>
<i>&gt;</i><br>
<p>
Simply forget this here.<br>
There is no demo backend code.<br>
look at the existing backends. The pnm backend is a short backend<br>
where you can see how comunication between frontend and<br>
backend is done, but it is coded a bit ugly.<br>
I think the umax backend is good to read, you can find out<br>
everything you need if you look at it - I think.<br>
<p>
<i>&gt;</i><br>
<i>&gt; I'm not new to C but am new to the style used in the code development</i><br>
<i>&gt; for sane so all help will be greatly appreciated.</i><br>
<i>&gt;</i><br>
<i>&gt; I'm also willing to create an empty template with the "Put code to do X</i><br>
<i>&gt; for your scanner here" if it will help and write the FAQ for writing a</i><br>
<i>&gt; backend but I'll need help and guidance, can I use the list for this ?</i><br>
<i>&gt;</i><br>
<p>
Yes, of course.<br>
<p>
Bye<br>
Oliver<br>
<p>
<p>
<pre>
--
Homepage: <a href="http://www.wolfsburg.de/~rauch">http://www.wolfsburg.de/~rauch</a>
sane-umax: <a href="http://www.wolfsburg.de/~rauch/sane/sane-umax.html">http://www.wolfsburg.de/~rauch/sane/sane-umax.html</a>
xsane: <a href="http://www.wolfsburg.de/~rauch/sane/sane-xsane.html">http://www.wolfsburg.de/~rauch/sane/sane-xsane.html</a>
E-Mail: <a href="mailto:Oliver.Rauch@Wolfsburg.DE">mailto:Oliver.Rauch@Wolfsburg.DE</a>
<p>
<p>
<p>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0126.html">Oliver Rauch: "Re: next release?"</a>
<li> <b>Previous message:</b> <a href="0124.html">raj2569@flashmail.com: "sane and video4linux"</a>
<li> <b>Maybe in reply to:</b> <a href="0121.html">Dave Restall - System Administrator: "Questions re Sane API digression &amp; MF Scanner"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>