[sane-devel] Canon MP250, pixma backend

Andrey Kovalev aka at pxe.ru
Thu Nov 26 08:22:42 UTC 2015


Hi!

I'm trying to run Canon MP250 scanner.

It worked with sane-backend 1.0.23, and is broken since 1.0.24.

I took sane from git. Below I attached a part of sane log. I added 
several "here we are" lines to see source file name and line of code.

Problems started after "sane_control_option(handle=0x8080c00,option=17"

option=17 is opt_button_1.

In 1.0.24 these lines were added to pixma.c control_option() function:

+      case opt_button_1:
+      case opt_button_2:
+      case opt_original:
+      case opt_target:
+      case opt_scan_resolution:
+        /* poll scanner if option is not cached */
+        if (! ss->button_option_is_cached[ BUTTON_GROUP_INDEX(n) ] )
+          update_button_state (ss, info);
+        /* mark this option as read */
+        ss->button_option_is_cached[  BUTTON_GROUP_INDEX(n) ] = 0;


control_option() form pixma.c call update_button_state(),
then pixma_wait_event(),
mp150_wait_event(),
handle_interrupt() from pixma_mp150.c,
send_time().

Send a few bytes over USB and wait for device respond.

Device never responds.

If I comment out all these lines marked with '+' in pixma.c 
control_option() function my MP250 works.




On the other hand with this patch to sane git and without any other changes:


