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

Peter Chen peterchenn@hotmail.com
Thu, 24 Apr 2003 18:07:53 -0500


I tried scanimage with --mode=gray, and it worked fine. But I could not do
it with --duplex=both. It said:
scanimage: sane_start: invalid argument. scanadf did not work either.

I'm using RedHat 7.2 with fi-4120c, and I feel it works fine with usb, at
least now:). When I tried to use sane-find-scanner under RedHat 7.1, it gave
me a lot of 'minor errors', so I changed to RedHat 7.2.

I figured out that I have to use (void *) to pass to sane_control_option.
Now I can setup grayscale and adf in my application.

Thanks a lot,
----- Original Message -----
From: "m. allan noah" <anoah@pfeiffer.edu>
To: "Peter Chen" <peterchenn@hotmail.com>
Cc: "SANE Mailing List" <sane-devel@mostang.com>
Sent: Thursday, April 24, 2003 5:33 PM
Subject: Re: [sane-devel] Problem with setting Fujitsu fi-4120c to Grayscale


> ok, in your prior mails it would have been helpful to explain the you were
> writing an application, not just trying to use the scanner with the
> existing frontends.
>
> can you set the grayscale and resolution without error using scanimage?
> does it work every time? if not, then it is likely a driver problem, try
> it with the scsi port as well. if there is a difference, then you might be
> onto something.
>
> i have just plugged my 4120c into a usb port for the first time, and i
> get device errors that lock scanadf hard. i should have some time to play
> with it next week (finally). anything you come up with between now and
> then, please mail the list, so that others can see.
>
> allan
>
> On Thu, 24 Apr 2003, Peter Chen wrote:
>
> > 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@www.mostang.com
> > http://www.mostang.com/mailman/listinfo/sane-devel
> >
>
> --
> "so don't tell us it can't be done, putting down what you don't know.
> money isn't our god, integrity will free our souls" - Max Cavalera
>
>