Some of the status code checks also check that the returned data is
of the expected size. However, if they are not, it is possible to
return SANE_STATUS_GOOD in error. We should generate an appropriate
error code other than SANE_STATUS_GOOD for this case.
These were intended to suppress GCC warnings about unused variables.
However, this leads to different warnings from Clang instead.
Use another approach that suppresses warnings from both compilers.
Backends use a mixture of SANE_CURRENT_{MAJOR | MINOR} and V_{MAJOR |
MINOR} with all kind of permutations. I was confused by this and one
comment in pieusb.c tells me I was not alone. Some items in old
changelogs suggest to use the SANE_CURRENT_ macros in backends, so let's
switch to do that with the exception of net.c and dll.c. Done with:
$ find backend -name '*.[ch]' | xargs sed -i '/nearly every/ ! { s/\<V_M/SANE_CURRENT_M/g }'
$ git checkout backend/net.c backend/dll.c
And manually removing the comment from pieusb.c. Everything still builds
fine.
Define a new enum that contains Avision data type codes and use those instead
of pure values. I also added a couple of helper functions for debugging the
command operation and data type code if read or send.
With the exception of use in three quotes as well as our inlcuded copy
of the GPL, all use of the Free Software Foundation's postal address
has been removed.
Re #320.
de19ebc introduced a regression, where some scanners would lock-up
completely and require a full power cycle.
To fix that, do not call release_unit for any scanners not supporting
fastfeed for now, since that leads to lock-ups on at least one device.
Currently, it isn't clear what exactly is causing the problems, so it
maybe be enabled in a correct way again, later.
Resolves issue !337.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
i1120 has another offset. When scanning in ADF multi-page mode (the
default), the very first sheet is moved 1.5mm down. That leads to 1.5mm
being cut off at the bottom.
This implements the (hopefully last) offset setting for multi-sheet ADF
scans.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
This adds offset compensation for ADF front-only scans, which may
have different offsets than ADF duplex scans.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
This is a complete rewrite of the offset compensation using a
combination of overscan and line skipping. It replaces the option
AV_REAR_OFFSET by specifying exact offset values for each scanner.
This was needed for Kodak i1120 which needs bottom line skipping.
The old implementation could not skip bottom lines since we could
not know how many lines we will get in the end from ADF.
The new implementation redirects the output file descriptor to a
temporary file. After the current page is completely scanned,
offsets are applied and the output is passed to the original
output file descriptor.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Kodak i1120 has single-sheet and multi-sheet scan modes. This option sets
bitset3[7] which enables multi-sheet scan by default so there is no pause
of 1s between two sheets in ADF scan mode. This also fixes some offsets
when scanning multiple sheets.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Kodak i1120 has a different gamma table format that looks like a
uint16/double array. Implement it and add an option for it.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Some scanners like i1120 support fast feed-out of the sheet when
cancelling a running scan. Add a new option for this release type.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
Kodak broke rear-only scan (bitset3[3]) when they modified the Avision
firmware. It would be possible to add a work-around that drops front data and
writes rear data only. Because of deinterlacing, offsets etc. this is way too
complicated. The simpliest solution to scan rear-only is to turn around the
paper stack and use front scan instead.
Signed-off-by: Michael Niewöhner <foss@mniewoehner.de>
sigprocmask does not work for threads but only for forked processes.
Even though a thread-safe version, pthread_sigmask, we do not use it
since using singals with threads is a bad practice. Instead implement
pthread's own cancellation method. Because sane_read blocks when
reader_process is terminated, read_fds is closed and invalidated to
make sane_read abort read and return gracefully.
Not all pthreads implementations use an integer type for pthread_t.
As a matter of fact, POSIX has explicitly withdrawn the requirement
that it must be an arithmatic type.
The musl C library uses a `struct __pthread *` which triggered the
warnings. As of this change, sanei_thread.h works around this by
providing two new macros to help keep this issue out of sight. All
backends have been changed to use these macros.