[sane-devel] [sane-pixma] Canon MF4150 v. PIXMA_CAP_LINEART

Rolf Bensch rolf at bensch-online.de
Wed Aug 28 20:11:07 UTC 2013


Hi Samuel,

Am 27.08.2013 13:05, schrieb Samuel Adam:
> clang had spit out a few warnings on pixma_imageclass.c; such were
> simple format string issues which seemed on a relevant codepath, and
> are fixed in the attached patch.  My trivial tweak did not fix the
> segfault (although uint64_t is indeed wider than %u on my machine).
> pixma_imageclass.c now compiles without warnings.

Many thanks for your patch.


Am 28.08.2013 08:55, schrieb Samuel Adam:
> Skimming the code, I am about 80% certain that:
> 
> (1) It is dying between these two points in the codepath:
> 
>     (a) pixma_imageclass.c: iclass_check_param()
>     (b) pixma.c: start_reader_task()
> 
> (Viz.:  Successfully completes the former; segfaults at an undetermined
> point before reaching or completing the latter.)
> 
> (2) Up to that point, the *only* substantive changes induced by the
> patch are alterations to the values of various data structures.
> 
> ===> Therefore:  Is there anything which jumps out to those familiar
> with the code between point (a) and point (b) which would or could choke
> upon a change in the size, shape, or contents of pixma_scan_param_t
> structure?  (There is one other blackmagic blob of bit-stuffing changed
> before that.  The change is only effective if the "--mode" is set to
> "Lineart", however; whereas the segfault occurs regardless.)
>

The segfault is produced inside iclass_check_param(). You can see in the
log that the segfault happens somewhere between the log output lines
"PDBG (pixma_dbg (4, "*iclass_check_param***** Initially: ... ));"
and
"PDBG (pixma_dbg (4, "*iclass_check_param***** Finally: ... ));"


The attached patch should fix this item.

Some background info how lineart scan is working (if you like to debug
this by yourself):
(1) The frontend requests a lineart scan with 1 bit per pixel.
(2) The backend scans a grayscale image with 8 bits per pixel.
(3) The backend converts 8 bits per pixel to 1 bit per pixel for each
single line.

If you need debug infos you only have to insert "PDBG (pixma_dbg (4, ...
));" with the needed data to the code.

If the code is still buggy, please send a log file offlist again.

Cheers,
Rolf


-------------- next part --------------
--- ./pixma_imageclass.c	2013-08-28 21:57:59.000000000 +0200
+++ ../sane-backends/backend/pixma_imageclass.c	2013-08-28 21:58:03.000000000 +0200
@@ -505,7 +505,7 @@
 
   sp->depth = 8;
   sp->software_lineart = 0;
-  if (sp->param->mode == PIXMA_SCAN_MODE_LINEART)
+  if (sp->mode == PIXMA_SCAN_MODE_LINEART)
   {
     sp->software_lineart = 1;
     sp->channels = 1;


More information about the sane-devel mailing list