Wykres commitów

128 Commity (pixma-axis-driver)

Autor SHA1 Wiadomość Data
Olaf Meeuwissen 090973fa94 Merge branch 'for-upstream/backend_avision_nonfilm_noexposure' into 'master'
backend/avision: Disable exposure option for non-filmscanners

See merge request sane-project/backends!23
2020-03-07 09:35:18 +00:00
Olaf Meeuwissen 960394b1e4 Merge branch 'for-upstream/backend_avision_fix_threading' into 'master'
backend/avision: fix thread cancellation

See merge request sane-project/backends!21
2020-03-07 09:25:59 +00:00
Rosen Penev c320a72e32
treewide: Replace mktemp by mkstemp
mktemp has been removed in POSIX 2008. uClibc-ng optionally does not make
it available.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-10-03 11:47:49 -07:00
Olaf Meeuwissen 296542905e avision: Fix threaded ADF flipping duplex handling. Re #24 2019-05-04 23:39:33 +09:00
Michael Niewoehner c16ff3ffe0 backend/avision: fix thread cancellation
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.
2018-10-28 12:36:35 +01:00
Michael Niewoehner 6d2dda4a98 backend/avision: Disable exposure option for non-filmscanners 2018-09-29 21:21:18 +02:00
Olaf Meeuwissen df1aba21bc SANE_Pid: Fix [-Wint-conversion] issues
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.
2017-07-15 14:47:54 +09:00
Olaf Meeuwissen 398d5850fa avision: Fix [-Wunused-const-variable=] compiler warning
The const variable's definition has been #ifdef'd to prevent loss of
protocol info.
2017-06-26 11:08:03 +09:00
Olaf Meeuwissen 0f70ce9aac avision: Fix [-Wunused-const-variable=] compiler warning
The threshold option which used the abs_percentage_range was removed
in e2169ec4.
2017-06-26 11:05:01 +09:00
Olaf Meeuwissen 23891a2646 .editorconfig: trim trailing whitespace 2017-05-29 21:14:29 +09:00
Dave Platt 755e829caa avision.c: abort "wait for light" loop if interrupted
Adds a "cancelled" flag to the Avision device structure, cleared
in sane_start() and set in sane_cancel().  Test this flag in
wait_4_light() and bail out of the 90-second "wait for the
light to warm up" loop if the scan is cancelled.
2016-12-15 23:12:07 -08:00
Dave Platt 28963459a4 avision.c: Recognize "backlight on" status
Avision scanners can return an additional light-status value meaning
"Transparent Media Adapter back-light is on".  Accept this as
equivalent to "on" during the lamp-warmup check prior to starting a
scan.  Re-check the light status after sending the window command, as
the light selection might have been changed and a further warm-up
may be required.
2016-12-15 23:02:42 -08:00
Dave Platt 6585b6f60d avision.c: Add "skip-adf" option
The code which tries aggressively to reset/initialize HP 82xx/83xx
Automatic Document Feeders doesn't work well if there's no ADF attached,
because the scanner reports a non-zero ADF model type in this case.
The retry code makes several attempts to initialize the ADF, and then
bails out with an "Operation not supported" error.

Add a new "option skip-adf" which will cause the backend to believe
the "ADF not present" status if that's what the scanner reports.

Fixes #313751
2016-12-15 22:56:09 -08:00
Olaf Meeuwissen 592430016c avision: fix [-Wunused-but-set-variable] compiler warning
The variable seems to have been superseded by conv_out_size in the
else branch of set_calib_data().
2015-12-27 18:38:40 +09:00
Olaf Meeuwissen e094c5b43b Invert sense of sanei_thread validity check
Double negatives suck.
2015-11-24 18:19:31 +09:00
Olaf Meeuwissen fe12d31e68 Fix SANE_Pid related -Wsign-compare warnings
This may fix threading related issues on WIN32 platforms, BTW.
2015-11-24 18:19:31 +09:00
René Rebe ca97cb22bd reverted 4d38523bda, the long commit message
is a nice fairy tale, not more - of course the ponter deref copies the whole
params, and most other packends do it the same way: grep *params *.c, and
consult your local C "assembler frontend" bible, ...
2015-03-07 18:56:54 +00:00
René Rebe f69a1ad50e removed unnecessary feature_type2 clutter by using a uint64_t to share all bits 2015-03-07 11:16:47 +00:00
René Rebe e05607323d fixed duplex for some avision scanners 2015-03-07 10:50:36 +00:00
René Rebe d5c7e22328 fixed multiple Avision regressions: most scanner basically did not
work at all anymore, ... range initilaizer, clobbering paper-length
window bits, ...) introduced over the past years, added support for
newer ASIC gamma table size, added AV220D2+ ID
2015-03-07 05:07:27 +00:00
Rolf Bensch 681c8366b5 Remove firmware checking for HP5370c scanners 2014-11-15 14:40:49 +01:00
Mike Kelly d46d19808c Bumped version number. 2012-03-25 15:05:00 -07:00
Mike Kelly 2903d6687c Fixed bug using wrong enum in x/y range check.
In the "check if x/y ranges are valid" section of the attach() function, the
enum source_mode was being used instead of source_mode_dim.  Since these two
enums are very similar, it's not likely this change will affect anything, but
it does fix the compiler warning.
2012-03-25 15:04:00 -07:00
Mike Kelly bd7faf0917 Fixed warning about printf and size_t. 2012-03-25 15:03:00 -07:00
Mike Kelly 23ecd9bc5c Reverted AV610 USB IDs and removed AV_INT_STATUS
Previously I had changed the USB ID of this scanner from 0x0a18 back to
0x0a19, believing a previous commit to have been in error since it went
unmentioned in the commit log and duplicated the AV600U Plus scanner's USB
IDs.  Rolf Würdemann reported that his AV610 scanner used the 0x0a18 ID and
that it wasn't compatible with the AV_INT_STATUS flag.  This commit reverts
my USB ID changes and removes the AV_INT_STATUS flag for the AV610.

