[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-27 Thread Henning Meier-Geinitz
Hi,

On Mon, Sep 26, 2005 at 06:56:08PM -0500, Dan McGhee wrote:
> >I have already looked at Rene's SVN and the patch and there doesn't
> >seem to be any relevant change in the above mentioned part of the
> >code.
> > 
> >
> I'm sorry, but I disagree. The sequence you noted previously is 
> currently in Rev 282 of the avision backend on SVN. This version is not 
> patched.

Looks like I looked at the first version of frpatch (28 Aug 2005). You
seem to use the second version (Mon, 12 Sep 2005).

You are right, that patch seems to fix the oroginal problem.
I don't see any oviously fishy code now. 

Bye,
  Henning


[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-25 Thread Henning Meier-Geinitz
Hi,

On Sun, Sep 25, 2005 at 11:13:56AM -0500, Dan McGhee wrote:
> Just to remind you, I'm not using the version of avision released in 
> backends-1.0.16. I'm using Rev. 280 of avision from SVN. It is patched 
> with the file Falk Rohsiepe sent me and then Rene posted a patch here 
> last month.

I have already looked at Rene's SVN and the patch and there doesn't
seem to be any relevant change in the above mentioned part of the
code.

> I'm really a "noob" at reading code, so right now about the only thing I 
> can do is gather and report data. In the version of avision.c that I 
> currently have--the patched one--I ran:
> 
> 'grep -in -A 5 -B 5 SANE_Word avision.c'

Well, if the size were sizeof(SANE_Word), it would be ok. But it isn't.

Just use an editor on backend/avision.c, find this line:

   s->opt[OPT_NUM_OPTS].size = sizeof(SANE_TYPE_INT);

And change it to that one:

   s->opt[OPT_NUM_OPTS].size = sizeof (SANE_Word);

Bye,
  Henning


[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-25 Thread Dan McGhee
Henning Meier-Geinitz wrote:

>[segfault of xscanimage with avision backend]
>
>On Sat, Sep 24, 2005 at 07:39:51AM -0500, Dan McGhee wrote:
>  
>
>>Starting program: /usr/bin/xscanimage
>>
>>*[This is the point at which I clicked "scan" in the preview window]*
>>
>>Program received signal SIGSEGV, Segmentation fault.
>>0x08057467 in gsg_sync (dialog=0x80ef4f0) at gtkglue.c:1424
>>1424 curve = GTK_GAMMA_CURVE (dialog->element[i].widget)->curve;
>>(gdb) bt
>>#0 0x08057467 in gsg_sync (dialog=0x80ef4f0) at gtkglue.c:1424
>>
>>
>
>The code is:
>
>
>  if (opt->type != SANE_TYPE_INT && opt->type != SANE_TYPE_FIXED)
>continue;
>
>  if (opt->size == sizeof (SANE_Word))
>continue;
>
>  /* ok, we're dealing with an active vector */
>
>  optlen = opt->size / sizeof (SANE_Word);
>  optval = alloca (optlen * sizeof (optval[0]));
>  vector = alloca (optlen * sizeof (vector[0]));
>
>  curve = GTK_GAMMA_CURVE (dialog->element[i].widget)->curve;
>
>So I looked into the avision backend for a SANE_TYPE_INT or
>SANE_TYPE_FIXED option with a length != SANE_Word. There are the four
>gamma vectors but they look ok. The only thing that looks fishy is
>this (avision.c):
>
>  s->opt[OPT_NUM_OPTS].name = "";
>  s->opt[OPT_NUM_OPTS].title = SANE_TITLE_NUM_OPTIONS;
>  s->opt[OPT_NUM_OPTS].desc = "";
>  s->opt[OPT_NUM_OPTS].cap = SANE_CAP_SOFT_DETECT;
>  s->opt[OPT_NUM_OPTS].type = SANE_TYPE_INT;
>  s->opt[OPT_NUM_OPTS].size = sizeof(SANE_TYPE_INT);
>
>The last line is wrong (it must be sizeof(SANE_Word)). SANE_TYPE_INT
>is an enum. Is this automatically and "int" or can it be shorter? I'm
>not sure if this is actually the problem but you could try that:
>
>  s->opt[OPT_NUM_OPTS].size = sizeof (SANE_Word);
>
>in avision.c and recompile+install.
>  
>
Just to remind you, I'm not using the version of avision released in 
backends-1.0.16. I'm using Rev. 280 of avision from SVN. It is patched 
with the file Falk Rohsiepe sent me and then Rene posted a patch here 
last month.

I'm really a "noob" at reading code, so right now about the only thing I 
can do is gather and report data. In the version of avision.c that I 
currently have--the patched one--I ran:

'grep -in -A 5 -B 5 SANE_Word avision.c'

I have attached the resulting file. I know there's probably a lot of 
extraneous info there, but I don't know how to filter out the extra stuff.

I also ran:
` grep -in \-A 5 -B 5 sizof\(SANE_Word\) avision.c`
with no results.

`grep -in \-A 5 -B 5 OPT_NUM_OPTS avision.c` yielded

899- dev->speed_range.min = (SANE_Int)0;
5900- dev->speed_range.max = (SANE_Int)4;
5901- dev->speed_range.quant = (SANE_Int)1;
5902-
5903: init_option_int (s, OPT_NUM_OPTS, "", SANE_TITLE_NUM_OPTIONS, "",
5904- SANE_UNIT_NONE, SANE_CAP_SOFT_DETECT, 0, 0,
5905- NUM_OPTIONS);
5906-
5907- /* "Mode" group: */
5908- init_option_group (s, OPT_MODE_GROUP, SANE_TITLE_SCAN_MODE);
--
7605- case OPT_SPEED:
7606- case OPT_TL_X:
7607- case OPT_TL_Y:
7608- case OPT_BR_X:
7609- case OPT_BR_Y:
7610: case OPT_NUM_OPTS:
7611-
7612- case OPT_BRIGHTNESS:
7613- case OPT_CONTRAST:
7614- case OPT_QSCAN:
7615- case OPT_QCALIB:

>If that's not the problem, I guess Rene has to do some debugging
>because without a scanner supported by the avision backend I can't
>help more.
>
>  
>
If you give me specific directions, I can run the commands and post back.

@Rene and Falk I can do the same for both of you too.

>Does the segfault also occur with sane-backends 1.0.16?
>  
>
I'm going by memory, which fails as I age, and I think there may be a 
regression between avision released in backends-1.0.15 and Rev 280. I 
THINK I remember xscanimage working with the patch applied to avision in 
1.0.15, but I'm not sure. If I have the time I will rebuild it and report.

Thanks for the help, Henning.

Dan

-- next part --
1462-SANE_FIX (0), /* minimum */
1463-SANE_FIX (100), /* maximum */
1464-SANE_FIX (1) /* quantization */
1465-  };
1466-
1467:static const SANE_Word bool_list[] =
1468-  {
1469-2, /* 2 members */
1470-SANE_FALSE,
1471-SANE_TRUE
1472-  };
--
1524-  DBG (3, "constrain_value: while trying to set %.3f\n",
1525-  SANE_UNFIX(*(SANE_Fixed*)value));
1526-}
1527-else {
1528-  DBG (3, "constrain_value: while trying to set %lu\n",
1529:  (u_long)*(SANE_Word*)value);
1530-}
1531-  }
1532-  return r;
1533-}
1534-
--
3221-  
3222-  return SANE_STATUS_GOOD;
3223-}
3224-
3225-static SANE_Status
3226:set_frame (Avision_Scanner* s, SANE_Word frame)
3227-{
3228-  struct {
3229-struct command_send cmd;
3230-u_int8_t data[8];
3231-  } scmd;
--
5681-  
5682-static void
5683-init_option_int (Avision_Scanner *s, int idx,
5684-const char* name, const char* title, const char* desc,
5685-SANE_Unit unit, SANE_Int cap,
5686:const SANE_Word* valid_list, const SANE_Range* valid_range,
5687-SANE_Int value)
5688-{
5689-  s->opt[idx].name = name;
5

[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-25 Thread Henning Meier-Geinitz
[segfault of xscanimage with avision backend]

On Sat, Sep 24, 2005 at 07:39:51AM -0500, Dan McGhee wrote:
> Starting program: /usr/bin/xscanimage
> 
> *[This is the point at which I clicked "scan" in the preview window]*
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x08057467 in gsg_sync (dialog=0x80ef4f0) at gtkglue.c:1424
> 1424 curve = GTK_GAMMA_CURVE (dialog->element[i].widget)->curve;
> (gdb) bt
> #0 0x08057467 in gsg_sync (dialog=0x80ef4f0) at gtkglue.c:1424

The code is:


  if (opt->type != SANE_TYPE_INT && opt->type != SANE_TYPE_FIXED)
continue;

  if (opt->size == sizeof (SANE_Word))
continue;

  /* ok, we're dealing with an active vector */

  optlen = opt->size / sizeof (SANE_Word);
  optval = alloca (optlen * sizeof (optval[0]));
  vector = alloca (optlen * sizeof (vector[0]));

  curve = GTK_GAMMA_CURVE (dialog->element[i].widget)->curve;

So I looked into the avision backend for a SANE_TYPE_INT or
SANE_TYPE_FIXED option with a length != SANE_Word. There are the four
gamma vectors but they look ok. The only thing that looks fishy is
this (avision.c):

  s->opt[OPT_NUM_OPTS].name = "";
  s->opt[OPT_NUM_OPTS].title = SANE_TITLE_NUM_OPTIONS;
  s->opt[OPT_NUM_OPTS].desc = "";
  s->opt[OPT_NUM_OPTS].cap = SANE_CAP_SOFT_DETECT;
  s->opt[OPT_NUM_OPTS].type = SANE_TYPE_INT;
  s->opt[OPT_NUM_OPTS].size = sizeof(SANE_TYPE_INT);

The last line is wrong (it must be sizeof(SANE_Word)). SANE_TYPE_INT
is an enum. Is this automatically and "int" or can it be shorter? I'm
not sure if this is actually the problem but you could try that:

  s->opt[OPT_NUM_OPTS].size = sizeof (SANE_Word);

in avision.c and recompile+install.

If that's not the problem, I guess Rene has to do some debugging
because without a scanner supported by the avision backend I can't
help more.

Does the segfault also occur with sane-backends 1.0.16?

Bye,
  Henning

  


[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-24 Thread Dan McGhee
Henning Meier-Geinitz wrote:

> could you also run xscanimage with gdb as mentioned in my previous mail?
>
>  
>
Here's the output of gdb:

Starting program: /usr/bin/xscanimage

*[This is the point at which I clicked "scan" in the preview window]*

Program received signal SIGSEGV, Segmentation fault.
0x08057467 in gsg_sync (dialog=0x80ef4f0) at gtkglue.c:1424
1424 curve = GTK_GAMMA_CURVE (dialog->element[i].widget)->curve;
(gdb) bt
#0 0x08057467 in gsg_sync (dialog=0x80ef4f0) at gtkglue.c:1424
#1 0x08051f78 in scan_start (p=0x812a570) at preview.c:881
#2 0x08053034 in preview_scan (p=0x812a570) at preview.c:1500
#3 0xb794a9c6 in IA__g_cclosure_marshal_VOID__VOID (closure=0x812cd90,
return_value=0x0, n_param_values=1, param_values=0x0,
invocation_hint=0xbfffda38, marshal_data=0x0) at gmarshal.c:77
#4 0xb79341eb in IA__g_closure_invoke (closure=0x812cd90, return_value=0x0,
n_param_values=0, param_values=0x0, invocation_hint=0x0) at gclosure.c:437
#5 0xb7948d7d in signal_emit_unlocked_R (node=0x80e6650, detail=0,
instance=0x80e7e70, emission_return=0x0, instance_and_params=0xbfffdb60)
at gsignal.c:2488
#6 0xb794a2e8 in IA__g_signal_emit_valist (instance=0x80e7e70, signal_id=0,
detail=0,
var_args=0xbfffdcec 
"@G\226?@G\226?p~\016\b\b???|???p~\016\bxt\016\b(?\224?p~\016\b?l\016\b 
???@G\226?xt\016\bXD\223?xt\016\b")
at gsignal.c:2247
#7 0xb794a5d6 in IA__g_signal_emit (instance=0x0, signal_id=0, detail=0)
at gsignal.c:2291
#8 0xb7c2dad1 in IA__gtk_button_clicked (button=0x80e7e70) at 
gtkbutton.c:782
#9 0xb7c2f57c in gtk_real_button_released (button=0x80e7e70)
at gtkbutton.c:1294
#10 0xb794a9c6 in IA__g_cclosure_marshal_VOID__VOID (closure=0x80e7478,
return_value=0x0, n_param_values=1, param_values=0x0,
invocation_hint=0xbfffde88, marshal_data=0xb7c2f540) at gmarshal.c:77
#11 0xb79344e9 in g_type_class_meta_marshal (closure=0x80e7478,
return_value=0x0, n_param_values=0, param_values=0xbfffdfb0,
invocation_hint=0x0, marshal_data=0x0) at gclosure.c:514

