No subject


Sat Dec 3 12:15:27 GMT 2022


>       if ( strcmp(opt->name, SANE_NAME_SCAN_MODE) == 0)
>       {
>           str = "gray";
>           valuep = (void *)str;
>           status = sane_control_option (device, i, SANE_ACTION_SET_VALUE,
> valuep, &info);
>       }

By the way, it's "Gray", not "gray". The backends (or specifically
sanei_constrain_value.c) are intelligent and check for wrong
capitalization but better be exact.

 
>       // Set tl_x to 50
>       if ( strcmp(opt->name, SANE_NAME_SCAN_TL_X) == 0)
>       {
>           value = 100;
>           valuep = (void *)&value;

Let's have a look at the fujitsu source code:
  opt = scanner->opt + OPT_TL_X;
  opt->name = SANE_NAME_SCAN_TL_X;
  opt->title = SANE_TITLE_SCAN_TL_X;
  opt->desc = SANE_DESC_SCAN_TL_X;
  opt->type = SANE_TYPE_FIXED;

So it's fixed, not int. So use value = SANE_FIX(100.0).

> Before I added these codes, everything worked just fine,

That's because the default settings for the geometry was used.

> but after I added
> these codes, although the status codes returned from these
> sane_control_option are all SANE_STATUS_GOOD, sane_start() could not funtion
> correctly, the scanner just pulled the document in a little bit and then
> stopped, the status code returned was SANE_STATUS_INVAL. I declared value as
> SANE_WORD and valuep as (void *),
> 
> Am I doing something wrong?

Basically, you just set the geometry to 0, 0, 0, 0. So I guess nothing
was scanned. Maybe the backend should have a test for this in
sane_start(). Well, maybe it has and that's why you got the error.

If you set tl_x to 100 that means 100/(2^16) = 0.0015 mm. Well, that's
not much to scan :-)

Bye,
  Henning



More information about the sane-devel mailing list