[sane-devel] Problem with setting Fujitsu fi-4120c to Grayscale

Oliver Schirrmeister oschirr at abm.de
Fri Apr 25 08:39:38 BST 2003


Use the strings 'Lineart', 'Halftone', 'Gray' or 'Color' to set option
scan_mode. As far as I can see, value=3 does not work.
Which function returned SANE_STATUS_INVAL? sane_control_option with
option SANE_NAME_SCAN_MODE? That should only happen when you try
to set mode 'Halftone'.

Oliver


Am Don, 2003-04-24 um 22.43 schrieb Peter Chen:
> Hi all,
> 
> I tried to set fi-4120c to Grayscale. I used the following code flow:
> 
>         status = sane_init(version_code, NULL);
>         status = sane_get_devices(&device_list, true);
>         ...
>         sane_exit();
> 
>         status = sane_init(version_code, NULL);
>         status = sane_open("dev/usb/scanner0", &device );
>         sane_control_option (device, 0, SANE_ACTION_GET_VALUE,
> &num_dev_options, 0);
>   for (i = 0; i < num_dev_options; ++i)
>     {
>       opt = sane_get_option_descriptor (device, i);
>       // Set the resolutions to 300 dpi
>       if ( strcmp(opt->name, SANE_NAME_SCAN_X_RESOLUTION) == 0)
>       {
>           value = 300;
>           sane_control_option (device, i, SANE_ACTION_SET_VALUE, &value,
> &info);
>       }
>       if ( strcmp(opt->name, SANE_NAME_SCAN_Y_RESOLUTION) == 0)
>       {
>           value = 300;
>           sane_control_option (device, i, SANE_ACTION_SET_VALUE, &value,
> &info);
>       }
>       // Set the scan mode to GrayScale
>       if ( strcmp(opt->name, SANE_NAME_SCAN_MODE) == 0)
>       {
>           value = 3;
>           sane_control_option (device, i, SANE_ACTION_SET_VALUE, &value,
> &info);
>       }
>     }
> 
> The first time I ran it, it successfully set fi-4120c to GrayScale (when I
> debug, I could see that), but then later when I did that, it always returned
> SANE_STATUS_INVAL, even after I rebooted my linux box and fi-4120c. I could
> set the resolutions successfully. What did I do wrong?
> 
> Thanks,
> 
> Peter
> _______________________________________________
> Sane-devel mailing list
> Sane-devel at www.mostang.com
> http://www.mostang.com/mailman/listinfo/sane-devel





More information about the sane-devel mailing list