Hope this helps.

Dan


[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-23 Thread Henning Meier-Geinitz
Hi,

On Thu, Sep 22, 2005 at 05:58:28AM -0500, Dan McGhee wrote:
> Here is the info from close to the end of the file from 
> SANE_DEBUG_AVISION output when running xscanimage:

could you also run xscanimage with gdb as mentioned in my previous mail?

Bye,
  Henning


[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-22 Thread Dan McGhee
Henning Meier-Geinitz wrote:

>Hi,
>
>On Wed, Sep 14, 2005 at 06:08:03PM -0500, Dan McGhee wrote:
>  
>
>>Using sane-backends-1.0.16, I patched rev 280 of Avision, from SVN, with 
>>the patch from Falk Rohsiepe that Rene Rebe published.  My scanner now 
>>works using xsane.
>>
>>However, when using xscanimage in either preview or scan, the 
>>application exits with a segmentation fault.  Setting the debug level of 
>>
>>
>
>Does this also happen with other frontends (scanimage, xsane, ...)?
>  
>
In both xsane and scanimage, I can successfully scan and save images.

>  
>
>>SANE_DEBUG_XSCANIMAGE = 4, doesn't reveal anything useful.  What other 
>>debug variable could I use to try to generate information to post here?  
>>
>>
>
>SANE_DEBUG_AVISION=255
>  
>
Here is the info from close to the end of the file from 
SANE_DEBUG_AVISION output when running xscanimage:

[avision] sane_get_parameters:
[avision] sane_get_parameters: computing parameters
[avision] sane_compute_parameters:
[avision] sane_compute_parameters: boundary 8, gray_mode: 1,
[avision] sane_compute_parameters: tlx: 0.00, tly: 0.00, brx: 
216.00, bry: 296.00
[avision] sane_compute_parameters: y_max: 1753, bry: 1751, 
line_difference: 1
[avision] sane_compute_parameters: bry limitted!
[avision] sane_compute_parameters: tlx: 0, tly: 0, brx: 1275, bry: 1750
[avision] sane_compute_parameters: xres: 150, yres: 150, line_difference: 1
[avision] sane_compute_parameters: pixel_per_line: 1272, lines: 1747
[avision] sane_compute_parameters: depth: 8, bytes_per_line: 3816

[At this point the windows appear. First case, I "Preview Window" and:]

[avision] sane_get_option_descriptor:
[avision] sane_get_option_descriptor:
[avision] sane_get_option_descriptor:
[avision] sane_get_option_descriptor:
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=9, action=0
[avision] sane_control_option: queried for 9 (tl-x): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=10, action=0
[avision] sane_control_option: queried for 10 (tl-y): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=11, action=0
[avision] sane_control_option: queried for 11 (br-x): 216.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=12, action=0
[avision] sane_control_option: queried for 12 (br-y): 296.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=9, action=0
[avision] sane_control_option: queried for 9 (tl-x): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=10, action=0
[avision] sane_control_option: queried for 10 (tl-y): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=11, action=0
[avision] sane_control_option: queried for 11 (br-x): 216.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=12, action=0
[avision] sane_control_option: queried for 12 (br-y): 296.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=9, action=0
[avision] sane_control_option: queried for 9 (tl-x): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=10, action=0
[avision] sane_control_option: queried for 10 (tl-y): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=11, action=0
[avision] sane_control_option: queried for 11 (br-x): 216.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=12, action=0
[avision] sane_control_option: queried for 12 (br-y): 296.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=9, action=0
[avision] sane_control_option: queried for 9 (tl-x): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=10, action=0
[avision] sane_control_option: queried for 10 (tl-y): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=11, action=0
[avision] sane_control_option: queried for 11 (br-x): 216.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=12, action=0
[avision] sane_control_option: queried for 12 (br-y): 296.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=9, action=0
[avision] sane_control_option: queried for 9 (tl-x): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=10, action=0
[avision] sane_control_option: queried for 10 (tl-y): 0.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=11, action=0
[avision] sane_control_option: queried for 11 (br-x): 216.000
[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=12, action=0
[avision] sane_control_option: queried for 12 (br-y): 296.000

[Now I click "Acquire Preview" and:]

[avision] sane_get_option_descriptor:
[avision] sane_control_option: option=9, action=1
[avision] sane_control_option: ordered to set 9 (tl-x) to 0.000
[avision] constrain

[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-15 Thread Henning Meier-Geinitz
Hi,

On Wed, Sep 14, 2005 at 06:08:03PM -0500, Dan McGhee wrote:
> Using sane-backends-1.0.16, I patched rev 280 of Avision, from SVN, with 
> the patch from Falk Rohsiepe that Rene Rebe published.  My scanner now 
> works using xsane.
> 
> However, when using xscanimage in either preview or scan, the 
> application exits with a segmentation fault.  Setting the debug level of 

Does this also happen with other frontends (scanimage, xsane, ...)?

> SANE_DEBUG_XSCANIMAGE = 4, doesn't reveal anything useful.  What other 
> debug variable could I use to try to generate information to post here?  

SANE_DEBUG_AVISION=255

Run xscanimage with gdb.

When it crashes, enter "bt".

Bye,
  Henning


[sane-devel] Xscanimage Exits with Segmentation Fault using HP 5370C

2005-09-14 Thread Dan McGhee
Using sane-backends-1.0.16, I patched rev 280 of Avision, from SVN, with 
the patch from Falk Rohsiepe that Rene Rebe published.  My scanner now 
works using xsane.

However, when using xscanimage in either preview or scan, the 
application exits with a segmentation fault.  Setting the debug level of 
SANE_DEBUG_XSCANIMAGE = 4, doesn't reveal anything useful.  What other 
debug variable could I use to try to generate information to post here?  
Rather than post a complete debug file, are there any debug messages for 
which I could use grep to supply only pertinent information?

Thanks,

Dan