kopia lustrzana https://gitlab.com/sane-project/website
106 wiersze
4.3 KiB
HTML
106 wiersze
4.3 KiB
HTML
<!-- received="Mon Mar 1 12:36:07 1999 PST" -->
|
|
<!-- sent="Mon, 01 Mar 1999 21:14:10 +0100" -->
|
|
<!-- name="Svend Daugaard Pedersen" -->
|
|
<!-- email="sdp@vip.cybercity.dk" -->
|
|
<!-- subject="Re: Porting SANE backends" -->
|
|
<!-- id="ÿÿÿÿÿÿÿÿàØ" -->
|
|
<!-- inreplyto="199902281831.KAA01895@panda.mostang.com" -->
|
|
<title>sane-devel: Re: Porting SANE backends</title>
|
|
<h1>Re: Porting SANE backends</h1>
|
|
<b>Svend Daugaard Pedersen</b> (<a href="mailto:sdp@vip.cybercity.dk"><i>sdp@vip.cybercity.dk</i></a>)<br>
|
|
<i>Mon, 01 Mar 1999 21:14:10 +0100</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#11">[ date ]</a><a href="index.html#11">[ thread ]</a><a href="subject.html#11">[ subject ]</a><a href="author.html#11">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0012.html">becka@rz.uni-duesseldorf.de: "Re: SCSI not detected"</a>
|
|
<li> <b>Previous message:</b> <a href="0010.html">David Mosberger-Tang: "copyright change on sanei_net.h"</a>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
David Mosberger-Tang wrote:<br>
|
|
<p>
|
|
<i>>>>>>> On Sun, 28 Feb 1999 18:21:32 +0200, Milon Firikis <<a href="mailto:milonf@ariadne-t.gr">milonf@ariadne-t.gr</a>></i><br>
|
|
<i>>said:</i><br>
|
|
<p>
|
|
<i>> Milon> Note that the objective is to hide all Unix specific</i><br>
|
|
<i>> Milon> functions from the backend much like the sanei_scsi_ routines</i><br>
|
|
<i>> Milon> do for scsi operations.</i><br>
|
|
<p>
|
|
<i>>You're wrong. Yes, the _API_ must be OS independent but the sample</i><br>
|
|
<i>>implementation that we distribute is developed and intended for</i><br>
|
|
<i>>POSIX-compatible systems. If we can port that source to other</i><br>
|
|
<i>>platforms easily and cleanly, great, but to say that we want to hide</i><br>
|
|
<i>>all UNIX/POSIX specific functions is silly.</i><br>
|
|
<p>
|
|
<i>>The issue with fork() is that it's hard (inefficient) to implement on</i><br>
|
|
<i>>any system that doesn't have virtual memory. However, threads do not</i><br>
|
|
<i>>necessarily solve the problem either. E.g., on systems supporting</i><br>
|
|
<i>>user-level threads only (e.g., SunOS, HP-UX up to 10.20, etc.), a</i><br>
|
|
<i>>thread may not even help for SANE backends.</i><br>
|
|
<p>
|
|
<i>>Anyhow, if someone modifies the backends to abstract fork() in an</i><br>
|
|
<i>>elegant way, I'd be happy to merge in such patches. But if it can't</i><br>
|
|
<i>>be done cleanly, you'd be better of creating and maintaining your own</i><br>
|
|
<i>>SANE implementation. It's perfectly OK to have multiple SANE</i><br>
|
|
<i>>implementations as long as they can interoperate.</i><br>
|
|
<p>
|
|
I think this must be possible. Here is my attempt.<br>
|
|
<p>
|
|
You need four routines:<br>
|
|
<p>
|
|
SANE_Status start_reading(SANE_Handler *h)<br>
|
|
<p>
|
|
If reading from the scanner is to be done by a special process this<br>
|
|
routine must set up this process (for instance by calling fork).<br>
|
|
<p>
|
|
Otherwise it should simply return SANE_STATUS_OK.<br>
|
|
<p>
|
|
<p>
|
|
SANE_Status get_image_data(SANE_Handler *h,SANE_Byte *buf,SANE_Int len)<br>
|
|
<p>
|
|
If a special reader process is up this routine should read the bytes<br>
|
|
from the pipe.<br>
|
|
<p>
|
|
Otherwise it should call read_image_data.<br>
|
|
<p>
|
|
<br>
|
|
SANE_Status stop_reading(SANE_Handler *h)<br>
|
|
<br>
|
|
If a special reader process is up this process has to be killed.<br>
|
|
<p>
|
|
Otherwise return SANE_STATUS_OK.<br>
|
|
<p>
|
|
<br>
|
|
int reader_process(SANE_Handler *h)<br>
|
|
<p>
|
|
Read bytes from scanner (by calling read_image_data) and write them<br>
|
|
to the pipe.<br>
|
|
<p>
|
|
<p>
|
|
In addition to these four "sanei" routines the following routine must be<br>
|
|
supplied by the backend<br>
|
|
<p>
|
|
SANE_Status read_image_data(SANE_Handler *h,SANE_Byte *buf,SANE_Int len)<br>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
Svend Daugaard Pedersen<br>
|
|
<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="0012.html">becka@rz.uni-duesseldorf.de: "Re: SCSI not detected"</a>
|
|
<li> <b>Previous message:</b> <a href="0010.html">David Mosberger-Tang: "copyright change on sanei_net.h"</a>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
</ul>
|