Re: [sane-devel] 39ceeae6 breaks md5 auth

2018-01-02 Thread Olaf Meeuwissen
Hi James,

Thanks for the report.

James Ring writes:

> Confirmed that with the offending patch, md5.c produces incorrect
> digests for known input/output pairs. We should roll it back.
>
> Also I couldn't reproduce (with gcc 7.2.0) the compiler warning that
> the original change was supposed to fix.

Hmm, neither can I.  In neither the debian-8-mini nor debian-9-mini CI
environments.  But you can still see it in the CI logs for the last
pipeline that ran before the offending commit.

  https://gitlab.com/sane-project/backends/pipelines/4150861

Only the fedora-24-clang log doesn't have it.

> On Tue, Jan 2, 2018 at 9:57 AM, James Ring  wrote:
>> [...snip...]
>>
>> Reverting that commit restores the functionality. I haven't figured
>> out what the problem is from a cursory inspection of the code, I'll
>> continue staring at it.

I was about to revert the commit but looking at it now I'm wondering
what I was thinking when I committed that :-(  Changing the pointer
type to something of a different size *obviously* screws up the array
indexing!

I've cooked up a fix for that (based on e895ee55).  Could you give the
attached patch a try?

Hope this helps,
--
Olaf Meeuwissen, LPIC-2FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Softwarehttps://my.fsf.org/donate
 Join the Free Software Foundation  https://my.fsf.org/join
>From 3651d8c6cd943a1d046e2625bb7bf2eca6f91c42 Mon Sep 17 00:00:00 2001
From: Olaf Meeuwissen 
Date: Wed, 3 Jan 2018 16:13:16 +0900
Subject: [PATCH] Fix array indexing.

This fixes a glaring oversight in 39ceeae6.  Thanks to James Ring for
reporting this.
---
 lib/md5.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/md5.c b/lib/md5.c
index 72b36f35..923a17c7 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -123,6 +123,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
   /* Take yet unprocessed bytes into account.  */
   md5_uint32 bytes = ctx->buflen;
   size_t pad;
+  size_t offset;
 
   /* Now count remaining bytes.  */
   ctx->total[0] += bytes;
@@ -133,9 +134,11 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
   memcpy (>buffer[bytes], fillbuf, pad);
 
   /* Put the 64-bit file length in *bits* at the end of the buffer.  */
-  ((md5_uint32 *) ctx->buffer)[bytes + pad] = SWAP (ctx->total[0] << 3);
-  ((md5_uint32 *) ctx->buffer)[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
-			(ctx->total[0] >> 29));
+  offset = (bytes + pad) / sizeof (md5_uint32);
+  ((md5_uint32 *) ctx->buffer)[offset] = SWAP (ctx->total[0] << 3);
+  offset = (bytes + pad + 4) / sizeof (md5_uint32);
+  ((md5_uint32 *) ctx->buffer)[offset] = SWAP ((ctx->total[1] << 3) |
+	   (ctx->total[0] >> 29));
 
   /* Process last bytes.  */
   md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
-- 
2.11.0

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
 to sane-devel-requ...@lists.alioth.debian.org

Re: [sane-devel] 39ceeae6 breaks md5 auth

2018-01-02 Thread James Ring
Confirmed that with the offending patch, md5.c produces incorrect
digests for known input/output pairs. We should roll it back.

Also I couldn't reproduce (with gcc 7.2.0) the compiler warning that
the original change was supposed to fix.

On Tue, Jan 2, 2018 at 9:57 AM, James Ring  wrote:
> Hi Olaf,
>
> I was trying to find out why authentication to a local test device
> does not work with my frontend on Ubuntu 17.10.
>
> $ scanimage -d net:localhost:test
> scanimage: open of device net:localhost:test failed: Access to
> resource has been denied
>
> Both saned.users and $HOME/.sane/sane.pass contain the following line:
>
> testuser:goodpass:net:localhost:test
>
> I tried building sane 1.0.27 from source and could reproduce the
> error. 1.0.24 built from source did not show the issue. Bisecting
> reveals that the culprit is
>
> https://anonscm.debian.org/git/sane/sane-backends.git/commit/?id=39ceeae616a2e1638c2760d4364adcaa210a413b
>
> Reverting that commit restores the functionality. I haven't figured
> out what the problem is from a cursory inspection of the code, I'll
> continue staring at it.
>
> Thanks,
> James

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
 to sane-devel-requ...@lists.alioth.debian.org


Re: [sane-devel] Epson XP-860 Scan to Computer (PDF) function

2018-01-02 Thread Kip Warner
On Tue, 2018-01-02 at 10:08 +0100, Louis Lagendijk wrote:
> Device initiated scans require a daemon on the computer that knows
> what to do when the button on the scanner is pushed. Please have a
> look scanbd https://sourceforge.net/projects/scanbd/. Scanbd is
> designed on top of sane. The deamon continuously polls the scanner to
> see if work needs to be done. It will then use saned to do the actual
> scanning. Results will be stored on disk in the resolution you
> configured in the scanbd configuration.
> 
> Xsane does have a button-controlled scan option that allows it to
> wait for a key press as well. But that is used to delay scanning
> until the key on the scanner is pressed. 

Thank you kindly, Louis.

-- 
Kip Warner | Senior Software Engineer
OpenPGP signed/encrypted mail preferred
http://www.thevertigo.com


signature.asc
Description: This is a digitally signed message part
-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
 to sane-devel-requ...@lists.alioth.debian.org

Re: [sane-devel] ask for adding support of Canon's i-SENSYS MF620 series

2018-01-02 Thread Markus Heiser

> Am 02.01.2018 um 12:52 schrieb Markus Heiser :
> 
> Hi SANE developers,
> 
> I'am trying to scan from a Canon MF623Cn which is a AIO device
> from Canon's i-SENSYS MF620 series. It can be connected by USB
> or LAN.
> 
> First I tried USB // MF620 series is not yet listed in:
> 
> - http://www.sane-project.org/lists/sane-backends-cvs.html nor in
> - 
> https://anonscm.debian.org/git/sane/sane-backends.git/tree/doc/descriptions/pixma.desc
> 
> I'am a bit confused by the naming 'i-SENSYS' and 'PIXMA' from
> SANE's POV. What is the difference (or is there a difference)
> between i-SENSYS and PIXMA? Especially, can we use the bjnp
> protocol (bjnp://myscanner.my.domain:8612) for Canon's i-SENSYS
> devices when connected via IP?
> 
> Back to USB, I test the device on Ubuntu's 16.04 LTS // sane-find-scanner
> from sane-backends 1.0.25git gives me::
> 
> found USB scanner (vendor=0x04a9 [Canon,Inc.], product=0x27b4 [MF620C 
> Series]) at libusb:003:003
> 
> For the full output see below.
> 
> Now I ask you SANE developer's for adding support of Canon's i-SENSYS
> MF620 series. If you needed testers, I can test USB & LAN scenarios
> with my MF623Cn.
> 
> Thanks!
> 
> Sidenote, I looked at commit 879565 [1]:
> 
>  "new scanners Canon i-SENSYS MF230 and MF240 Series
> 
> is this all we need, adding a define MF620_PID (with 0x27b4)
> to backend/pixma_imageclass.c?

I applied the following naive patch:

--
modified   backend/pixma_imageclass.c
@@ -105,6 +105,7 @@
 #define MF210_PID  0x27a9
 #define MF230_PID  0x27d1
 #define MF240_PID  0x27d2
+#define MF620_PID  0x27b4
 
 
 enum iclass_state_t
@@ -944,5 +945,6 @@ const pixma_config_t pixma_iclass_devices[] = {
   DEV ("Canon i-SENSYS MF230 Series", "MF230", MF230_PID, 600, 0, 637, 1050, 
PIXMA_CAP_ADF), /* max. w = 216mm */
   DEV ("Canon i-SENSYS MF240 Series", "MF240", MF240_PID, 600, 300, 634, 1050, 
PIXMA_CAP_ADF),   /* max. w = 215mm, */

  /* TODO: fix black stripes for 216mm @ 600dpi */
+  DEV ("Canon i-SENSYS MF620 Series", "MF620", MF620_PID, 600, 0, 634, 1050, 
PIXMA_CAP_ADF),
   DEV (NULL, NULL, 0, 0, 0, 0, 0, 0)
 };
---

Here are the results:

  $ sudo scanimage -v -L
  device `pixma:04A927B4_f48139e3ba8e' is a CANON Canon i-SENSYS MF620 Series 
multi-function peripheral

  $ sudo ./tstbackend 
  tstbackend, Copyright (C) 2002 Frank Zago
  tstbackend comes with ABSOLUTELY NO WARRANTY
  This is free software, and you are welcome to redistribute it
  under certain conditions. See COPYING file for details

  This is tstbackend build 19

TEST: init/exit
  ERROR   : no SANE devices found
  warnings: 0  error: 1  checks: 83

But scanning via USB seems to work fine, I tested:

  $ sudo scanimage -v > test.pnm
  scanimage: scanning image of size 637x877 pixels at 24 bits/pixel
  scanimage: acquiring RGB frame
  scanimage: min/max graylevel value = 255/0
  scanimage: sane_read: Operation was cancelled

I also tried LAN, by adding device's IP (bjnp://192.168.1.119) to 

  /usr/local/etc/sane.d/pixma.conf

But this results in:

  $ sudo scanimage -v -L
  [bjnp] udp_command: ERROR - no data received (timeout = 1000)
  [bjnp] bjnp_init_device_structure: Cannot read mac address, skipping this 
scanner
  [bjnp] udp_command: ERROR - no data received (timeout = 1000)
  [bjnp] add_scanner: ERROR - Cannot read scanner make & model: 
bjnp://192.168.1.119:8612/timeout=1000

I am grateful for any help / Thanks

--Markus--




> 
> [1] 
> https://anonscm.debian.org/git/sane/sane-backends.git/commit/?id=879565cefcac61e371581d09696ef6d738c2a720
> 
> -- Markus --
> 
> 
> 
> 
> This is sane-find-scanner from sane-backends 1.0.25git
> 
> # sane-find-scanner will now attempt to detect your scanner. If the
> # result is different from what you expected, first make sure your
> # scanner is powered up and properly connected to your computer.
> 
> searching for SCSI scanners:
> ...
> searching for USB scanners:
> checking /dev/usb/scanner... failed to open (Invalid argument)
> checking /dev/usb/scanner0... failed to open (Invalid argument)
> checking /dev/usb/scanner1... failed to open (Invalid argument)
> ...
> checking /dev/usb/scanner15... failed to open (Invalid argument)
> checking /dev/usbscanner... failed to open (Invalid argument)
> checking /dev/usbscanner0... failed to open (Invalid argument)
> checking /dev/usbscanner1... failed to open (Invalid argument)
> ...
> checking /dev/usbscanner15... failed to open (Invalid argument)
> trying libusb:
> ...
> 
> bLength   18
> bDescriptorType   1
> bcdUSB2.00
> bDeviceClass  0
> bDeviceSubClass   0
> bDeviceProtocol   0
> bMaxPacketSize0   64
> idVendor  0x04A9
> idProduct 0x27B4
> bcdDevice 0.00
> iManufacturer 1 (Canon,Inc.)
> iProduct

[sane-devel] 39ceeae6 breaks md5 auth

2018-01-02 Thread James Ring
Hi Olaf,

I was trying to find out why authentication to a local test device
does not work with my frontend on Ubuntu 17.10.

$ scanimage -d net:localhost:test
scanimage: open of device net:localhost:test failed: Access to
resource has been denied

Both saned.users and $HOME/.sane/sane.pass contain the following line:

testuser:goodpass:net:localhost:test

I tried building sane 1.0.27 from source and could reproduce the
error. 1.0.24 built from source did not show the issue. Bisecting
reveals that the culprit is

https://anonscm.debian.org/git/sane/sane-backends.git/commit/?id=39ceeae616a2e1638c2760d4364adcaa210a413b

Reverting that commit restores the functionality. I haven't figured
out what the problem is from a cursory inspection of the code, I'll
continue staring at it.

Thanks,
James

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
 to sane-devel-requ...@lists.alioth.debian.org


[sane-devel] ask for adding support of Canon's i-SENSYS MF620 series

2018-01-02 Thread Markus Heiser
Hi SANE developers,

I'am trying to scan from a Canon MF623Cn which is a AIO device
from Canon's i-SENSYS MF620 series. It can be connected by USB
or LAN.

First I tried USB // MF620 series is not yet listed in:

- http://www.sane-project.org/lists/sane-backends-cvs.html nor in
- 
https://anonscm.debian.org/git/sane/sane-backends.git/tree/doc/descriptions/pixma.desc

I'am a bit confused by the naming 'i-SENSYS' and 'PIXMA' from
SANE's POV. What is the difference (or is there a difference)
between i-SENSYS and PIXMA? Especially, can we use the bjnp
protocol (bjnp://myscanner.my.domain:8612) for Canon's i-SENSYS
devices when connected via IP?

Back to USB, I test the device on Ubuntu's 16.04 LTS // sane-find-scanner
from sane-backends 1.0.25git gives me::

 found USB scanner (vendor=0x04a9 [Canon,Inc.], product=0x27b4 [MF620C Series]) 
at libusb:003:003

For the full output see below.

Now I ask you SANE developer's for adding support of Canon's i-SENSYS
MF620 series. If you needed testers, I can test USB & LAN scenarios
with my MF623Cn.

Thanks!

Sidenote, I looked at commit 879565 [1]:

  "new scanners Canon i-SENSYS MF230 and MF240 Series

is this all we need, adding a define MF620_PID (with 0x27b4)
to backend/pixma_imageclass.c?

[1] 
https://anonscm.debian.org/git/sane/sane-backends.git/commit/?id=879565cefcac61e371581d09696ef6d738c2a720

-- Markus --




This is sane-find-scanner from sane-backends 1.0.25git

 # sane-find-scanner will now attempt to detect your scanner. If the
 # result is different from what you expected, first make sure your
 # scanner is powered up and properly connected to your computer.

searching for SCSI scanners:
...
searching for USB scanners:
checking /dev/usb/scanner... failed to open (Invalid argument)
checking /dev/usb/scanner0... failed to open (Invalid argument)
checking /dev/usb/scanner1... failed to open (Invalid argument)
...
checking /dev/usb/scanner15... failed to open (Invalid argument)
checking /dev/usbscanner... failed to open (Invalid argument)
checking /dev/usbscanner0... failed to open (Invalid argument)
checking /dev/usbscanner1... failed to open (Invalid argument)
...
checking /dev/usbscanner15... failed to open (Invalid argument)
trying libusb:
...

bLength   18
bDescriptorType   1
bcdUSB2.00
bDeviceClass  0
bDeviceSubClass   0
bDeviceProtocol   0
bMaxPacketSize0   64
idVendor  0x04A9
idProduct 0x27B4
bcdDevice 0.00
iManufacturer 1 (Canon,Inc.)
iProduct  2 (MF620C Series)
iSerialNumber 3 (f48139e3ba8e)
bNumConfigurations1

bLength  9
bDescriptorType  2
wTotalLength 62
bNumInterfaces   2
bConfigurationValue  1
iConfiguration   0 ()
bmAttributes 192 (Self-powered)
MaxPower 2 mA
 
  
  bLength9
  bDescriptorType4
  bInterfaceNumber   0
  bAlternateSetting  0
  bNumEndpoints  3
  bInterfaceClass255
  bInterfaceSubClass 0
  bInterfaceProtocol 255
  iInterface 0 ()
   
   bLength   7
   bDescriptorType   5
   bEndpointAddress  0x03 (out 0x03)
   bmAttributes  2 (bulk)
   wMaxPacketSize512
   bInterval 0 ms
   bRefresh  0
   bSynchAddress 0
   
   bLength   7
   bDescriptorType   5
   bEndpointAddress  0x84 (in 0x04)
   bmAttributes  2 (bulk)
   wMaxPacketSize512
   bInterval 0 ms
   bRefresh  0
   bSynchAddress 0
   
   bLength   7
   bDescriptorType   5
   bEndpointAddress  0x85 (in 0x05)
   bmAttributes  3 (interrupt)
   wMaxPacketSize64
   bInterval 11 ms
   bRefresh  0
   bSynchAddress 0
 
  
  bLength9
  bDescriptorType4
  bInterfaceNumber   1
  bAlternateSetting  0
  bNumEndpoints  2
  bInterfaceClass7
  bInterfaceSubClass 1
  bInterfaceProtocol 2
  iInterface 0 ()
   
   bLength   7
   bDescriptorType   5
   bEndpointAddress  0x01 (out 0x01)
   bmAttributes  2 (bulk)
   wMaxPacketSize512
   bInterval 0 ms
   bRefresh  0
   bSynchAddress 0
   
   bLength   7
   bDescriptorType   5
   bEndpointAddress  0x82 (in 0x02)
   bmAttributes  2 (bulk)
   wMaxPacketSize512
   bInterval 0 ms
   bRefresh  0
   bSynchAddress 0


   checking for LM983[1,2,3] ...
   this is not a LM983x (bcdUSB = 0x200)
   checking for GT-6801 ...
   this is not a GT-6801 (bDeviceClass = 0)
   checking for GT-6816 ...
   this is not a GT-6816 (bcdUSB = 0x200)
   checking for GLxxx ...
   this is not a GL646 (bDeviceClass = 0, bInterfaceClass = 255)
   this is not a GLxxx (bDeviceClass = 0, bInterfaceClass = 255)


found USB scanner (vendor=0x04a9 [Canon,Inc.], product=0x27b4 [MF620C Series]) 
at libusb:003:003


bLength   18
bDescriptorType   1
bcdUSB2.00

Re: [sane-devel] Epson XP-860 Scan to Computer (PDF) function

2018-01-02 Thread Louis Lagendijk
On Sun, 2017-12-31 at 10:31 -0800, Kip Warner wrote:
> Hey list,
> 
> I have an Epson XP-860 multi-function printer / scanner. I am using
> Ubuntu 17.10 (amd64). The device is connected via USB and wireless.
> 
> The scanner functionalist works fine from within Simple Scan or any
> other scanning application. However, when I select on the device's
> integrated touch screen console "Scan to Computer (PDF)", and then
> select USB connection, it shows the following error message:
> 
> "Communication error. Check if computer is connected."
> 
> I'm assuming that in order to have this work, there needs to be some
> userland configuration on the connected machine. I was expecting that
> when I hit that button, Simple Scan or some other user selectable
> scanning application would open and the scan would begin. 
> 
> Would anyone be able to point me in the right direction?
> 
> Yours truly,
> 
Device initiated scans require a daemon on the computer that knows what
to do when the button on the scanner is pushed. Please have a look
scanbd https://sourceforge.net/projects/scanbd/. Scanbd is designed on
top of sane. The deamon continuously polls the scanner to see if work
needs to be done. It will then use saned to do the actual scanning.
Results will be stored on disk in the resolution you configured in the
scanbd configuration.

Xsane does have a button-controlled scan option that allows it to wait
for a key press as well. But that is used to delay scanning until the
key on the scanner is pressed. 

BR, Louis

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
 to sane-devel-requ...@lists.alioth.debian.org