Package: libsane
Version: 1.0.25-2+b1bfw1
Severity: important
Tags: patch
Dear maintainer,
the following problem caused our Canon LiDE 210 to produce loud noises by the
motor until the scanner is manually turned off or to abort with the message
"Error during device I/O".
I refer to version 1.0.25-2 and 1.0.25-4.1 but also tested with the newest
changes in the genesys-backend from experimental / git.
I think this is the problem causing the behaviour:
In the "attach" function in genesys.c the memory for the Genesys_Device-struct
is allocated by malloc and "already_initialized" is set to false.
However, as far as i can see, the usb_mode member is never initialized
before "sanei_genesys_asic_init" in genesys_low.c is accessing it. Here it is
wrongly assumed that it should be >= 0, otherwise the whole
part which decides which usb mode is used is going to be skipped and the value
stays as it is.
This leads (if, as in my case, usb_mode is < 0) to the described behavior,
since for example now in genesys_gl124.c "gl124_slow_back_home" simply returns
with SANE_STATUS_GOOD (is there maybe a surrounding #ifdef UNIT_TESTING macro
missing?) which I think
is not correct.
It seems likely to me that this is also reason for the behaviour described in
bug #792465.
Simply initializing the Genesys_Device-Struct with 0's via memset after calling
malloc or
just setting usb_mode to 0 is solving the problem for me:
diff --git a/backend/genesys.c b/backend/genesys.c
index 984cead..eb8695a 100644
--- a/backend/genesys.c
+++ b/backend/genesys.c
@@ -210,6 +210,8 @@ sanei_genesys_init_structs (Genesys_Device * dev)
dev->model->motor_type);
}
+ dev->usb_mode = 0;
+
/* set up initial line distance shift */
dev->ld_shift_r = dev->model->ld_shift_r;
dev->ld_shift_g = dev->model->ld_shift_g;
-- System Information:
Debian Release: 9.0
APT prefers testing
APT policy: (550, 'testing'), (500, 'stable'), (210, 'unstable'), (1,
'experimental')
Architecture: i386 (x86_64)
Kernel: Linux 3.17.8-64+ (SMP w/32 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968), LANGUAGE=C
(charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages libsane depends on:
ii acl 2.2.52-3+b1
ii adduser 3.115
ii libc6 2.24-11+deb9u1bfw1
ii libgphoto2-6 2.5.13-3
ii libgphoto2-port12 2.5.13-3
ii libieee1284-3 0.2.11-13
ii libjpeg62-turbo 1:1.5.1-2
ii libsane-common 1.0.25-2+b1bfw1
ii libtiff5 4.0.8-2
ii libusb-1.0-0 2:1.0.21-1bfw1
ii udev 232-25
Versions of packages libsane recommends:
pn libsane-extras <none>
ii sane-utils 1.0.25-2+b1bfw1
Versions of packages libsane suggests:
pn avahi-daemon <none>
pn hplip <none>
-- Configuration Files:
/etc/sane.d/canon_dr.conf changed [not included]
/etc/sane.d/dll.conf changed [not included]
/etc/sane.d/epjitsu.conf changed [not included]
/etc/sane.d/epson2.conf changed [not included]
/etc/sane.d/fujitsu.conf changed [not included]
/etc/sane.d/genesys.conf changed [not included]
/etc/sane.d/gt68xx.conf changed [not included]
/etc/sane.d/kodakaio.conf changed [not included]
/etc/sane.d/net.conf changed [not included]
/etc/sane.d/xerox_mfp.conf changed [not included]