Hi, This is the resolution range value Rang min:4915200 Range max:78643200 This is in FIXED format when I UNFIX it I''l get 75 and 1200 The user will set the resolution in UNFIXED form in the range 75 to 1200 When I set the resolution I'll convert the value by if (opt->type == SANE_TYPE_FIXED) d = strtod (option, &end) * (1 << SANE_FIXED_SCALE_SHIFT); and after that I'll set the option
I'm I doing right....the problem is the scanner wont scan...seems like it is getting jammed. Regards Aneesh ----- Original Message ----- From: "Henning Meier-Geinitz" <henn...@meier-geinitz.de> To: <sane-de...@www.mostang.com> Sent: Friday, August 22, 2003 11:33 AM Subject: Re: [sane-devel] problem setting custom resolution > Hi, > > On Tue, Sep 23, 2003 at 10:34:13AM +0530, aneesh m raj wrote: > > Im trying to read the scanned data using sane form UMAX 2000p but > > when i set a custom resolution the read is causing some problem. This > > is my code. > > Which problem exactly? Does it work with other frontends? > > The code looks mostly ok for me, only some error checking for NULL-pointers > is missing. And be careful not to create buffer overflows with strcpy. > > You should put sane_start inside the outer "do" loop if this loop is > intended for multi-pass scanning. > > > do > > { > > > > status = read_data(devHnd, buffer, MAX_LEN, &len); > > if(status == SANE_STATUS_GOOD ) > > { > > > > fwrite(buffer,len,sizeof(SANE_Byte),fp); > > } > > else if(status != SANE_STATUS_EOF) > > { > > > > set_error(act); > > printf("Reading scanned data failed...\n"); > > } > > free(buffer); > > buffer = (SANE_Byte*)malloc(sizeof(SANE_Byte) * MAX_LEN); > > I don't understand why you free the buffer and malloc it right again. > > > > }while( status == SANE_STATUS_GOOD && len != 0); > > len can be 0 when you called sane_set_io_mode and set the io_mode to > non-blocking. > > > if( status == SANE_STATUS_EOF) > > { > > pthread_cond_signal(&pollevent); > > printf("Reading complete...\n"); > > } > > else > > { > > pthread_cond_signal(&pollevent); > > ret = 1; > > set_error(act); > > printf("Reason: %s",(char*)sane_strstatus(status)); > > } > > If you get an error here, I'd leave the "do" loop. It doesn't really > make sense to try to read the other frames if reading one of them > resulted in an error. > > > any help is appreciated > > How do you set the resolution? To which value? How does read_data() > look like? > > Bye, > Henning > _______________________________________________ > Sane-devel mailing list > sane-de...@www.mostang.com > http://www.mostang.com/mailman/listinfo/sane-devel >