[sane-devel] scanbd Canon MG6250

Rolf Bensch rolf at bensch-online.de
Wed Feb 6 11:46:09 UTC 2013


Hi Matthias,

I prepared a 2nd patch for pixma_mp150.c. This should fix the timeout
problem and sets "--button-1", "--button-2" and "--target". This patch
is based on the first patch.

Please test the patched version with enabled debug messages: 'export
SANE_DEBUG_PIXMA=21' and test both buttons ("BLACK" and "COLOR") with
'scanimage -A'.

Please test *all* buttons, also the ones on the touch screen and if
there is a signal if the cover is opened and closed.

You can see any response / signal in these lines:

[pixma] INTR T=1.432 len=32
[pixma]  00000000:00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00
    "COLOR" button pressed:^^
[pixma]  00000010:00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00

Cheers,
Rolf



Am 06.02.2013 10:43, schrieb Matthias Thon:
> Hi Rolf,
> 
> The MG6250 has a small Display. All Buttons are normaly invisible. The
> device only illuminate the buttons, which can be used in the actual
> context.
> 
> 3 Buttons are under the display.  5 Buttons are for up, down, right,
> left and in the middle OK. Then we have a "home" and a "return" Button.
> And at last two buttons for copy,scan in "BLACK" or "COLOR".
> 
> For example: I press the right button under the display (Scan). After
> that the device illuminates the home, return, black, color and the left
> and middle buttons under the display.
> 
> Which button we use for scanbd is equal.
> 
> If i start scanimage -A, sane sending time and the trying to read 8
> byte. This read failed (Resource temporarily unavailable. After that i
> can press different buttons, but no reaction by scanimage.
> 
> 
> After pressing "COLOR" or "BLACK" the device shows "Verarbeitung....
> Bitte warten" and waits for about 1 Minute. Seems that the device wating
> for transfer scan data. But the scan-motor doesn't do anything.
> 
> regards matthias
> 
> 
> 2013/2/6 Rolf Bensch <rolf at bensch-online.de <mailto:rolf at bensch-online.de>>
> 
>     Hi Matthias,
> 
>     Super! Please send me the same logs for all buttons, one by one. Then
>     I'll prepare the next patch. By now you can ignore the timeout.
> 
>     Some programs use "--button-1" to scan a page and "--button-2" to end a
>     scan session. For my scanner I'm using all buttons for "--button-1"
>     except button "PDF End" for "--button-2". And secondary the individual
>     button code is in "--target".
> 
>     I like to implement the buttons of your scanner in the same way. Which
>     button do you like to connect to "--button-2"?
> 
>     Cheers,
>     Rolf
> 
> 
>     Am 05.02.2013 23:13, schrieb Matthias Thon:
>     > Hi Rolf,
>     > here the dump with the higher Debug-Levels. I interrupt after pressing
>     > the "COLOR" Scan-Button and the second timout.
>     >
>     > regards Matthias
>     >
>     >         Width of scan-area.
>     >     -y auto|0..297.011mm [297.011]
>     >         Height of scan-area.
>     >   Buttons:
>     >     --button-update
>     >         Update button state
>     > [sanei_usb] sanei_usb_read_int: trying to read 64 bytes
>     > [sanei_usb] sanei_usb_read_int: wanted 64 bytes, got 32 bytes
>     > [sanei_usb] 000 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00
>     > ................
>     > [sanei_usb] 010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>     > ................
>     > [pixma] INTR T=1.432 len=32
>     > [pixma]  00000000:00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00
>     > [pixma]  00000010:00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>     > [pixma]
>     > [pixma] Sending time: '13/02/05 23:10'
>     > [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 33 2F 30 32 2F 30 35 20 32 33 3A 31 30 00 00
>     13/02/05
>     > 23:10..
>     > [sanei_usb] 020 00 00 00 57
>     > ...W
>     > [sanei_usb] sanei_usb_write_bulk: wanted 36 bytes, wrote 36 bytes
>     > [pixma] OUT  T=1.433 len=36
>     > [pixma]  00000000:eb 80 00 00 00 00 00 00  00 00 00 00 00 00 00 14
>     > [pixma]  00000010:31 33 2f 30 32 2f 30 35  20 32 33 3a 31 30 00 00
>     > [pixma]  00000020:00 00 00 57
>     > [pixma]
>     > [sanei_usb] sanei_usb_read_bulk: trying to read 8 bytes
>     > [sanei_usb] sanei_usb_read_bulk: read failed: Resource temporarily
>     > unavailable
>     > [pixma] IN   T=21.436 len=-9
>     > [pixma]   ERROR: ETIMEDOUT
>     > [pixma]
>     > [pixma] No response yet. Timed out in 8 sec.
>     > [sanei_usb] sanei_usb_read_bulk: trying to read 8 bytes
>     > ^C
>     >
>     >
>     >
>     > 2013/2/5 Rolf Bensch <rolf at bensch-online.de
>     <mailto:rolf at bensch-online.de> <mailto:rolf at bensch-online.de
>     <mailto:rolf at bensch-online.de>>>
>     >
>     >     Hi Matthias,
>     >
>     >     Sorry for my last email relating to USB and LAN. I mixed the
>     emails up
>     >     in my daily digest. Please set me to cc if you send a response to
>     >     the list.
>     >
>     >     Anyway, it seems that your scanner answers the USB interrupt
>     request and
>     >     the post process data handling sticks in setting your
>     scanner's clock.
>     >
>     >     So I need the debug info with 'export SANE_DEBUG_PIXMA=21' and
>     >     'export SANE_DEBUG_SANEI_USB=255' to fix this issue.
>     >
>     >     By now I'm only interested in the lines between "Buttons:" and
>     >     "Extras:".
>     >
>     >     Cheers,
>     >     Rolf
>     >
>     >
>     >
>     >     Am 05.02.2013 18:19, schrieb Matthias Thon:
>     >     > Hi Rolf,
>     >     >
>     >     > now hopefully the right debug information. Now after starting
>     >     scanimage
>     >     > -A , it waits for the button information. I try different
>     buttons
>     >     > (black, color) Changed before from JPEG to PDF or TIFF but
>     scanimage
>     >     > waits till timeout. See the output.
>     >     >
>     >     > regards Matthias
>     >     >
>     >     >
>     >     >
>     >    
>     root at matze-Satellite-C660:/usr/local/src/sane-backends-git/sane-backends#
>     >     scanimage
>     >     > -V
>     >     > scanimage (sane-backends) 1.0.24git; backend version 1.0.24
>     >     >
>     >    
>     root at matze-Satellite-C660:/usr/local/src/sane-backends-git/sane-backends#
>     >     scanimage
>     >     > -A
>     >     > [sanei_debug] Setting debug level of pixma to 7.
>     >     > [pixma] pixma is compiled without pthread support.
>     >     > [pixma] pixma version 0.17.0
>     >     > [pixma] pixma_collect_devices() found Canon PIXMA MG6200 at
>     >     libusb:002:005
>     >     > [pixma] sanei_bjnp_find_devices:
>     >     > [pixma] eth0 is IPv4 capable, sending broadcast, socket = 3
>     >     > [pixma] wlan0 is IPv4 capable, sending broadcast, socket = 4
>     >     > [pixma] eth0 is IPv6 capable, sending broadcast, socket = 5
>     >     > [pixma] wlan0 is IPv6 capable, sending broadcast, socket = 6
>     >     > [pixma] pixma_find_scanners() found 1 devices
>     >     > [pixma] pixma_collect_devices() found Canon PIXMA MG6200 at
>     >     libusb:002:005
>     >     > [pixma] sanei_bjnp_find_devices:
>     >     > [pixma] eth0 is IPv4 capable, sending broadcast, socket = 3
>     >     > [pixma] wlan0 is IPv4 capable, sending broadcast, socket = 4
>     >     > [pixma] eth0 is IPv6 capable, sending broadcast, socket = 5
>     >     > [pixma] wlan0 is IPv6 capable, sending broadcast, socket = 6
>     >     > [pixma] pixma_open(): Canon PIXMA MG6200
>     >     >
>     >     > All options specific to device `pixma:04A91755_14B4F6':
>     >     >   Scan mode:
>     >     >     --resolution auto||75|150|300|600|1200|2400|4800dpi [75]
>     >     >         Sets the resolution of the scanned image.
>     >     >     --mode auto|Color|Gray|Lineart [Color]
>     >     >         Selects the scan mode (e.g., lineart, monochrome, or
>     color).
>     >     >     --source Flatbed [Flatbed]
>     >     >         Selects the scan source (such as a document-feeder). Set
>     >     source
>     >     > before
>     >     >         mode and resolution. Resets mode and resolution to auto
>     >     values.
>     >     >     --button-controlled[=(yes|no)] [no]
>     >     >         When enabled, scan process will not start
>     immediately. To
>     >     proceed,
>     >     >         press "SCAN" button (for MP150) or "COLOR" button
>     (for other
>     >     > models).
>     >     >         To cancel, press "GRAY" button.
>     >     >   Gamma:
>     >     >     --custom-gamma[=(auto|yes|no)] [yes]
>     >     >         Determines whether a builtin or a custom gamma-table
>     >     should be used.
>     >     >     --gamma-table auto|0..255,...
>     >     >         Gamma-correction table.  In color mode this option
>     equally
>     >     > affects the
>     >     >         red, green, and blue channels simultaneously (i.e.,
>     it is an
>     >     > intensity
>     >     >         gamma table).
>     >     >     --gamma auto|0.299988..5 [2.2]
>     >     >         Changes intensity of midtones
>     >     >   Geometry:
>     >     >     -l auto|0..216.069mm [0]
>     >     >         Top-left x position of scan area.
>     >     >     -t auto|0..297.011mm [0]
>     >     >         Top-left y position of scan area.
>     >     >     -x auto|0..216.069mm [216.069]
>     >     >         Width of scan-area.
>     >     >     -y auto|0..297.011mm [297.011]
>     >     >         Height of scan-area.
>     >     >   Buttons:
>     >     >     --button-update
>     >     >         Update button state
>     >     > [pixma] Sending time: '13/02/05 18:12'
>     >     > [pixma] No response yet. Timed out in 8 sec.
>     >     > [pixma] No response yet. Timed out in 7 sec.
>     >     > [pixma] No response yet. Timed out in 6 sec.
>     >     > [pixma] No response yet. Timed out in 5 sec.
>     >     > [pixma] No response yet. Timed out in 4 sec.
>     >     > [pixma] No response yet. Timed out in 3 sec.
>     >     > [pixma] No response yet. Timed out in 2 sec.
>     >     > [pixma] No response yet. Timed out in 1 sec.
>     >     > [pixma] WARNING: Error in response phase. cmd:eb80
>     >     > [pixma]   If the scanner hangs, reset it and/or unplug the
>     USB cable.
>     >     >     --button-1 <int> [0] [read-only]
>     >     >         Button 1
>     >     >     --button-2 <int> [0] [read-only]
>     >     >         Button 2
>     >     >     --original <int> [0] [read-only]
>     >     >         Type of original to scan
>     >     >     --target <int> [0] [read-only]
>     >     >         Target operation type
>     >     >   Extras:
>     >     >     --threshold auto|0..100% (in steps of 1) [inactive]
>     >     >         Select minimum-brightness to get a white point
>     >     >     --threshold-curve auto|0..127 (in steps of 1) [inactive]
>     >     >         Dynamic threshold curve, from light to dark,
>     normally 50-65
>     >     >
>     >     > [pixma] pixma_close(): Canon PIXMA MG6200
>     >     >
>     >    
>     root at matze-Satellite-C660:/usr/local/src/sane-backends-git/sane-backends#
>     >     >
>     >
>     >
> 
> 
-------------- next part --------------
--- ./pixma_mp150.c	2013-02-06 12:14:05.000000000 +0100
+++ ../sane-backends/backend/pixma_mp150.c	2013-02-06 12:28:34.000000000 +0100
@@ -910,15 +910,36 @@
       return PIXMA_EPROTO;
     }
 
-  /* More than one event can be reported at the same time. */
-  if (buf[3] & 1)
-    send_time (s);
-  if (buf[9] & 2)
-    query_status (s);
-  if (buf[0] & 2)
-    s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4);	/* b/w scan */
-  if (buf[0] & 1)
-    s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4);	/* color scan */
+  /* s->event = 0x0boott
+   * b:  button
+   * oo: original
+   * tt: target
+   * poll event with 'scanimage -A'
+   * */
+  if (s->cfg->pid == MG6200_PID)
+  /* button no. in buf[3]
+   * target = button no. */
+  {
+    if (buf[3] & 1)
+      s->events = PIXMA_EV_BUTTON1 | buf[3];    /* color scan */
+    else
+      s->events = PIXMA_EV_BUTTON2 | buf[3];    /* b/w scan */
+  }
+  else
+  /* button no. in buf[0]
+   * original in buf[0]
+   * target in buf[1] */
+  {
+    /* More than one event can be reported at the same time. */
+    if (buf[3] & 1)
+      send_time (s);
+    if (buf[9] & 2)
+      query_status (s);
+    if (buf[0] & 2)
+      s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4);	/* b/w scan */
+    if (buf[0] & 1)
+      s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4);	/* color scan */
+  }
   return 1;
 }
 


More information about the sane-devel mailing list