[sane-devel] Are options consistent across all backends?
m. allan noah
kitno455 at gmail.com
Thu May 21 19:00:12 UTC 2009
On Thu, May 21, 2009 at 2:53 PM, Mark Pemburn <mark at pemburn.com> wrote:
> Thanks Allan --
> I suspected this was the case. The "don't assume anything" mantra is
> beginning to sink in. My concern was how to populate controls with the
> appropriate values retrieved from the constraints -- but I see that it's
> actually not that hard. It should be a matter of creating a class that has
> methods to create one kind of control if the constraints are in a range and
> another if it's a list, with variations for different kinds of lists. Save
> a lot of coding if I design it well.
> Another quick question that just came to light -- the Canon (plustek
> backend) returns the following SANE_CONSTRAINT_WORD_LIST from the "depth"
> . . . as far as I know, only the values 8 and 16 are valid bit depths (for
> this scanner) and that's what I get when I do "scanimage --help". Do you
> know what the other values mean?
they mean that you need to read the sane spec:
"The first element in that list is an integer (SANE_Int) that
specifies the length of the list (not counting the length itself)."
> m. allan noah wrote:
> On Thu, May 21, 2009 at 1:24 PM, Mark Pemburn <mark at pemburn.com> wrote:
> Hi All,
> The marvels of the SANE standard are starting to become clearer to me and
> I'm making good progress in getting and setting the various device options
> in my OS X interface project. However, since I have only the one Canon
> N670U scanner to play with (at the moment, anyhow -- I'm borrowing a Fujitsu
> fi5110c from a client), I have no way to compare how options are treated
> from one device to another. Should I be able to assume that say, the
> "resolution" option will _always_ have a constraint type of
> SANE_CONSTRAINT_RANGE with a "min", "max" and a "quant" showing the steps
> between or that "mode" will consistently provide a string list of supported
> modes? If not, are there any guidelines that would help the interface
> programmer work around such things?
> The only 'standard' options are the 'well-known' options listed in the
> sane spec, and that is sometimes just the names. But, a backend is
> free to exclude those options, or implement them in a different way.
> For instance, the fujitsu backend shows the resolution as
> SANE_CONSTRAINT_RANGE when your machine supports it, but for older
> machines, you will get a SANE_CONSTRAINT_WORD_LIST, since they only
> support a few fixed resolutions. So, dont assume anything :)
> The reason that the options are so descriptive is exactly so that you
> WONT have to code things specific to that option. That said- there is
> still some room for improvement/consistency.
"The truth is an offense, but not a sin"
More information about the sane-devel