[sane-devel] hp5590: Scan aborts when using default page size
Olaf Meeuwissen
olaf.meeuwissen at avasys.jp
Thu May 29 23:25:29 UTC 2014
Rainer Keller writes:
> Hi,
>
>> The SANE API only provides for SANE_UNIT_MM for lengths. Just looking
>> at your patch, the *original* code seems to be correct. The real bug is
>> somewhere else in the hp5590 backend.
>
> Ok, thanks for the hint.
> Given that all lengths are in millimeters, isn't multiplying mm with dpi wrong
> then? In this backend there are some places where this happens:
>
> e.g. backend/hp5590.c:1053
> scanner->tl_x * scanner->dpi,
> scanner->tl_y * scanner->dpi,
> (scanner->br_x - scanner->tl_x) * scanner->dpi,
> (scanner->br_y - scanner->tl_y) * scanner->dpi,
OK, so I had a look at hp5590.c rather than just your patch. Looks like
your patch was good after all.
I'd rashly assumed that the backend kept the values of scanner->tl_x and
friends in the same units as the SANE API spec provides. Turns out that
that is *not* the case. It keeps these in inches throughout the code so
the calculation you quote above are fine. The backend's SANE options
convert from and to SANE_UNIT_MM (in sane_control_option) when accessing
these values so the backend user only sees SANE_UNIT_MM values.
The range_x and range_y values are part of the SANE option and have to
be defined in SANE_UNIT_MM. This discrepancy threw me off, and did the
same with however implemented the ADF support apparently ;-|
Hope this helps (and sorry for the confusion),
--
Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962 Help support software freedom
http://www.fsf.org/jf?referrer=1962
More information about the sane-devel
mailing list