[sane-devel] More front end developer Q's

Guy Brooker guy_brooker@mac.com
Mon, 22 Sep 2003 14:02:34 +0200


On 22/9/03 11:24 am, "Henning Meier-Geinitz" <henning@meier-geinitz.de>
wrote:

> Hi,
> 
> On Mon, Sep 22, 2003 at 11:09:54AM +0200, Guy Brooker wrote:
>> 1. How can I determine the native resolution in X and Y of the current
>> scanner ?
> 
> You can't. And you usually don't need to.
> 
>> For my EPSON GT-7000, the epson backend returns resolutions up to 2400, and
>> a default of 50. However EPSONs docs say the native resolution of the
>> scanner is 600 dpi.
> 
> Well, it's up to the backend author to decide if the backend does
> interpolation. I don't recommend doing that. There is one exception:
> scanners that can do e.g. 600x1200 dpi. In this case, interpolating
> 600 dpi to 1200 dpi is ok in my mind.
> 
>> 2. What calls should an application make to determine if a scanner is
>> actually online and ready ? sane_start() followed by sane_cancel() ?
> 
> If the backend shows the scanner in its device list, it should be
> online at that point of time (sane_get_devices).
> 
> Why do you want to test it again later? If you do a real scan 2
> seconds after the test someone could have turned off the scanner in
> the meanwhile.
> 

Thanks for the info. The reason for both questions is because I'm writing a
TWAIN Data Source (for Mac OS X), that implements a SANE frontend.

The OS X Image Capture TWAIN bridge requires a TWAIN DS to provide values
for CAP_XNATIVERESOLUTION and CAP_YNATIVERESOLUTION. I guess all I can do is
return the highest resolution specified by the backend.

The Image Capture API also wants the the TWAIN DS to implement DEVICEONLINE
status, presumably for some UI indicator.

Checking if the scanner is in the device list isn't really going to work, as
that will only determine if the device is plugged in. Infact, the way the
API works on OS X, the data source will only ever be called if the device is
plugged in, and it will be pulled down if the device is unplugged, so it
will always be in the device list.

I could just return TRUE for that call, but I assume there may be some
scanners which won't scan until the lid is closed, or something like that.
Would sane_start() be enough to make sure the scanner is ready, or will it
only fail on the first call to sane_read() ?

Cheers,
Guy