Hello Sane-devel,

I have an Epson CX5200 MFP. Upon upgrading to libsane 1.0.18 and libusb
0.1.12, I cannot use the scanner.

I traced the problem to epson.c's get_identity2_information() where it
fails due to an "incorrect" value in the return buffer. My cx5200, along
other users cx5200s, has 0xb0 (176) in buf[0] which has the most
significant bit (0x80) set.

Since this scanner worked with libsane 1.0.17 and libusb 0.1.10, and the
check for the most significant bit was always done, I suspect that
libusb now handles MFP devices differently. Attached email has a simple
patch which allows CX5200 to work without problems.

Patched libsane works correctly and with the same extents, color depths
and dpi options which were available with libsane 1.0.17 and libusb
0.1.10.

Attached is a full debug output of scanimage -L with the following env:
  SANE_DEBUG_DLL=256
  SANE_DEBUG_SANEI_USB=256
  SANE_DEBUG_EPSON=256

Please note that the first byte of the 88 byte buffer contains (0xb0)
which was rejected by get_identity2_information() without my patch.

Thanks, Michal

-- 
Michal "Saahbs" Sabala
-------------- next part --------------
An embedded message was scrubbed...
From: Michal Sabala <[email protected]>
Subject: recompiled libsane with debugging symbols and stepped through the
        code...
Date: Mon, 18 Dec 2006 12:16:26 -0600
Size: 3087
Url: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20061219/64e5933f/attachment.mht
-------------- next part --------------
An embedded message was scrubbed...
From: Michal Sabala <[email protected]>
Subject: Re: Bug#399119: recompiled libsane with debugging symbols and stepped
        through the code...
Date: Tue, 19 Dec 2006 09:08:52 -0600
Size: 2926
Url: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20061219/64e5933f/attachment-0001.mht
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patched-libsane-full-debug.log.gz
Type: application/octet-stream
Size: 3345 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20061219/64e5933f/patched-libsane-full-debug.log.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sane-backends-1.0.18-epson_cx5200.patch
Type: text/x-diff
Size: 564 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20061219/64e5933f/sane-backends-1.0.18-epson_cx5200.bin
From [email protected]  Tue Dec 19 19:23:35 2006
From: [email protected] (=?ISO-8859-1?Q?=C9tienne?= Bersac)
Date: Wed Dec 20 00:50:28 2006
Subject: [sane-devel] SANE2 commitment
In-Reply-To: <1166374131.5549.12.camel@thilivren>
References: <20061215175700.4c974c89@inspiron>
        <[email protected]>
        <20061217172351.70067897@inspiron>
        <1166374131.5549.12.camel@thilivren>
Message-ID: <1166552615.5681.90.camel@thilivren>

Note : I wrote this mail a few days before i discover the work of Martin
Owen in HAL scanner support. sorry for the distribution problems.
-- 
Verso l'Alto !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
        =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20061219/eb361c48/attachment.pgp
From [email protected]  Wed Dec 20 00:53:14 2006
From: [email protected] (Olaf Meeuwissen)
Date: Wed Dec 20 00:54:06 2006
Subject: [sane-devel] CX5200 problem ...[[email protected]: recompiled
        libsane with debugging symbols and stepped through the code...]
In-Reply-To: <20061219161427.GB30266@prosiaczek> (Michal Sabala's message of
        "Tue, 19 Dec 2006 10:14:27 -0600")
References: <20061219161427.GB30266@prosiaczek>
Message-ID: <[email protected]>

Michal Sabala <[email protected]> writes:

> I traced the problem to epson.c's get_identity2_information() where it
> fails due to an "incorrect" value in the return buffer. My cx5200, along
> other users cx5200s, has 0xb0 (176) in buf[0] which has the most
> significant bit (0x80) set.

You can just remove the if block.  I think it got in there by analogy
of the check_ext_status() function.  There the first byte of the reply
has a bunch of flags in the first byte and 0x80 signals a fatal error.

With the get_identity2_information() the first two bytes hold the
optical resolution (as can be infered from the code, see below).

  /* from get_identity2_information() */
  receive (s, buf, len, &status);       /* reveive actual status data */

  if (buf[0] & 0x80)
  {
    close_scanner (s);
    return SANE_STATUS_INVAL;
  }

  /* the first two bytes of the buffer contain the optical resolution */
  s->hw->optical_res = buf[1] << 8 | buf[0];


# BTW, the epkowa backend does this correctly.

Hope this helps,
-- 
Olaf Meeuwissen                          EPSON AVASYS Corporation, SE1
FSF Associate Member #1962           sign up at http://member.fsf.org/
GnuPG key: 6BE37D90/AB6B 0D1F 99E7 1BF5 EB97  976A 16C7 F27D 6BE3 7D90
Penguin's lib!       -- I hack, therefore I am --               LPIC-2

Reply via email to