[sane-devel] Lexmark X1100 backend available

Fred Odendaal freshshelf at rogers.com
Sun Sep 25 19:06:24 UTC 2005


Thanks Frank,

Replies are below your comments.

Frank Zago wrote:

> Hi Fred,
>
> Good job.
>
> I have a few remarks about the the code:
> - option are prefixed by LXK_ (eg LXK_OPT_SCAN_SIZE). Backends usually 
> don't use a prefix.

This was a carry over from the Lexmark Linux developer's kit code, which 
I started from. I'll change it.

> - size_list[] doesn't have A4 and other standard formats. You can get 
> some values at http://www.cl.cam.ac.uk/~mgk25/iso-paper.html

I'll add this to my todo list, because adding more sizes will require 
more scan logs and more testing...

> - in sane_start(), sane_read(), and probably other, you check whether 
> the handle is a valid one. While this is correct I think it's 
> overkill. The frontend should be trusted.

Again, a carry over from the Lexmark code. I'll remove the checks.

> - bytes_read in sane_read() should be a long instead of ssize_t to 
> avoid a cast.

Will change.

> - in lexmark-x1000.c, there 6 global variables (transfer_buffer, ...). 
> They should be per scanner instance. Same thing with at least eof, 
> x_dpi and y_dpi in lexmark.c.

So, put them in the device record?

> - shouldnt the lexmark copyright be in lexmark-x1000.c too?

No, lexmark-x1100.c was entirely written by me. lexmark.h and lexmark.c 
were adapted from code in Lexmark's Linux development kit.

> - unless you intend to add more code to read_buffer_is_empty(), get 
> rid of it.

I know its unecessary, but I'd like to keep it. I did a lot of object 
oriented programming in school and some at work. I really like the data 
abstraction with this technique - the calling code doesn't need to know 
the implementation of the read buffer...

> - you could replace "scan-size" with SANE_NAME_PAPER_SIZE which is 
> already used by 2 other backends.

Will do.

>
> I also get the following warnings when I compile (target is x86_64):

Thanks. For some reason I only get the 1st warming when I compile - same 
target.

>
> lexmark-x1100.c:59:1: warning: "BACKEND_NAME" redefined
> <command line>:10:1: warning: this is the location of the previous 
> definition
> lexmark-x1100.c: In function `x1100_read_scan_data':
> lexmark-x1100.c:2359: warning: unsigned int format, different type arg 
> (arg 3)
> lexmark-x1100.c:2360: warning: unsigned int format, different type arg 
> (arg 3)
> lexmark-x1100.c:2361: warning: cast from pointer to integer of 
> different size
> lexmark-x1100.c:2395: warning: unsigned int format, different type arg 
> (arg 3)
> lexmark-x1100.c:2396: warning: unsigned int format, different type arg 
> (arg 3)
> lexmark-x1100.c: In function `read_buffer_bytes_available':
> lexmark-x1100.c:2728: warning: comparison between signed and unsigned
>
>
> Regards,
>  Frank.
>




More information about the sane-devel mailing list