However, because this scanner shares its USB ID with the AV600U Plus, it's
possible that the AV600U Plus may require that the AV_INT_STATUS flag be set
in order to function, and thus will break with this change.  The code, as
it's written, isn't designed to deal well with the possibility of shared USB
IDs, so I'll wait to see if this actually becomes a problem before embarking
on the lengthy challenge of getting that to work.
2012-03-25 15:02:00 -07:00
Mike Kelly fec4800d7d Added firmware checking for HP5370c scanners 2012-03-25 15:01:00 -07:00
Mike Kelly b051c955e3 Added Xerox Documate 632. 2012-03-25 15:00:00 -07:00
Mike Kelly a66812940c Bumped build number. 2012-03-21 21:07:00 -07:00
Mike Kelly 557d60f156 Keep the number of lines to flip as a negative num
Keep track of the number of lines to flip on the reverse page using a negative
number.  This uses the ill-advised principle of overloading the meaning of a
variable.  Still, it kind of makes sense because these lines are upside down,
so the number should be "upside down" too.  Besides, leaving it as a positive
number trips up the code which does page padding, which would require even
more special case code.
2012-03-21 21:06:00 -07:00
Mike Kelly 0245820f6b Fix calculations when flipping back of duplex page. 2012-03-21 21:05:00 -07:00
Mike Kelly 983d44887c Corrected the logic to set lines = -1 for ADF mode. 2012-03-21 21:04:00 -07:00
Mike Kelly 33bb529c5f Added sane_reload_devices() to sane_init().
Adding sane_reload_devices() to sane_init() required sane_init() to be moved
below the sane_reload_devices() declaration.  This restores the original
functionality present before I split the sane_reload_devices() code out of
sane_init() so that it could be called from sane_get_devices().
2012-03-21 21:03:00 -07:00
Mike Kelly 11b3604e92 Moved a comment nearer its code. 2012-03-21 21:02:00 -07:00
Mike Kelly 0ab145c316 Skip post-processing when caching flipping duplex
In a previous patch, I attempted to avoid the possibility of a page remaining
partially inside the ADF unit of a flipping duplex scanner after a scan.
Unfortunately, I introduced a bug where the backside page was accidentally
returned to the client in addition to being cached.  This was because I had
a misunderstanding of the post-processing code.  This patch skips the post-
processing section altogether, avoiding any unnecessary post-processing and
subsequent unwanted output.  The other alternative here was to try to monkey
with the buffers (as is done for LINE deinterlacing), but I felt this would
be harder to implement and even harder to debug in the future.
2012-03-21 21:01:00 -07:00
Mike Kelly 0e159fc516 Added Gray mode support for Kodak i30 and i40. 2012-03-21 21:00:00 -07:00
Nils Philippsen c648a4411e avision: reenable grayscale and lineart modes for AV220
See https://bugzilla.redhat.com/show_bug.cgi?id=700725
2011-11-18 12:17:22 +01:00
Mike Kelly 8e623c473e Bumped the BUILD version 2011-01-29 11:50:17 +09:00
Mike Kelly edcf4cbadb Fixed initialization and duplexing for AV220-G
This fix correctly initializes the AV220-G by querying the firmware.
Added the correct option to support the interlaced duplex format used by
this unit.
2011-01-29 11:50:15 +09:00
Mike Kelly d7b3076142 Add page re-flipping as an option
Flipping duplex scanners must flip the page in order to scan the back side
of the page.  With this option set (which is the default), the page is
flipped back to the original orientation.  This is important if you have
a stack of papers.  However, if you don't care if every page ends up
flipped compared to how it was loaded, turning this option off might save
some scanning time as the paper won't have to be pulled back through the
ADF mechanism a third time.
2011-01-29 11:50:14 +09:00
Mike Kelly b82e9949b5 Fixed back page handling for flipping duplexers
Although the flipping duplexer is working, there are some issues relating to
the mechanics of physically flipping paper.  First among these is that the
back side of each page is physically scanned in reverse, resulting in an
upside down image.  Secondly, the page is held partially in the ADF
mechanism while waiting for the frontend to make another scan request for
the back side image, thus resulting in a stuck page if the frontend fails to
follow through.

