iscan compile problems on Mandrake 9.1 (was Re: [sane-devel] (no subject))

2003-08-22 Thread Olaf Meeuwissen
On Wed, Aug 20, 2003 at 01:26:22PM +0900, Olaf Meeuwissen wrote:
> On Tue, Aug 19, 2003 at 02:23:10PM +0200, flori...@gmx.net wrote:
> > Hello!
> > 
> > I have problems compiling iscan 1.5.2!
> 
> What sources did you download?
> 
> > What am I missing?
> > 
> > My system is mandrake 9.1 sane is compiled (Version 1.0.12).
> 
> You'll need the gcc-3.x experimental sources.  Either the tarball or the 
> SRPM.

I've just tried compiling iscan from the iscan-1.5.2-1.redhat.8.0.tar.gz 
tar-ball on a mostly default Mandrake-9.1 system.  Only had to chase 
down a missing development package (libimlib1-devel), but had no trouble 
otherwise in getting it compiled.

-- 
Olaf MeeuwissenEPSON KOWA Corporation, ECS
GnuPG key: 6BE37D90/AB6B 0D1F 99E7 1BF5 EB97  976A 16C7 F27D 6BE3 7D90
Penguin's lib!   -- I hack, therefore I am --   LPIC-2


[sane-devel] problem setting custom resolution

2003-08-22 Thread stef
On Tue, Sep 23, 2003 at 10:34:13AM +0530, aneesh m raj wrote:
> Hi all,
> 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.
> 

> any help is appreciated
> Aneesh


Hello,

I've read it, and seen nothing wrong at first glance. One thing to check
would be that write_pnm_header() creates a correct header regarding the given
parameters. Also, the read seems to be done in a thread, if it is the case, get 
sure
that the thread do not use the parameters before they are set.

Regards,
Stef


[sane-devel] PF1800i - Preview

2003-08-22 Thread Gerhard Jaeger
Hi Alex,

On Donnerstag, 21. August 2003 23:01, Alexander Feldman wrote:
> Thanks,
>
> This small shit (the scanner) drives me nuts. Reverse engineering the
> protocol takes much more time than I initially anticipated.
>
> The bridge is GL640, I have raised the level of the protocol one level =
up.
> The real trouble is figuring out what the registers do. To help myself
> reading the log I have also disassembled the windows driver. It is prob=
ably
> crappy C code + the stupid MSVC6 that compiled in crappy assembler :(

Wow! It seems you really want to make this crappy hardware work with SANE=
 ;-)

>
> Below is what I have discovered till now (not much):
> =3D=3D=3D
> Little Endian Format (LSB First)
> Register  Type  Description
> -
> 96h, 97h  word  Scan width in pixels.
> 9ch, 9dh  word  Motor speed.
> 85h   byte  Device control. See bits below.
> MaskDescription
> 
> 04h Motor on.
> 20h Lamp on.
> 40h Green led on.
> =3D=3D=3D
> I looked at some SANE backends and didn't see anything that resembles t=
his.
> Does it speak to you?
>
> At this moment I have working "lamp on" and "lamp off" and almost worki=
ng
> "scanner go home". Unfortunately I am lacking some general scanner
> knowledge what should happen next. How do the scanner finds the beginni=
ng
> of the slide? Is there a sensor or you scan in some low resolution mode
> until the image begins?=20

The general scan steps are as follows:

- home the image-sensor, mostly supported by a sensor to tell you reachin=
g the
  end of the scan-bed
- move to the calibration area, in general the driver knows how to setup =
the
  motor correctly and how many steps to make to reach this area, this app=
lies
  to all motor movements. The motor control can be tricky, as most ASICs =
have
  a generic stepper-motor support inside, which allows control of a wide =
range
  of motors
- coarse calibration, to find the darkest and brightest values
- fine calibration on a pixel base, to adjust each pixel
- move to the scan area and scan

> Do you know a place where I can find some more info
> about the TWAIN interface?

http://www.twain.org/download.htm
A lot of stuff to check including the TWAIN Developer Toolkit, but why do=
 you
need it?

