[sane-devel] Error during getting option values

Mohit Kumar Mohit Kumar <mohit.kumar@gmail.com>
Thu, 23 Jun 2005 16:27:59 +0530


Hi,

In response to the message, I had asked for the retrieval of the option val=
ues:

void PopulateScannerData(SANE_Handle handle)
{
=09int index;
=09unsigned long value;=09
=09SANE_Status status;
=09const SANE_Option_Descriptor* options=3DNULL;
=09if(IsSupported(gData,SANE_NAME_SCAN_X_RESOLUTION,&index))
=09{
=09=09status =3D sane_control_option(handle,index,SANE_ACTION_GET_VALUE,(vo=
id*)value,0);
=09=09assert(status =3D=3D SANE_STATUS_GOOD);
=09=09CSane::x_resolution =3D value;
=09}
=09if(IsSupported(gData,SANE_NAME_SCAN_Y_RESOLUTION,&index))
=09{
=09=09status =3D sane_control_option(handle,index,SANE_ACTION_GET_VALUE,(vo=
id*)value,0);
=09=09assert(status =3D=3D SANE_STATUS_GOOD);
=09=09CSane::y_resolution =3D value;
=09}
=09else
=09=09CSane::y_resolution =3D CSane::x_resolution;
}

I receive a SIGSEGV in this code. The gdb trace is :

#0  0x465cfaf0 in sanei_hp_accessor_new () from /usr/lib/sane/libsane-hp.so=
.1
#1  0x465cf903 in sanei_hp_accessor_get () from /usr/lib/sane/libsane-hp.so=
.1
#2  0x465d32f6 in sanei_hp_choice_isEnabled () from
/usr/lib/sane/libsane-hp.so.1
#3  0x465d8c27 in sanei_hp_optset_control () from /usr/lib/sane/libsane-hp.=
so.1
#4  0x465d1ed5 in sanei_hp_handle_control () from /usr/lib/sane/libsane-hp.=
so.1
#5  0x465ca534 in sane_hp_control_option () from /usr/lib/sane/libsane-hp.s=
o.1
#6  0x41eacc2a in sane_dll_control_option () from /usr/lib/libsane.so.1
#7  0x41eacf7b in sane_control_option () from /usr/lib/libsane.so.1
#8  0x41fb358a in PopulateScannerData(void*).....

Can any one tell me what am I doing wrong?

Thanks,
Mohit



Message: 5
Date: Wed, 22 Jun 2005 18:06:25 +0200
From: Henning Meier-Geinitz <henning@meier-geinitz.de>
To: sane-devel@lists.alioth.debian.org
Subject: Re: [sane-devel] Determining the "SET" values of options
through SANE APIs

Hi,

On Wed, Jun 22, 2005 at 07:17:19PM +0530, Mohit Kumar wrote:
> I was wondering if there is any mechanism for which I can find out
> what are the set values for various options such as resolution, mode
> etc?
>
> sane_get_option_descriptor gives us all the options, but is there any
> way to determine what is the current value of the option?

sane_control_option(), SANE_ACTION_GET_VALUE

Bye,
 Henning