My solution to these problems is to treat page flipping as an extreme
extension of interlaced scanning; page level interlacing.  This means making
another scan request on behalf of the frontend, and writing the resulting
image to a file as would have been done if the page were line interlaced.
We would have had to write this image to a file anyway to flip the image
right-side up, so we aren't doing any extra work, and technique allows us to
reuse existing code for most of the file handling.  The reader_process()
function is called again (recursively) after scanning the front page.  We
use the page length of the front side to determine the length of the back,
so that we can write the lines to the file starting at the end and working
towards the beginning (thus flipping the image).

A side effect of this solution was the discovery that the scanner must be
reminded that the paper needs to be re-flipped after each scan, so
set_window() must also be called in reader_process() before starting the
second scan.

Finally, with this change, a minor bug was exposed where frontends were
given the number of lines which would be scanned, which makes sense in
flatbed mode, but does not make sense for an ADF, where the page may be
smaller than the scan window.  The code was changed to follow the
specifications, returning -1 in ADF mode (when the length cannot be
determined).
2011-01-29 11:50:13 +09:00
Mike Kelly 104b43a183 Removed inquiry_adf_need_mirror_rear variable
After fixing the duplexer initialization, it became clear that the code was
mirroring the back pages.  Since the scanner already supports page
mirroring internally with an optional bit setting (which was already set)
it made the most sense to simplify the code base and remove the variable.
2011-01-29 11:50:12 +09:00
Mike Kelly 1b1b0b9a78 Fixed flipping duplexer initialization
For scanners which potentially have flipping duplexers, only enable
duplexing if there is an ADF present.  This leads to the next problem, that
the flipping duplexers (present only on the HP 8200 series AFAIK) don't
always seem to be properly configured when powered up.  To solve this some
magical values are written to magical memory locations, and some more
magical status is read back, causing an apparent firmware reset which
blocks communication for a short period of time.  See adf_reset() for
details.
2011-01-29 11:50:11 +09:00
Mike Kelly 12924236c6 Enable firmware reading for some scanners.
Sometimes scanners like to have their firmware read to cause them to
function properly.
2011-01-29 11:50:10 +09:00
Mike Kelly 1b1df46e41 Add feature type for flipping duplexing ADF units
Added the AV_ADF_FLIPPING_DUPLEX flag to activate the flipping duplex code
only for models known to have such duplexing ADFs.  Prior to this a doubious
huristic was used to guess when the hardware had a flipping duplex unit.
2011-01-29 11:50:09 +09:00
Mike Kelly 1904dad962 Removed additional_probe gatekeeper variable
The additional_probe variable protected add_source_mode() and
add_color_mode() from being entered upon subsequent calls.  These functions
were patched to not insert duplicate records in this case, removing the
need for the gatekeeper variable.
2011-01-29 11:50:08 +09:00
Mike Kelly 4d38523bda Return copied values in sane_get_parameters()
Until now the code has been changing the frontend supplied pointer to point
to our internal data structure.  There are two problems with this.  It
orphans the data previously associated with that pointer, which causes a
memory leak.  It also gives the frontend the ability to munge our internal
data structure.

The only downside to this change is the possibility that a frontend took the
spec too literally and merely supplies a pointer but does not allocate
storage space for the result.  Technically, the spec is a bit vague on this
point, because it does not specifically state who should allocate the
structure, but I feel a reasonable programmer would guess that space
allocation is a frontend obligation.
2011-01-29 11:50:07 +09:00
Mike Kelly 64caf38683 Don't compute parameters twice (in a row)
Removed a redundant call to compute parameters.  This function is called
from within the last function call, no need to call it again.
2011-01-29 11:50:06 +09:00
Mike Kelly b45400222d Added paper-length option to prevent double feeds
There was an old TODO in the code which suggests creating an option for using
the paper_length field to detect double feeds in the ADF.  I've added it as
an option, but set the default to not use it since it might cause older
scanners to get confused.
2011-01-29 11:50:05 +09:00
Mike Kelly 42cdb00aa1 Added a Misc option group to hold misc features
I felt that the ehancements group was doing double duity for image tuning and
other more hardware related options.  This new group takes ownership of those.
I'm not happy with the name, but that can always be changed.
2011-01-29 11:50:04 +09:00
Mike Kelly d48f749cae Fixed debug level for a single message
There is no reason that this message needs to be triggered at 100 when
everything else only goes to 9.
2011-01-29 11:50:03 +09:00