Re: [dev] New and updated backends

From: Henning Meier-Geinitz (hmg-ml@gmx.de)
Date: Fri Apr 13 2001 - 06:17:30 PDT

  • Next message: Henning Meier-Geinitz: "[dev] Problems with epson USB (mis)detection"

    Hi,

    On Mon, Apr 09, 2001 at 05:16:04PM +0200, stef wrote:
    > For the UMAX Astra parallel port backend, support for the Astra 1600 is
    > being working on. It is expected to be finished by the end of April.

    That's fine.

    > The next step will be then inclusion in SANE. How shall it be done ?

    The usual way is that some of the developers take a look at the
    backend and somebody with CVS access does the initial CVS commit. To
    make later updates possible you should get CVS write access from Petter
    Reinholdtsen (see his CVS page).

    > The only thing I see is that a couple of files need to be reformatted to follow SANE
    > codin style.
    >
    > Currently, the 1220/1600/2000P backend is made of:
    >
    > - umax-low.c / umax-low.h : low level scanner access part
    > - umax1220p.c / umax1220p.h : sane helper functions
    > - umax-pp.c / umax_pp.h / umax_pp.conf / umax_pp.desc : backend

    Ok, I took a quick look at the backend's code. I would use the
    backend's name umax_pp for all files to avoid confusion what file is from the
    SCSI and what file is from the PP backend.

    Maybe something like:

    - umax_pp-low.c / umax_pp-low.h : low level scanner access part
    - umax_pp-1220p.c / umax_pp-1220p.h : sane helper functions
    - umax_pp.c / umax_pp.h / umax_pp.conf / umax_pp.desc : backend

    Some points (please have a look at doc/backend-writing.txt also):

    * Check the comments: I don't think that the umax_pp backend is
      "Copyright (C) 2000 Jochen Eisinger <jochen.eisinger@gmx.net>"
      at least not for the whole backend :-). If you took bigger parts of
      other backends into your code a comment would be nice, however.
    * It's probably better to add the standard SANE comment about the
      licence in all files not only umax_pp.c.
    * use "static" for all functions and global variables that shouldn't
      be exported --> everything that's not in the SANE standard. I didn't
      check this, so there needn't be a problem. Maybe
      it's better to include the C-files and don't build different object
      files?
    * don't use printf or fprintf for printing anything to the console.
      Don't use perror either. Use DBG instead.
    * use ./configure --enable-warnings to find out about problems e.g.
      the c++-style comments ("//").
    * include sane/config.h in every independant c file
    * add a README entry in tools/README for umax1220p.c
    * add a man page
    * umax_pp.desc: add link to sourceforge page (+ man page). Maybe to HP
      (http://www.hp.com). Version is "1" but UMAX_PP_BUILD is "3"?
    * Add entries for AUTORS and README

    Compilation test with latest sane CVS:

    On Linux 2.2/x386/glibc:

    gcc -c -g -O2 -W -Wall -Wstrict-prototypes -Wreturn-type -Wcast-align
    -Wpointer-arith -Wcast-qual -pedantic -ansi -DHAVE_CONFIG_H -I. -I.
    -I../include -I../include -D_GNU_SOURCE
    -DPATH_SANE_CONFIG_DIR=/usr/local/etc/sane.d
    -DPATH_SANE_DATA_DIR=/usr/local/share -DV_MAJOR=1 -DV_MINOR=0
    -DBACKEND_NAME=umax-low -DLIBDIR=/usr/local/lib/sane umax-low.c -fPIC
    -DPIC -o .libs/umax-low.lo
    In file included from umax-low.c:29:
    umax-low.h:131: unterminated string or character constant
    umax-low.c:3947: warning: string constant runs past end of line
    make[1]: *** [umax-low.lo] Fehler 1

    That's a c++-style comment. I removed all of them for further testing:

    umax-low.c:3947: warning: string constant runs past end of line
    In file included from umax-low.c:9:
    /usr/include/sys/io.h:42: syntax error before unsigned'
    [...]

    It's just a warning but may break on other systems: don't use string constants
    that are longer then one line (see backend-writing.txt).

    The syntax error(s) seem to occur because sane/config.h isn't included.

    After these changes it can be compiled but quite some warnings remain.
      
    Now, if I do "scanimage -L" I get:
    ioperm: Operation not permitted

    That shouldn't happen. No output should be generated if
    SANE_DEBUG_UMAX_PP isn't set.

    Oh, and please do not ever do something like this:
          perror("iopl");
          exit(-1);
    perror prints to standard error and exit exits the whole program, so
    no other backends can be found and the frontend is terminated.
                
    I didn't do further runtime testing.

    Irix:

    cc -c -g -DHAVE_CONFIG_H -I. -I. -I../include -I../include
    -D_GNU_SOURCE -DPATH_SANE_CONFIG_DIR=/tmp/sane-bin/etc/sane.d
    -DPATH_SANE_DATA_DIR=/tmp/sane-bin/share -DV_MAJOR=1 -DV_MINOR=0
    -DBACKEND_NAME=umax-low -DLIBDIR=/tmp/sane-bin/lib/sane umax-low.c
    -DPIC -o .libs/umax-low.lo
    cfe: Error: umax-low.c: 11: Cannot open file sys/io.h for #include
    gmake[1]: *** [umax-low.lo] Error 1

    You must test for the existence of this file.

    Solaris: Couldn't test beacuse of problems with ar

    AIX:
    [lots of warnings in umax*]

    in tools/:
    gcc -o umax1220p umax1220p.o ../backend/umax-low.lo ../sanei/libsanei.a ../lib/liblib.a -lnsl -lm
    ld: 0711-317 ERROR: Undefined symbol: .inb
    ld: 0711-317 ERROR: Undefined symbol: .outb
    ld: 0711-317 ERROR: Undefined symbol: .insb
    ld: 0711-317 ERROR: Undefined symbol: .outsb
    ld: 0711-317 ERROR: Undefined symbol: .insl
    ld: 0711-317 ERROR: Undefined symbol: .outsw
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    collect2: ld returned 8 exit status
    gmake[1]: *** [umax1220p] Error 1

    Bye,
      Henning

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
    



    This archive was generated by hypermail 2b29 : Fri Apr 13 2001 - 05:56:21 PDT