[sane-devel] [BUG] Duplicate SANE_NAME in saneopts.h

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Wed Jul 9 00:31:50 UTC 2008

Checking out why setting X/Y resolutions independently didn't quite
work as expected, I discovered that saneopts.h has this:

  #define SANE_NAME_SCAN_RESOLUTION	"resolution"
  #define SANE_NAME_SCAN_X_RESOLUTION	"resolution"
  #define SANE_NAME_SCAN_Y_RESOLUTION	"y-resolution"

That means that trying to set the X resolution always does the same
thing as setting the scan resolution.  I think that is incorrect in
the general case and suggest the above gets changed to:

  #define SANE_NAME_SCAN_RESOLUTION	"resolution"
  #define SANE_NAME_SCAN_X_RESOLUTION	"x-resolution"
  #define SANE_NAME_SCAN_Y_RESOLUTION	"y-resolution"

So that backend implementations can distinguish these cases if they
want to.  The corresponding descriptions for these option hint that
setting the image's scan resolution is not necessarily the same as
setting the horizontal scan resolution.

In my particular situation, I have a use case where it makes sense to
use SANE_NAME_SCAN_RESOLUTION with one set of allowed resolutions and
different sets of allowed resolutions for the individual horizontal
and vertical resolution settings.

On a more general note, there is no point in having different option
name macros that resolve to the same name.  All of the SANE_NAME_*
macros should be unique.  At the moment (sane-backends-1.0.19), only

I don't think that the suggested change will break any of the current
backends and frontends, but would like to ask everyone to take a look
and comment on my suggestion before I file a bug report.

Hope this helps,
Olaf Meeuwissen                   FLOSS Engineer -- AVASYS Corporation
FSF Associate Member #1962           sign up at http://member.fsf.org/

More information about the sane-devel mailing list