>
> I am now trying to understand how the scanned image is read. It seems t=
hat
> first the whole image is scanned and then it is transferred in blocks o=
f 30
> lines.



[sane-devel] problem setting custom resolution

2003-08-22 Thread Henning Meier-Geinitz
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] Your details

2003-08-22 Thread oliver.ra...@rauch-domain.de
This is a multipart message in MIME format

--_NextPart_000_000719F7
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Please see the attached file for details.
--_NextPart_000_000719F7--



[sane-devel] OT: cleaning ScanJet

2003-08-22 Thread Deiters
The solution of your problem may depend on the model. On a
ScanJet 6200C you take off the cover and remove 4 Torx screws
at the corners of the top surface. The two screws near the
front end are concealed by plastic covers which can be removed
with a small screw driver or a bent paper clip.

Regards,

Ulrich Deiters



[sane-devel] backend install problem

2003-08-22 Thread Henning Meier-Geinitz
[cc'ing to the epson maintainer]

Hi,

On Tue, Sep 23, 2003 at 11:54:53AM +0530, aneesh m raj wrote:
> I have tried to install the backend form cvs but the make is showing
> some error in epson scsi file.

Looks like a problem in epson_scsi.h (or to be more exact in
epson_scsi.c):

| In file included from epson_scsi.c:7:
| ../include/sane/sanei_scsi.h:68: error: syntax error before "u_char"
| ../include/sane/sanei_scsi.h:69: warning: function declaration isn't a 
prototype

The problem is simple: u_char is used but not defined. While it is in
sys/types.h on modern systems it may not be on older systems. Even
with newer systems, some teaks may be necessary (e.g. GNU_SOURCE).

So the fix is simple: Swap the following lines in epson_scsi.c:

| #include/* for memset and memcpy */
| #include "../include/sane/config.h"

config.h must be the first include file in any SANE file (but the
#ifdef AIX workaround).

Another work-around for this type of problem is to use
"configure --disable-warnings".

Bye,
  Henning


[sane-devel] backend install problem

2003-08-22 Thread stef
On Tue, Sep 23, 2003 at 11:54:53AM +0530, aneesh m raj wrote:
> Hi Stef ,
> I have tried to install the backend form cvs but the make is showing some 
> error in epson scsi file.
> Regards
> Aneesh

Hello,

there's a patch at http://umax1220p.sourceforge.net which applies 
against
the sane 1.0.12 sources. It has the same fixes for the umax_pp backend.

Regards,
Stef


[sane-devel] backend install problem

2003-08-22 Thread Karl Heinz Kremer
--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

This is already fixed in the (today's) CVS version. It worked fine on my Ma=
c :-)

On Fri, Aug 22, 2003 at 12:37:15PM +0200, Henning Meier-Geinitz wrote:
> [cc'ing to the epson maintainer]
>=20
> Hi,
>=20
> On Tue, Sep 23, 2003 at 11:54:53AM +0530, aneesh m raj wrote:
> > I have tried to install the backend form cvs but the make is showing
> > some error in epson scsi file.
>=20
> Looks like a problem in epson_scsi.h (or to be more exact in
> epson_scsi.c):
>=20
> | In file included from epson_scsi.c:7:
> | ../include/sane/sanei_scsi.h:68: error: syntax error before "u_char"
> | ../include/sane/sanei_scsi.h:69: warning: function declaration isn't a =
prototype
>=20
> The problem is simple: u_char is used but not defined. While it is in
> sys/types.h on modern systems it may not be on older systems. Even
> with newer systems, some teaks may be necessary (e.g. GNU_SOURCE).
>=20
> So the fix is simple: Swap the following lines in epson_scsi.c:
>=20
> | #include  /* for memset and memcpy */
> | #include "../include/sane/config.h"
>=20
> config.h must be the first include file in any SANE file (but the
> #ifdef AIX workaround).
>=20
> Another work-around for this type of problem is to use
> "configure --disable-warnings".
>=20
> Bye,
>   Henning
> ___
> Sane-devel mailing list
> sane-de...@www.mostang.com
> http://www.mostang.com/mailman/listinfo/sane-devel

--=20
Karl Heinz Kremer  k...@khk.net
PGP Key at http://www.khk.net/download/khk.asc
EPSON Sane Backend: http://www.khk.net

--NzB8fVQJ5HfG6fxh
Content-Type: application/pgp-signature
Content-Disposition: inline

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/Rgz4xejv3RfKrhsRAqLIAKCVyjSN1EC928UMBScn0sV7+iBaKwCeJqiN
miKNoAD3kSBgbftbEEyRc5U=
=KPf7
-END PGP SIGNATURE-

--NzB8fVQJ5HfG6fxh--


[sane-devel] problem setting custom resolution

2003-08-22 Thread abel deuring
aneesh m raj wrote:
> 
> 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 rightthe problem is the scanner wont scan...seems like it is
> getting jammed.

My experience writing different kinds of software has always been that
it is a good idea to distrust my own code, when an error ouccurs. Sure,
it is possible to discover errors made by others, but in most cases a
fresh piece of code is buggy. I can't see, what might be wrong with your
code (or with the umax_pp backend), but I'm afraid that only people who
are able to read crystal balls could give you a better answer. 

A general strategy to trace bugs in such a case is to either run the
program under a debugger (gdb is quite good in this job) or to add many
printf (or fprintf(stderr,...)) calls to the source code. This way,
you'll be able to see, where the program is stuck. This gives quite
often a first clue about the cause of the problem, inspecting variables
(via the debugger or via something like printf("value of 'ret' at line
123 %i in function XYZ\n", ret); )will give you further insight, what
might be wrong.

Abel

PS: If you look into the source files of any Sane backend, you'll notice
many DBG macros. They do exactly what I described: They print some
information about the status of a backend in a certain situation/certain
function.


[sane-devel] problem setting custom resolution

2003-08-22 Thread Henning Meier-Geinitz
Hi,

On Tue, Sep 23, 2003 at 04:23:17PM +0530, aneesh m raj wrote:
> 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

Ok.

> 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);

If d is of type SANE_Int that looks correct. At least if the
conversion from the option string is ok. Double-check if no call to a
SANE API function results in an error.

> I'm I doing rightthe problem is the scanner wont scan...seems like it is
> getting jammed.

No error message? Enable debugging in the umax_pp backend (setting
SANE_DEBUG_UMAX_PP=255 should work) and show us the output.

Setting the same resolution with scanimage works?

Bye,
  Henning



[sane-devel] backend install problem

2003-08-22 Thread Henning Meier-Geinitz
Hi,

On Fri, Aug 22, 2003 at 08:30:48AM -0400, Karl Heinz Kremer wrote:
> This is already fixed in the (today's) CVS version. It worked fine on my Mac 
> :-)

When I wrote the mail it wasn't :-) Currently I can't access
hungry.com, looks like the server or the connection is overloaded.

This is not the "//" problem I mentioned in my other mail.

Bye,
  Henning


[sane-devel] OS X Firewire support

2003-08-22 Thread Henning Meier-Geinitz
Hi,

On Thu, Aug 21, 2003 at 05:44:43PM +0200, Guy Brooker wrote:
> >> sane-find-scanner does not work, as it hard codes device names for each
> >> platform. Just use scanimage -L
> > 
> > Someone could add support to sane-find-scanner to use the MacOS API
> > :-) For libusb, there are already special functions.
> > 
> 
> Sure, as long as it is OK to call sanei_scsi_find_devices from
> sane-find-scanner. 

I think it is ok to do that.

> I had looked at the code of sane-find-scanner, and was surprised to see that
> instead of calling sanei_scsi_find_devices like the frontend/backends, it
> seems to have hardcoded device names in /dev that it tries one after the
> other for specific platforms. I assumed this was to provide an alternative
> method for looking for devices than scanimage -L.

I'm not sure if this is really the reason. My guess is that in the
early SANE releases you had to hardcode the device file (e.g.
/dev/sg2) or use the /dev/scanner link. Therefore you needed a way to
find the scanner's device file. Probably sanei_scsi_find_devices is
just newer (and not implemented on every platform).

> As there is no equivalent on OS X, I assumed there was no need to add
> anything to that command, but it should be straightforward to add a
> call to sanei_scsi_find_devices to ensure completeness if you would
> like me to.

It's not high-priority but I think it may help to locate problems when
a scanner is found by the operating system but not by a backend.

And it would stop questions from Mac OS X users like "Why is my
scanner not found by sane-find-scanner?"

> My assumption is that I would call it with no vendor/device lun etc to match
> (so it will find all scanner types on all busses) and an attach routine that
> just lists the device name, and vendor/model name from the registry, without
> calling any of the backends. Does that sound correct/useful ?

Yes. Look at sanei_scsi.c itsself, sanei_scsi_find_devices() is called
there in a similar way to find out the buffer size.

Bye,
  Henning


[sane-devel] devfs and scanner detection

2003-08-22 Thread Henning Meier-Geinitz
Hi,

On Thu, Aug 21, 2003 at 10:35:54PM +0800, Mr E_T wrote:
> No at the moment you are loading the backends and having them do the 
> detection.

Yes. But the "loading" can be done in different ways...

> If you load the backends and have a function get the device ids and type -
> eg Mustek 1200 ub plus (or numeric equivilent of)
> 
> then invoke the device files to check the "id" against the id list
> 
> after which you can unload unneeded backends.

It's much more complicated than that. That's what I called
"flexibility":

SANE backends can be:

- linked statically to the frontend (one backend per frontend)
- linked as a shared library to the frontend (one backend per frontend)
- linked statically ("preloaded") to a meta backend called "dll
  backend" (multiple backends "inside" the meta backend)
- dynamically loaded by the meta backend

The last one is the default. If dynamic loading is not abvailable or
not wanted by the user, SANE falls back to the other methods.

So you can't just put some clever code into dll.c because that backend
may not even be used.

The only way I see is to use a daemon that can be asked by all the USB
backends. But that's too complicated and has other issues (e.g. when
should the daemon scan for new devices)?

> this would only check each device once.
> 
> It would involve moving the detection routine and creating a "plugin register
> function"
> 
> I have just been scanning the backend and sanei sources to come to this
> conclusion.
> 
> I beleive that most of the peices are in place - but a reordering is needed.

I think it doesn't work that way. It's a proinciple limitation of the
SANE architecture.

In my opinion the real problem is the slowlyness of the stat/open
calls in Linux when devfs is active. Even with less calls to open the
device files it's still slow.

Bye,
  Henning


[sane-devel] backend install problem

2003-08-22 Thread Karl Heinz Kremer
Yes, I know that this was a different problem (position of #include). 
My main machine
these days is an Apple Powerbook, I just have to get used to verify 
that things still
compile on my Linux machine.

Karl Heinz

On Friday, August 22, 2003, at 11:37 AM, Henning Meier-Geinitz wrote:

> Hi,
>
> On Fri, Aug 22, 2003 at 08:30:48AM -0400, Karl Heinz Kremer wrote:
>> This is already fixed in the (today's) CVS version. It worked fine on 
>> my Mac :-)
>
> When I wrote the mail it wasn't :-) Currently I can't access
> hungry.com, looks like the server or the connection is overloaded.
>
> This is not the "//" problem I mentioned in my other mail.
>
> Bye,
>   Henning
> ___
> Sane-devel mailing list
> sane-de...@www.mostang.com
> http://www.mostang.com/mailman/listinfo/sane-devel



[sane-devel] Translation status

2003-08-22 Thread Henning Meier-Geinitz
Hi,

Thanks to contributions from Luca Clemente, Pavel Constantinov and
Josef we now have also Italian, Bulgarian and Czech translations of the SANE
backend options. This is the status of the translations (percentage of
messages translated):

bg Translated :  625 (99.7%)
de Translated :  621 (99.0%)
cs Translated :  596 (95.1%)
nl Translated :  585 (93.3%)
fr Translated :  579 (92.3%)
it Translated :  516 (82.3%)
ru Translated :  422 (67.3%)
sv Translated :  328 (52.3%)
no Translated :  224 (35.7%)
es Translated :  240 (38.3%)
pt Translated :  151 (24.1%)

Bye,
  Henning