diff --git a/backend/pixma_mp150.c b/backend/pixma_mp150.c
index 4f8b232..7ab9e0f 100644
--- a/backend/pixma_mp150.c
+++ b/backend/pixma_mp150.c
@@ -967,8 +967,11 @@ handle_interrupt (pixma_t * s, int timeout)
     * target in buf[1] */
    {
      /* More than one event can be reported at the same time. */
-    if (buf[3] & 1)
-      send_time (s);
+    if (s->cfg->pid != MP250_PID)
+    {
+      if (buf[3] & 1)
+        send_time (s);
+    }
      if (buf[9] & 2)
        query_status (s);
      if (buf[0] & 2)



my MP250 works too.


In pixma_mp810.c there is a comment:

/* FIXME: some scanners hang here */

near send_time() call. Perhaps, MP250 doesn't need send_time()?



============================
[bjnp] sanei_bjnp_find_devices, pixma backend version: 0.17.24
[bjnp] sanei_bjnp_find_devices: No devices specified in configuration file.
[bjnp] sanei_bjnp_find_devices: Added all configured scanners, now do 
auto detection...
[bjnp] prepare_socket: lo is not a valid IPv4 interface, skipping...
[bjnp] prepare_socket: eth0 is IPv4 capable, sending broadcast, socket = 13
[bjnp] sanei_find_devices: scanner discovery finished...
[pixma] pixma_open(): Canon PIXMA MP250
[sanei_usb] sanei_usb_open: trying to open device `libusb:001:002'
[sanei_usb] sanei_usb_open: configuration nr: 0
[sanei_usb] sanei_usb_open:     interface nr: 0
[sanei_usb] sanei_usb_open:   alt_setting nr: 0
[sanei_usb] sanei_usb_open: endpoint nr: 0
[sanei_usb] sanei_usb_open: direction: 0
[sanei_usb] sanei_usb_open: address: 7 transfertype: 2
[sanei_usb] sanei_usb_open: found bulk-out endpoint (address 0x07)
[sanei_usb] sanei_usb_open: we already have a bulk-out endpoint 
(address: 0x07), ignoring the new one
[sanei_usb] sanei_usb_open: endpoint nr: 1
[sanei_usb] sanei_usb_open: direction: 128
[sanei_usb] sanei_usb_open: address: 8 transfertype: 2
[sanei_usb] sanei_usb_open: found bulk-in endpoint (address 0x08)
[sanei_usb] sanei_usb_open: we already have a bulk-in endpoint (address: 
0x88), ignoring the new one
[sanei_usb] sanei_usb_open: endpoint nr: 2
[sanei_usb] sanei_usb_open: direction: 128
[sanei_usb] sanei_usb_open: address: 9 transfertype: 3
[sanei_usb] sanei_usb_open: found interrupt-in endpoint (address 0x09)
[sanei_usb] sanei_usb_open: we already have a int-in endpoint (address: 
0x89), ignoring the new one
[sanei_usb] sanei_usb_open: configuration nr: 0
[sanei_usb] sanei_usb_open:     interface nr: 1
[sanei_usb] sanei_usb_open:   alt_setting nr: 0
[sanei_usb] sanei_usb_open: interface 1 not detected as a scanner by 
sanei_usb_init, ignoring.
[sanei_usb] sanei_usb_open: opened usb device `libusb:001:002' (*dn=0)
[pixma] *mp150_open***** This is a generation 4 scanner.  *****
[pixma] here we are pixma_mp150.c 1231
[pixma] here we are pixma_mp150.c 1240
[dll] sane_open: open successful
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] sane_get_parameters(handle=0x8080c00,params=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=0,action=0,value=0xbfd71cb0,info=(nil))
[dll] sane_get_option_descriptor(handle=0x8080c00,option=0)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=1)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=2)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=3)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=4)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=5)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=6)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=7)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=8)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=9)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=10)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=11)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=12)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=13)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=14)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=15)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=16)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=17)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=18)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=19)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=20)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=21)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=22)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=23)
[dll] sane_get_option_descriptor(handle=0x8080c00,option=24)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=2,action=0,value=0x807f208,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=3,action=0,value=0x8085a80,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=3,action=0,value=0x8085a80,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=4,action=0,value=0x8085a80,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=4,action=0,value=0x8085a80,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=5,action=0,value=0x8080a00,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=7,action=0,value=0x807f208,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=7,action=2,value=0x807f208,info=0xbfd71cb4)
[sanei_wire] sanei_w_set_dir: WARNING: will delete 16 bytes from buffer
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=8,action=0,value=0x806d008,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=9,action=0,value=0x8080a00,info=0xbfd71cb4)
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[sanei_wire] sanei_w_space: bigger than buffer (8192 bytes), may be flush()
[dll] 
sane_control_option(handle=0x8080c00,option=17,action=0,value=0x807f208,info=0xbfd71cb4)
[pixma] here we are pixma.c 698
[pixma] here we are pixma.c 283
[pixma] here we are pixma_common.c 1012
[pixma] here we are pixma_mp150.c 1655
[pixma] here we are pixma_mp150.c 931
[pixma] here we are pixma_io_sanei.c 578
[sanei_usb] sanei_usb_read_int: trying to read 64 bytes
[sanei_usb] sanei_usb_read_int: wanted 64 bytes, got 16 bytes
[sanei_usb] 000 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 
................
[pixma] here we are pixma_io_sanei.c 580
[pixma] INTR T=1.999 len=16
[pixma]  00000000:00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00
[pixma]
[pixma] 150 Sending time: '15/10/20 15:21'
[sanei_usb] sanei_usb_write_bulk: trying to write 36 bytes
[sanei_usb] 000 EB 80 00 00 00 00 00 00 00 00 00 00 00 00 00 14 
................
[sanei_usb] 010 31 35 2F 31 30 2F 32 30 20 31 35 3A 32 31 00 00 15/10/20 
15:21..
[sanei_usb] 020 00 00 00 56                                     ...V 

[sanei_usb] sanei_usb_write_bulk: wanted 36 bytes, wrote 36 bytes
[pixma] OUT  T=2.001 len=36
[pixma]  00000000:eb 80 00 00 00 00 00 00  00 00 00 00 00 00 00 14
[pixma]  00000010:31 35 2f 31 30 2f 32 30  20 31 35 3a 32 31 00 00
[pixma]  00000020:00 00 00 56
[pixma]
[pixma] here we are pixma_io_sanei.c 544
[sanei_usb] sanei_usb_read_bulk: trying to read 8 bytes
[sanei_usb] sanei_usb_read_bulk: read failed: Operation timed out
[pixma] here we are pixma_io_sanei.c 546
[pixma] IN   T=22.003 len=-9
[pixma]   ERROR: ETIMEDOUT
[pixma]
[pixma] No response yet. Timed out in 8 sec.
[pixma] here we are pixma_io_sanei.c 544
[sanei_usb] sanei_usb_read_bulk: trying to read 8 bytes
[sanei_usb] sanei_usb_read_bulk: read failed: Operation timed out
[pixma] here we are pixma_io_sanei.c 546
[pixma] IN   T=43.004 len=-9
[pixma]   ERROR: ETIMEDOUT
============================




-- 
Andrey



More information about the sane-devel mailing list