This version is a refactor using bits and pieces from the prototype.
Converted from C to C++ to make code reuse easier.
Will do gray/errdif/text scanning on the test MFC-J4320DW machine.
Cancel function added.
When repos are forked on GitLab tags aren't copied (0 Tags) thus making
git-version-gen producing incorrect version ("UNKNOWN") which in turn
causes CI build failures (not helpful for people trying to make Merge
Requests). To workaround this issue reconstruct version from ChangeLogs
files (handy updated on every release). If git describe is not working
and we are not in dist package - take version from the top-most
ChangeLog file.
Example of error messages:
../libtool: line 1168: UNKNOWN + : syntax error: operand expected (error token is "+ ")
In file included from net.c:83:
net.c: In function 'connect_dev':
<command-line>: error: 'UNKNOWN' undeclared (first use in this function)
../include/sane/sane.h:31:21: note: in definition of macro 'SANE_VERSION_CODE'
31 | ( (((SANE_Word) (major) & 0xff) << 24) \
| ^~~~~
net.c:485:41: note: in expansion of macro 'V_MAJOR'
485 | req.version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR,
| ^~~~~~~
It's confirmed that neither Alpine nor Musl will fix ioctl warnings[1]
that making alpine build to fail and that these warnings are
harmless[2].
sanei_usb.c:4042:34: error: overflow in conversion from 'long unsigned int' to 'int' changes value from '3221771554' to '-1073195742' [-Werror=overflow]
4042 | if (ioctl (devices[dn].fd, SCANNER_IOCTL_CTRLMSG, &c) < 0)
| ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Link: https://gitlab.alpinelinux.org/alpine/aports/-/issues/7580
Link: https://www.openwall.com/lists/musl/2020/01/20/3
Some xerox_mfp scanners, such as Samsung SCX-4521F, hangs when
their OUT ENDPOINT receives CLEAR HALT command, which is performed
in usb open and close functions of the backend.
The issue seem to be dependant on USB controller and assumingly
happens due to some sort of incompatibility of USB implementation
in the scanner.
Skip sending this command by default and add
SANE_XEROX_USB_HALT_WORKAROUND env variable to execute
CLEAR HALT commands.